--- a/wp/wp-includes/rest-api/endpoints/class-wp-rest-site-health-controller.php Thu Sep 29 08:06:27 2022 +0200
+++ b/wp/wp-includes/rest-api/endpoints/class-wp-rest-site-health-controller.php Fri Sep 05 18:40:08 2025 +0200
@@ -43,6 +43,7 @@
* Registers API routes.
*
* @since 5.6.0
+ * @since 6.1.0 Adds page-cache async test.
*
* @see register_rest_route()
*/
@@ -151,11 +152,29 @@
array(
'methods' => 'GET',
'callback' => array( $this, 'get_directory_sizes' ),
- 'permission_callback' => function() {
- return $this->validate_request_permission( 'debug_enabled' ) && ! is_multisite();
+ 'permission_callback' => function () {
+ return $this->validate_request_permission( 'directory_sizes' ) && ! is_multisite();
},
)
);
+
+ register_rest_route(
+ $this->namespace,
+ sprintf(
+ '/%s/%s',
+ $this->rest_base,
+ 'page-cache'
+ ),
+ array(
+ array(
+ 'methods' => 'GET',
+ 'callback' => array( $this, 'test_page_cache' ),
+ 'permission_callback' => function () {
+ return $this->validate_request_permission( 'page_cache' );
+ },
+ ),
+ )
+ );
}
/**
@@ -243,6 +262,18 @@
}
/**
+ * Checks that full page cache is active.
+ *
+ * @since 6.1.0
+ *
+ * @return array The test result.
+ */
+ public function test_page_cache() {
+ $this->load_admin_textdomain();
+ return $this->site_health->get_test_page_cache();
+ }
+
+ /**
* Gets the current directory sizes for this install.
*
* @since 5.6.0
@@ -305,7 +336,7 @@
// Accounts for inner REST API requests in the admin.
if ( ! is_admin() ) {
$locale = determine_locale();
- load_textdomain( 'default', WP_LANG_DIR . "/admin-$locale.mo" );
+ load_textdomain( 'default', WP_LANG_DIR . "/admin-$locale.mo", $locale );
}
}