From c47c99900c2af664e353abdcc57e20e31549f5e1 Mon Sep 17 00:00:00 2001 From: Clorith Date: Thu, 20 May 2021 11:09:56 +0000 Subject: [PATCH] Site Health: Skip REST tests during scheduled events. This change fixes a false positive that would appear during scheduled events, by only running the REST test when a user visits the Site Health page, meaning an active session is available. The test checking if the REST API is available, includes a parameter for `context=edit` to make sure the block editor can function properly. This means a user session with editor capabilities is required for the test to pass, which is not the case during a scheduled event. Props szaqal21, TimothyBlynJacobs, hermpheus. Fixes #52112. Built from https://develop.svn.wordpress.org/trunk@50939 git-svn-id: http://core.svn.wordpress.org/trunk@50548 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/class-wp-site-health.php | 8 ++++++-- wp-includes/version.php | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/wp-admin/includes/class-wp-site-health.php b/wp-admin/includes/class-wp-site-health.php index a21045d291..be1d439aee 100644 --- a/wp-admin/includes/class-wp-site-health.php +++ b/wp-admin/includes/class-wp-site-health.php @@ -2361,8 +2361,9 @@ class WP_Site_Health { // Conditionally include REST rules if the function for it exists. if ( function_exists( 'rest_url' ) ) { $tests['direct']['rest_availability'] = array( - 'label' => __( 'REST API availability' ), - 'test' => 'rest_availability', + 'label' => __( 'REST API availability' ), + 'test' => 'rest_availability', + 'skip_cron' => true, ); } @@ -2729,6 +2730,9 @@ class WP_Site_Health { } foreach ( $tests['direct'] as $test ) { + if ( ! empty( $test['skip_cron'] ) ) { + continue; + } if ( is_string( $test['test'] ) ) { $test_function = sprintf( diff --git a/wp-includes/version.php b/wp-includes/version.php index 8baf5cbc74..99bbb0a69b 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.8-alpha-50938'; +$wp_version = '5.8-alpha-50939'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.