WordPress/wp-admin/includes
Felix Arntz dbfbf5501a Security, Site Health: Make migrating a site to HTTPS a one-click interaction.
Switching a WordPress site from HTTP to HTTPS has historically been a tedious task. While on the surface the Site Address and WordPress Address have to be updated, existing content still remains using HTTP URLs where hard-coded in the database. Furthermore, updating _two_ URLs to migrate to HTTPS is still a fairly unintuitive step which is not clearly explained.

This changeset simplifies migration from HTTP to HTTPS and, where possible, makes it a one-click interaction.

* Automatically replace insecure versions of the Site Address (`home_url()`) with its HTTPS counterpart on the fly if the site has been migrated from HTTP to HTTPS. This is accomplished by introducing a `https_migration_required` option and enabling it when the `home_url()` is accordingly changed.
    * A new `wp_replace_insecure_home_url()` function is hooked into various pieces of content to replace URLs accordingly.
    * The migration only kicks in when the Site Address (`home_url()`) and WordPress Address (`site_url()`) match, which is the widely common case. Configurations where these differ are often maintained by more advanced users, where this migration routine would be less essential - something to potentially iterate on in the future though.
    * The migration does not actually update content in the database. More savvy users that prefer to do that can prevent the migration logic from running by either deleting the `https_migration_required` option or using the new `wp_should_replace_insecure_home_url` filter.
    * For fresh sites that do not have any content yet at the point of changing the URLs to HTTPS, the migration will also be skipped since it would not be relevant.
* Expose a primary action in the Site Health recommendation, if HTTPS is already supported by the environment, built on top of the HTTPS detection mechanism from [49904]. When clicked, the default behavior is to update `home_url()` and `site_url()` in one go to their HTTPS counterpart.
    * A new `wp_update_urls_to_https()` function takes care of the update routine.
    * A new `update_https` meta capability is introduced to control access.
    * If the site's URLs are controlled by constants, this update is not automatically possible, so in these scenarios the user is informed about that in the HTTPS status check in Site Health.
* Allow hosting providers to modify the URLs linked to in the HTTPS status check in Site Health, similar to how that is possible for the URLs around updating the PHP version.
    * A `WP_UPDATE_HTTPS_URL` environment variable or `wp_update_https_url` filter can be used to provide a custom URL with guidance about updating the site to use HTTPS.
    * A `WP_DIRECT_UPDATE_HTTPS_URL` environment variable or `wp_direct_update_https_url` filter can be used to provide a custom URL for the primary CTA to update the site to use HTTPS.

Props flixos90, timothyblynjacobs.
Fixes #51437.

Built from https://develop.svn.wordpress.org/trunk@50131


git-svn-id: http://core.svn.wordpress.org/trunk@49810 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-02 00:10:01 +00:00
..
admin-filters.php Administration: Remove multiple viewport meta tags from mobile pages. 2020-07-09 23:29:08 +00:00
admin.php Code Modernization: Replace `dirname( __FILE__ )` calls with `__DIR__` magic constant. 2020-02-06 06:33:11 +00:00
ajax-actions.php Users: enable admins to send users a reset password link. 2021-02-01 22:13:03 +00:00
bookmark.php Docs: Document the `$linkdata` parameter of `wp_insert_link()` using hash notation. 2020-11-03 03:52:10 +00:00
class-automatic-upgrader-skin.php Docs: Add missing descriptions for `Automatic_Upgrader_Skin` methods. 2020-11-14 16:23:10 +00:00
class-bulk-plugin-upgrader-skin.php Text Changes: Unify various "Back to..." vs. "Return to..." vs. "Go to..." strings. 2020-11-09 10:53:10 +00:00
class-bulk-theme-upgrader-skin.php Text Changes: Unify various "Back to..." vs. "Return to..." vs. "Go to..." strings. 2020-11-09 10:53:10 +00:00
class-bulk-upgrader-skin.php Code Modernisation: Introduce the spread operator in `wp-admin/includes/class-*-upgrader-skin.php`. 2019-09-15 10:42:54 +00:00
class-core-upgrader.php Upgrade/Install: Allow WordPress sites to opt-in to development releases. 2021-01-30 10:34:02 +00:00
class-custom-background.php Themes: Ensure that only privileged users can set a background image when a theme is using the deprecated custom background page. 2020-10-29 18:09:13 +00:00
class-custom-image-header.php Coding standards: Modify escaping functions to avoid potential false positives. 2020-10-29 18:03:11 +00:00
class-file-upload-upgrader.php Docs: Improve inline comments per the documentation standards. 2020-01-29 00:45:18 +00:00
class-ftp-pure.php Docs: Update URLs in some `@link` tags and switch them to HTTPS. 2019-11-01 14:57:02 +00:00
class-ftp-sockets.php Docs: Update URLs in some `@link` tags and switch them to HTTPS. 2019-11-01 14:57:02 +00:00
class-ftp.php General: Continuing to work towards a passing PHP Compatibility scan. 2020-06-03 17:40:12 +00:00
class-language-pack-upgrader-skin.php Text Changes: Unify various "Back to..." vs. "Return to..." vs. "Go to..." strings. 2020-11-09 10:53:10 +00:00
class-language-pack-upgrader.php Docs: Add missing `@return` tag to `Language_Pack_Upgrader::check_package()`. 2020-10-05 13:44:11 +00:00
class-pclzip.php Code Modernization: Use `instanceof` instead of a comparison with `get_class()`. 2020-10-18 17:33:07 +00:00
class-plugin-installer-skin.php Docs: Add missing `@since` tags for `WP_Upgrader_Skin` methods. 2020-11-21 12:08:05 +00:00
class-plugin-upgrader-skin.php Text Changes: Unify various "Back to..." vs. "Return to..." vs. "Go to..." strings. 2020-11-09 10:53:10 +00:00
class-plugin-upgrader.php Upgrade/Install: Remove a duplicate description for the `upgrader_overwrote_package` action. 2020-12-10 23:38:04 +00:00
class-theme-installer-skin.php Docs: Add missing `@since` tags for `WP_Upgrader_Skin` methods. 2020-11-21 12:08:05 +00:00
class-theme-upgrader-skin.php Text Changes: Unify various "Back to..." vs. "Return to..." vs. "Go to..." strings. 2020-11-09 10:53:10 +00:00
class-theme-upgrader.php Upgrade/Install: Remove a duplicate description for the `upgrader_overwrote_package` action. 2020-12-10 23:38:04 +00:00
class-walker-category-checklist.php Docs: Further corrections and promotions for docblocks relating to `object` types. 2020-10-18 20:53:08 +00:00
class-walker-nav-menu-checklist.php Docs: Corrections and improvements to types used in various docblocks. 2021-01-05 17:16:11 +00:00
class-walker-nav-menu-edit.php Menus: Check the correct variable in `Walker_Nav_Menu_Edit::start_el()` when menu item is a taxonomy term. 2020-06-17 19:47:14 +00:00
class-wp-ajax-upgrader-skin.php Docs: Add missing descriptions for `Automatic_Upgrader_Skin` methods. 2020-11-14 16:23:10 +00:00
class-wp-application-passwords-list-table.php App Passwords: Ensure the Created At and Last Used dates are properly translated. 2020-12-03 21:06:08 +00:00
class-wp-automatic-updater.php Coding Standards: Fix WPCS issues in [49242]. 2020-10-20 18:31:07 +00:00
class-wp-comments-list-table.php Coding Standards: Replace alias PHP functions with the canonical names. 2020-10-18 17:27:06 +00:00
class-wp-community-events.php Docs: In various `@return` tags, list the expected type first, instead of `false` or `WP_Error`. 2021-01-04 17:18:04 +00:00
class-wp-debug-data.php Site Health: Add `WP_MEMORY_LIMIT` constant to debug info. 2020-12-27 19:27:06 +00:00
class-wp-filesystem-base.php Docs: Corrections and improvements to types used in various docblocks. 2021-01-05 17:16:11 +00:00
class-wp-filesystem-direct.php Docs: Corrections and improvements to types used in various docblocks. 2021-01-05 17:16:11 +00:00
class-wp-filesystem-ftpext.php Docs: Corrections and improvements to types used in various docblocks. 2021-01-05 17:16:11 +00:00
class-wp-filesystem-ftpsockets.php Docs: Corrections and improvements to types used in various docblocks. 2021-01-05 17:16:11 +00:00
class-wp-filesystem-ssh2.php Docs: Corrections and improvements to types used in various docblocks. 2021-01-05 17:16:11 +00:00
class-wp-importer.php Docs: Improve the docs for the globals that are used in the actions and filters API. 2020-10-18 19:19:06 +00:00
class-wp-internal-pointers.php Docs: Improve inline comments per the documentation standards. 2020-01-29 00:45:18 +00:00
class-wp-links-list-table.php Posts, Post Types: Introduce "Filter by date" and "Filter by category" as post type and taxonomy labels, respectively. 2021-02-01 14:13:00 +00:00
class-wp-list-table-compat.php Docs: Add missing descriptions for `_WP_List_Table_Compat` methods. 2020-11-14 16:54:08 +00:00
class-wp-list-table.php Posts, Post Types: Introduce "Filter by date" and "Filter by category" as post type and taxonomy labels, respectively. 2021-02-01 14:13:00 +00:00
class-wp-media-list-table.php Docs: Switch a comment in `WP_Media_List_Table::prepare_items()` to multi-line format, per the documentation standards. 2021-01-29 18:54:01 +00:00
class-wp-ms-sites-list-table.php Docs: Further corrections and promotions for docblocks relating to `object` types. 2020-10-18 20:53:08 +00:00
class-wp-ms-themes-list-table.php Administration: Make sure auto-update counts properly update when bulk deleting plugins or themes. 2020-11-12 20:42:10 +00:00
class-wp-ms-users-list-table.php Docs: Fix and upgrade various `object` docblock notations. 2020-10-17 16:05:09 +00:00
class-wp-plugin-install-list-table.php Coding Standards: Use strict comparison in `wp-admin/includes/class-wp-plugin-install-list-table.php`. 2020-09-11 01:05:08 +00:00
class-wp-plugins-list-table.php Plugins: Make sure the HTML ID attributes for plugin checkboxes are unique. 2020-11-17 16:48:09 +00:00
class-wp-post-comments-list-table.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:51:36 +00:00
class-wp-posts-list-table.php Posts, Post Types: Introduce "Filter by date" and "Filter by category" as post type and taxonomy labels, respectively. 2021-02-01 14:13:00 +00:00
class-wp-privacy-data-export-requests-list-table.php Coding Standards: Fix WPCS issues in [49258]. 2020-10-20 21:20:07 +00:00
class-wp-privacy-data-removal-requests-list-table.php Coding Standards: Fix WPCS issues in [49258]. 2020-10-20 21:20:07 +00:00
class-wp-privacy-policy-content.php Privacy: Clarify the "Contact information" heading in default privacy policy content. 2021-01-11 19:53:14 +00:00
class-wp-privacy-requests-table.php Privacy: Show failures before successes for all bulk actions. 2020-10-27 18:19:06 +00:00
class-wp-screen.php Plugins: Replace usage of `$this` in action and filter parameter docblocks with more appropriate variable names. 2021-01-08 14:30:14 +00:00
class-wp-site-health-auto-updates.php Upgrade/Install: Allow WordPress sites to opt-in to development releases. 2021-01-30 10:34:02 +00:00
class-wp-site-health.php Security, Site Health: Make migrating a site to HTTPS a one-click interaction. 2021-02-02 00:10:01 +00:00
class-wp-site-icon.php Docs: Various docblock corrections relating to parameter types. 2020-11-24 21:22:04 +00:00
class-wp-terms-list-table.php Quick/Bulk Edit: By the power vested in me, I hereby declare the top bulk actions and the bottom bulk actions joined forever in MatrimonyScript. 2021-01-07 16:23:07 +00:00
class-wp-theme-install-list-table.php Themes: Add missing `<p>` tags to error message in `WP_Theme_Install_List_Table::prepare_items()`. 2021-01-10 19:37:06 +00:00
class-wp-themes-list-table.php I18N: Add context to some theme strings for consistency. 2020-07-21 16:33:05 +00:00
class-wp-upgrader-skin.php Docs: Add missing `@since` tags for `WP_Upgrader_Skin` methods. 2020-11-21 12:08:05 +00:00
class-wp-upgrader-skins.php Docs: Add missing `@deprecated` tags in the file docblock of some deprecated files. 2019-10-08 17:19:04 +00:00
class-wp-upgrader.php Plugins: Replace usage of `$this` in action and filter parameter docblocks with more appropriate variable names. 2021-01-08 14:30:14 +00:00
class-wp-users-list-table.php Users: enable admins to send users a reset password link. 2021-02-01 22:13:03 +00:00
comment.php Docs: Docblock corrections relating to `WP_Post` objects. 2020-11-09 15:15:08 +00:00
continents-cities.php I18N: Update list of continents and cities for the timezone selection. 2018-07-18 11:21:25 +00:00
credits.php Administration: Allow `wp_credits()` to accept `$version` and `$locale` parameters. 2020-08-03 12:53:08 +00:00
dashboard.php Site Health: Update the language around how PHP should be updated. 2021-01-28 17:23:09 +00:00
deprecated.php Docs: Document globals in `dropdown_categories()` and `dropdown_link_categories()`. 2021-01-24 13:59:58 +00:00
edit-tag-messages.php Coding Standards: Fix the `Squiz.PHP.DisallowMultipleAssignments` violations in `wp-admin`. 2019-07-01 12:52:01 +00:00
export.php Export: Create an export-specific filter for post titles. 2021-01-25 00:09:59 +00:00
file.php Administration: Remove italic text to improve readability. 2021-01-27 21:03:57 +00:00
image-edit.php Docs: Promote many `bool` types to `true` or `false` where only that value is used. 2021-01-03 22:04:04 +00:00
image.php Docs: Corrections and improvements to types used in various docblocks. 2021-01-05 17:16:11 +00:00
import.php Docs: Corrections and improvements to types used in various docblocks. 2021-01-05 17:16:11 +00:00
list-table.php Docs: Promote many `bool` types to `true` or `false` where only that value is used. 2021-01-03 22:04:04 +00:00
media.php Media: Use consistent method for instantiating an attachment author object in Media Library. 2021-01-18 12:55:07 +00:00
menu.php Coding Standards: Use strict comparison for `count()` calls. 2020-05-23 11:38:08 +00:00
meta-boxes.php Docs: Fix and upgrade various `object` docblock notations. 2020-10-17 16:05:09 +00:00
misc.php Administration: Standardize colors used in CSS to a single palette. 2021-01-26 18:54:59 +00:00
ms-admin-filters.php Docs: Improve comments in some `wp-admin` files per the documentation standards. 2020-01-29 00:35:08 +00:00
ms-deprecated.php I18N: Capitalize translator comments consistently, add trailing punctuation. 2019-09-03 00:41:05 +00:00
ms.php External Libraries: First pass at fixing jQuery deprecations in WordPress core and bundled themes. 2021-01-22 12:32:03 +00:00
nav-menu.php Administration: Better targeting for required form field highlighting. 2020-10-23 15:05:09 +00:00
network.php Docs: Corrections and improvements to types used in various docblocks. 2021-01-05 17:16:11 +00:00
noop.php Code Modernization: Remove conditional use of PHP `realpath()`. 2019-09-20 20:46:56 +00:00
options.php External Libraries: First pass at fixing jQuery deprecations in WordPress core and bundled themes. 2021-01-22 12:32:03 +00:00
plugin-install.php Docs: Miscellaneous docblock fixes. 2020-10-17 14:54:05 +00:00
plugin.php Docs: Corrections and improvements to types used in various docblocks. 2021-01-05 17:16:11 +00:00
post.php Docs: Corrections and improvements to types used in various docblocks. 2021-01-05 17:16:11 +00:00
privacy-tools.php Privacy: Add newlines to the `index.php` file in `wp-personal-data-exports` directory, for consistency with other similar files. 2021-01-28 12:58:58 +00:00
revision.php Revisions: Address PHP/JS errors when viewing autosave on imported posts. 2021-02-01 22:03:01 +00:00
schema.php Upgrade/Install: Enable all core autoupdates for new installs. 2020-11-12 20:22:09 +00:00
screen.php Docs: Various formatting improvements to inline docblocks. 2020-07-23 00:52:05 +00:00
taxonomy.php Docs: Promote many `bool` types to `true` or `false` where only that value is used. 2021-01-03 22:04:04 +00:00
template.php Docs: Corrections and improvements to types used in various docblocks. 2021-01-05 17:16:11 +00:00
theme-install.php Upgrade/install: Fix/clarify the "Upload in a zip format" string. 2020-07-19 17:11:02 +00:00
theme.php Upgrade/Install: Don't show theme update prompts on subsites. 2020-10-20 19:14:09 +00:00
translation-install.php Docs: Promote many `bool` types to `true` or `false` where only that value is used. 2021-01-03 22:04:04 +00:00
update-core.php Update `$_old_files` for 5.6. 2020-12-08 21:50:07 +00:00
update.php Upgrade/Install: Display correct message about the current version in the admin footer. 2021-02-01 14:29:01 +00:00
upgrade.php App Passwords: Store the "in use" option in the main network options. 2020-12-07 15:59:04 +00:00
user.php Docs: Promote many `bool` types to `true` or `false` where only that value is used. 2021-01-03 22:04:04 +00:00
widgets.php Accessibility: Widgets: Add a "Cancel" link when editing a widget in accessibility mode. 2020-10-09 15:53:08 +00:00