Security: remove the cron event that checked for https support.
Fix an issue where a cron job ran every 12 hours to check for https support - even when https support was already enabled. The check is now run only when the user visits the Site Health page. Reducing the unneeded requests lowers the impact and load of hosting WordPress sites. The `wp_update_https_detection_errors` function is deprecated and the `https_detection_errors` option that was previously set by the cron job is no longer maintained. The `pre_wp_update_https_detection_errors` filter is deprecated and replaced by the `pre_wp_get_https_detection_errors` filter which serves the same function. Props audrasjb, johnbillion, Michi91. Fixes #58494. Built from https://develop.svn.wordpress.org/trunk@56664 git-svn-id: http://core.svn.wordpress.org/trunk@56176 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -1555,10 +1555,9 @@ class WP_Site_Health {
|
||||
*/
|
||||
public function get_test_https_status() {
|
||||
/*
|
||||
* Enforce fresh HTTPS detection results. This is normally invoked by using cron,
|
||||
* but for Site Health it should always rely on the latest results.
|
||||
* Check HTTPS detection results.
|
||||
*/
|
||||
wp_update_https_detection_errors();
|
||||
$errors = wp_get_https_detection_errors();
|
||||
|
||||
$default_update_url = wp_get_default_update_https_url();
|
||||
|
||||
|
||||
@@ -2340,6 +2340,12 @@ function upgrade_640() {
|
||||
if ( $wp_current_db_version < 56657 ) {
|
||||
// Enable attachment pages.
|
||||
update_option( 'wp_attachment_pages_enabled', 1 );
|
||||
|
||||
// Remove the wp_https_detection cron. Https status is checked directly in an async Site Health check.
|
||||
$scheduled = wp_get_scheduled_event( 'wp_https_detection' );
|
||||
if ( $scheduled ) {
|
||||
wp_clear_scheduled_hook( 'wp_https_detection' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user