This commit is contained in:
Hanson.xyz Dev
2026-01-04 17:50:08 -06:00
parent 7e45ce0756
commit acc8ac87a0
4131 changed files with 232562 additions and 250244 deletions
+90 -19
View File
@@ -18,7 +18,7 @@ class WP_Site_Health {
private $mysql_server_version = '';
private $mysql_required_version = '5.5';
private $mysql_recommended_version = '8.0';
private $mariadb_recommended_version = '10.5';
private $mariadb_recommended_version = '10.6';
public $php_memory_limit;
@@ -728,8 +728,8 @@ class WP_Site_Health {
$result = array(
'label' => sprintf(
/* translators: %s: The recommended PHP version. */
__( 'Your site is running a recommended version of PHP (%s)' ),
/* translators: %s: The server PHP version. */
__( 'Your site is running PHP %s' ),
PHP_VERSION
),
'status' => 'good',
@@ -739,11 +739,7 @@ class WP_Site_Health {
),
'description' => sprintf(
'<p>%s</p>',
sprintf(
/* translators: %s: The minimum recommended PHP version. */
__( 'PHP is one of the programming languages used to build WordPress. Newer versions of PHP receive regular security updates and may increase your site&#8217;s performance. The minimum recommended version of PHP is %s.' ),
$response ? $response['recommended_version'] : ''
)
__( 'PHP is one of the programming languages used to build WordPress. Newer versions of PHP receive regular security updates and may increase your site&#8217;s performance.' )
),
'actions' => sprintf(
'<p><a href="%s" target="_blank">%s<span class="screen-reader-text"> %s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>',
@@ -755,8 +751,36 @@ class WP_Site_Health {
'test' => 'php_version',
);
if ( ! $response ) {
$result['label'] = sprintf(
/* translators: %s: The server PHP version. */
__( 'Unable to determine the status of the current PHP version (%s)' ),
PHP_VERSION
);
$result['status'] = 'recommended';
$result['description'] = '<p><em>' . sprintf(
/* translators: %s is the URL to the Serve Happy docs page. */
__( 'Unable to access the WordPress.org API for <a href="%s">Serve Happy</a>.' ),
'https://codex.wordpress.org/WordPress.org_API#Serve_Happy'
) . '</em></p>' . $result['description'];
return $result;
}
$result['description'] .= '<p>' . sprintf(
/* translators: %s: The minimum recommended PHP version. */
__( 'The minimum recommended version of PHP is %s.' ),
$response['recommended_version']
) . '</p>';
// PHP is up to date.
if ( ! $response || version_compare( PHP_VERSION, $response['recommended_version'], '>=' ) ) {
if ( version_compare( PHP_VERSION, $response['recommended_version'], '>=' ) ) {
$result['label'] = sprintf(
/* translators: %s: The server PHP version. */
__( 'Your site is running a recommended version of PHP (%s)' ),
PHP_VERSION
);
$result['status'] = 'good';
return $result;
}
@@ -1076,7 +1100,7 @@ class WP_Site_Health {
$result['status'] = 'recommended';
}
$failures[ $library ] = "<span class='dashicons $class'><span class='screen-reader-text'>$screen_reader</span></span> $message";
$failures[ $library ] = "<span class='dashicons $class' aria-hidden='true'></span><span class='screen-reader-text'>$screen_reader</span> $message";
}
}
@@ -2440,19 +2464,19 @@ class WP_Site_Health {
$page_cache_test_summary = array();
if ( empty( $page_cache_detail['response_time'] ) ) {
$page_cache_test_summary[] = '<span class="dashicons dashicons-dismiss"></span> ' . __( 'Server response time could not be determined. Verify that loopback requests are working.' );
$page_cache_test_summary[] = '<span class="dashicons dashicons-dismiss" aria-hidden="true"></span> ' . __( 'Server response time could not be determined. Verify that loopback requests are working.' );
} else {
$threshold = $this->get_good_response_time_threshold();
if ( $page_cache_detail['response_time'] < $threshold ) {
$page_cache_test_summary[] = '<span class="dashicons dashicons-yes-alt"></span> ' . sprintf(
$page_cache_test_summary[] = '<span class="dashicons dashicons-yes-alt" aria-hidden="true"></span> ' . sprintf(
/* translators: 1: The response time in milliseconds, 2: The recommended threshold in milliseconds. */
__( 'Median server response time was %1$s milliseconds. This is less than the recommended %2$s milliseconds threshold.' ),
number_format_i18n( $page_cache_detail['response_time'] ),
number_format_i18n( $threshold )
);
} else {
$page_cache_test_summary[] = '<span class="dashicons dashicons-warning"></span> ' . sprintf(
$page_cache_test_summary[] = '<span class="dashicons dashicons-warning" aria-hidden="true"></span> ' . sprintf(
/* translators: 1: The response time in milliseconds, 2: The recommended threshold in milliseconds. */
__( 'Median server response time was %1$s milliseconds. It should be less than the recommended %2$s milliseconds threshold.' ),
number_format_i18n( $page_cache_detail['response_time'] ),
@@ -2461,9 +2485,9 @@ class WP_Site_Health {
}
if ( empty( $page_cache_detail['headers'] ) ) {
$page_cache_test_summary[] = '<span class="dashicons dashicons-warning"></span> ' . __( 'No client caching response headers were detected.' );
$page_cache_test_summary[] = '<span class="dashicons dashicons-warning" aria-hidden="true"></span> ' . __( 'No client caching response headers were detected.' );
} else {
$headers_summary = '<span class="dashicons dashicons-yes-alt"></span>';
$headers_summary = '<span class="dashicons dashicons-yes-alt" aria-hidden="true"></span>';
$headers_summary .= ' ' . sprintf(
/* translators: %d: Number of caching headers. */
_n(
@@ -2479,10 +2503,10 @@ class WP_Site_Health {
}
if ( $page_cache_detail['advanced_cache_present'] ) {
$page_cache_test_summary[] = '<span class="dashicons dashicons-yes-alt"></span> ' . __( 'A page cache plugin was detected.' );
$page_cache_test_summary[] = '<span class="dashicons dashicons-yes-alt" aria-hidden="true"></span> ' . __( 'A page cache plugin was detected.' );
} elseif ( ! ( is_array( $page_cache_detail ) && ! empty( $page_cache_detail['headers'] ) ) ) {
// Note: This message is not shown if client caching response headers were present since an external caching layer may be employed.
$page_cache_test_summary[] = '<span class="dashicons dashicons-warning"></span> ' . __( 'A page cache plugin was not detected.' );
$page_cache_test_summary[] = '<span class="dashicons dashicons-warning" aria-hidden="true"></span> ' . __( 'A page cache plugin was not detected.' );
}
$result['description'] .= '<ul><li>' . implode( '</li><li>', $page_cache_test_summary ) . '</li></ul>';
@@ -2687,6 +2711,49 @@ class WP_Site_Health {
return $result;
}
/**
* Tests whether search engine indexing is enabled.
*
* Surfaces as “good” if `blog_public === 1`, or “recommended” if `blog_public === 0`.
*
* @since 6.9.0
*
* @return array The test results.
*/
public function get_test_search_engine_visibility() {
$result = array(
'label' => __( 'Search engine indexing is enabled.', 'default' ),
'status' => 'good',
'badge' => array(
'label' => __( 'Privacy', 'default' ),
'color' => 'blue',
),
'description' => sprintf(
'<p>%s</p>',
__( 'Search engines can crawl and index your site. No action needed.', 'default' )
),
'actions' => sprintf(
'<p><a href="%1$s">%2$s</a></p>',
esc_url( admin_url( 'options-reading.php#blog_public' ) ),
__( 'Review your visibility settings', 'default' )
),
'test' => 'search_engine_visibility',
);
// If indexing is discouraged, flip to “recommended”:
if ( ! get_option( 'blog_public' ) ) {
$result['status'] = 'recommended';
$result['label'] = __( 'Search engines are discouraged from indexing this site.', 'default' );
$result['badge']['color'] = 'blue';
$result['description'] = sprintf(
'<p>%s</p>',
__( 'Your site is hidden from search engines. Consider enabling indexing if this is a public site.', 'default' )
);
}
return $result;
}
/**
* Returns a set of tests that belong to the site status page.
*
@@ -2775,6 +2842,10 @@ class WP_Site_Health {
'label' => __( 'Autoloaded options' ),
'test' => 'autoloaded_options',
),
'search_engine_visibility' => array(
'label' => __( 'Search Engine Visibility' ),
'test' => 'search_engine_visibility',
),
),
'async' => array(
'dotorg_communication' => array(
@@ -3494,9 +3565,9 @@ class WP_Site_Health {
*
* The default is based on https://web.dev/time-to-first-byte/.
*
* @param int $threshold Threshold in milliseconds. Default 600.
*
* @since 6.1.0
*
* @param int $threshold Threshold in milliseconds. Default 600.
*/
return (int) apply_filters( 'site_status_good_response_time_threshold', 600 );
}