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
This commit is contained in:
parent
fabf5334a5
commit
c47c99900c
|
@ -2361,8 +2361,9 @@ class WP_Site_Health {
|
||||||
// Conditionally include REST rules if the function for it exists.
|
// Conditionally include REST rules if the function for it exists.
|
||||||
if ( function_exists( 'rest_url' ) ) {
|
if ( function_exists( 'rest_url' ) ) {
|
||||||
$tests['direct']['rest_availability'] = array(
|
$tests['direct']['rest_availability'] = array(
|
||||||
'label' => __( 'REST API availability' ),
|
'label' => __( 'REST API availability' ),
|
||||||
'test' => 'rest_availability',
|
'test' => 'rest_availability',
|
||||||
|
'skip_cron' => true,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2729,6 +2730,9 @@ class WP_Site_Health {
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ( $tests['direct'] as $test ) {
|
foreach ( $tests['direct'] as $test ) {
|
||||||
|
if ( ! empty( $test['skip_cron'] ) ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if ( is_string( $test['test'] ) ) {
|
if ( is_string( $test['test'] ) ) {
|
||||||
$test_function = sprintf(
|
$test_function = sprintf(
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @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.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue