Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
< ? php
/**
2019-04-02 17:32:53 -04:00
* Class for looking up a site 's health based on a user' s WordPress environment .
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
*
* @ package WordPress
* @ subpackage Site_Health
* @ since 5.2 . 0
*/
class WP_Site_Health {
2020-01-12 08:33:05 -05:00
private static $instance = null ;
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
private $mysql_min_version_check ;
private $mysql_rec_version_check ;
2019-08-14 20:35:55 -04:00
public $is_mariadb = false ;
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
private $mysql_server_version = '' ;
private $health_check_mysql_required_version = '5.5' ;
private $health_check_mysql_rec_version = '' ;
2020-05-05 14:58:09 -04:00
public $php_memory_limit ;
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
public $schedules ;
public $crons ;
2019-08-14 20:35:55 -04:00
public $last_missed_cron = null ;
public $last_late_cron = null ;
private $timeout_missed_cron = null ;
private $timeout_late_cron = null ;
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
/**
* WP_Site_Health constructor .
*
* @ since 5.2 . 0
*/
public function __construct () {
2020-01-12 08:33:05 -05:00
$this -> maybe_create_scheduled_event ();
2020-05-05 14:58:09 -04:00
// Save memory limit before it's affected by wp_raise_memory_limit( 'admin' ).
$this -> php_memory_limit = ini_get ( 'memory_limit' );
2019-08-14 20:35:55 -04:00
$this -> timeout_late_cron = 0 ;
$this -> timeout_missed_cron = - 5 * MINUTE_IN_SECONDS ;
if ( defined ( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ) {
$this -> timeout_late_cron = - 15 * MINUTE_IN_SECONDS ;
$this -> timeout_missed_cron = - 1 * HOUR_IN_SECONDS ;
}
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
add_filter ( 'admin_body_class' , array ( $this , 'admin_body_class' ) );
add_action ( 'admin_enqueue_scripts' , array ( $this , 'enqueue_scripts' ) );
2020-01-12 08:33:05 -05:00
add_action ( 'wp_site_health_scheduled_check' , array ( $this , 'wp_cron_scheduled_check' ) );
2021-04-16 21:14:01 -04:00
add_action ( 'site_health_tab_content' , array ( $this , 'show_site_health_tab' ) );
}
/**
* Output the content of a tab in the Site Health screen .
*
* @ since 5.8 . 0
*
* @ param string $tab Slug of the current tab being displayed .
*/
public function show_site_health_tab ( $tab ) {
if ( 'debug' === $tab ) {
require_once ABSPATH . '/wp-admin/site-health-info.php' ;
}
2020-01-12 08:33:05 -05:00
}
/**
* Return an instance of the WP_Site_Health class , or create one if none exist yet .
*
* @ since 5.4 . 0
*
* @ return WP_Site_Health | null
*/
2020-01-31 19:39:09 -05:00
public static function get_instance () {
2020-01-12 08:33:05 -05:00
if ( null === self :: $instance ) {
self :: $instance = new WP_Site_Health ();
}
return self :: $instance ;
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
}
/**
* Enqueues the site health scripts .
*
* @ since 5.2 . 0
*/
public function enqueue_scripts () {
$screen = get_current_screen ();
2020-01-12 08:33:05 -05:00
if ( 'site-health' !== $screen -> id && 'dashboard' !== $screen -> id ) {
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
return ;
}
$health_check_js_variables = array (
'screen' => $screen -> id ,
'nonce' => array (
'site_status' => wp_create_nonce ( 'health-check-site-status' ),
'site_status_result' => wp_create_nonce ( 'health-check-site-status-result' ),
),
'site_status' => array (
'direct' => array (),
'async' => array (),
'issues' => array (
'good' => 0 ,
'recommended' => 0 ,
'critical' => 0 ,
),
),
);
$issue_counts = get_transient ( 'health-check-site-status-result' );
if ( false !== $issue_counts ) {
$issue_counts = json_decode ( $issue_counts );
$health_check_js_variables [ 'site_status' ][ 'issues' ] = $issue_counts ;
}
2021-04-16 21:14:01 -04:00
if ( 'site-health' === $screen -> id && ( ! isset ( $_GET [ 'tab' ] ) || empty ( $_GET [ 'tab' ] ) ) ) {
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
$tests = WP_Site_Health :: get_tests ();
2019-04-17 10:35:50 -04:00
2020-10-20 12:23:07 -04:00
// Don't run https test on development environments.
if ( $this -> is_development_environment () ) {
2021-01-29 14:10:58 -05:00
unset ( $tests [ 'async' ][ 'https_status' ] );
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
}
2019-04-17 10:35:50 -04:00
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
foreach ( $tests [ 'direct' ] as $test ) {
2019-04-17 10:35:50 -04:00
if ( is_string ( $test [ 'test' ] ) ) {
$test_function = sprintf (
'get_test_%s' ,
$test [ 'test' ]
);
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
2019-04-17 10:35:50 -04:00
if ( method_exists ( $this , $test_function ) && is_callable ( array ( $this , $test_function ) ) ) {
2020-01-12 08:33:05 -05:00
$health_check_js_variables [ 'site_status' ][ 'direct' ][] = $this -> perform_test ( array ( $this , $test_function ) );
2019-04-17 10:35:50 -04:00
continue ;
}
}
if ( is_callable ( $test [ 'test' ] ) ) {
2020-01-12 08:33:05 -05:00
$health_check_js_variables [ 'site_status' ][ 'direct' ][] = $this -> perform_test ( $test [ 'test' ] );
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
}
}
foreach ( $tests [ 'async' ] as $test ) {
2019-04-17 10:35:50 -04:00
if ( is_string ( $test [ 'test' ] ) ) {
$health_check_js_variables [ 'site_status' ][ 'async' ][] = array (
'test' => $test [ 'test' ],
2020-10-14 22:00:08 -04:00
'has_rest' => ( isset ( $test [ 'has_rest' ] ) ? $test [ 'has_rest' ] : false ),
2019-04-17 10:35:50 -04:00
'completed' => false ,
2020-10-27 14:32:07 -04:00
'headers' => isset ( $test [ 'headers' ] ) ? $test [ 'headers' ] : array (),
2019-04-17 10:35:50 -04:00
);
}
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
}
}
wp_localize_script ( 'site-health' , 'SiteHealth' , $health_check_js_variables );
}
2020-01-12 08:33:05 -05:00
/**
* Run a Site Health test directly .
*
* @ since 5.4 . 0
*
2020-07-14 07:56:04 -04:00
* @ param callable $callback
2020-01-12 08:33:05 -05:00
* @ return mixed | void
*/
private function perform_test ( $callback ) {
/**
2020-08-10 20:34:08 -04:00
* Filters the output of a finished Site Health test .
2020-01-12 08:33:05 -05:00
*
* @ since 5.3 . 0
*
* @ param array $test_result {
2020-07-14 08:10:05 -04:00
* An associative array of test result data .
2020-01-12 08:33:05 -05:00
*
2020-07-23 03:39:02 -04:00
* @ type string $label A label describing the test , and is used as a header in the output .
* @ type string $status The status of the test , which can be a value of `good` , `recommended` or `critical` .
* @ type array $badge {
2020-01-12 08:33:05 -05:00
* Tests are put into categories which have an associated badge shown , these can be modified and assigned here .
*
2020-07-23 03:39:02 -04:00
* @ type string $label The test label , for example `Performance` .
* @ type string $color Default `blue` . A string representing a color to use for the label .
2020-01-12 08:33:05 -05:00
* }
2020-07-23 03:39:02 -04:00
* @ type string $description A more descriptive explanation of what the test looks for , and why it is important for the end user .
* @ type string $actions An action to direct the user to where they can resolve the issue , if one exists .
* @ type string $test The name of the test being ran , used as a reference point .
2020-01-12 08:33:05 -05:00
* }
*/
return apply_filters ( 'site_status_test_result' , call_user_func ( $callback ) );
}
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
/**
* Run the SQL version checks .
*
2020-06-25 08:43:07 -04:00
* These values are used in later tests , but the part of preparing them is more easily managed
* early in the class for ease of access and discovery .
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
*
* @ since 5.2 . 0
*
* @ global wpdb $wpdb WordPress database abstraction object .
*/
private function prepare_sql_data () {
global $wpdb ;
2022-09-04 10:40:14 -04:00
$mysql_server_type = $wpdb -> db_server_info ();
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
2019-08-27 23:09:52 -04:00
$this -> mysql_server_version = $wpdb -> get_var ( 'SELECT VERSION()' );
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
$this -> health_check_mysql_rec_version = '5.6' ;
if ( stristr ( $mysql_server_type , 'mariadb' ) ) {
$this -> is_mariadb = true ;
$this -> health_check_mysql_rec_version = '10.0' ;
}
$this -> mysql_min_version_check = version_compare ( '5.5' , $this -> mysql_server_version , '<=' );
$this -> mysql_rec_version_check = version_compare ( $this -> health_check_mysql_rec_version , $this -> mysql_server_version , '<=' );
}
/**
* Test if `wp_version_check` is blocked .
*
2020-06-25 08:43:07 -04:00
* It 's possible to block updates with the `wp_version_check` filter, but this can' t be checked
* during an Ajax call , as the filter is never introduced then .
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
*
2020-07-03 17:59:03 -04:00
* This filter overrides a standard page request if it ' s made by an admin through the Ajax call
2020-06-25 08:43:07 -04:00
* with the right query argument to check for this .
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
*
* @ since 5.2 . 0
*/
public function check_wp_version_check_exists () {
if ( ! is_admin () || ! is_user_logged_in () || ! current_user_can ( 'update_core' ) || ! isset ( $_GET [ 'health-check-test-wp_version_check' ] ) ) {
return ;
}
echo ( has_filter ( 'wp_version_check' , 'wp_version_check' ) ? 'yes' : 'no' );
die ();
}
/**
* Tests for WordPress version and outputs it .
*
2020-06-25 08:43:07 -04:00
* Gives various results depending on what kind of updates are available , if any , to encourage
* the user to install security updates as a priority .
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
*
* @ since 5.2 . 0
*
* @ return array The test result .
*/
public function get_test_wordpress_version () {
$result = array (
'label' => '' ,
'status' => '' ,
'badge' => array (
2019-04-06 12:00:51 -04:00
'label' => __ ( 'Performance' ),
Site Health: Improve the test badge implementation.
Label badges for each Site Health test currently display in either red, orange, or green, regardless of if the test passed or failed. This is confusing, as seeing red labels in the “Passed Test” section could alarm users (when really everything is OK and no action is required), and seeing green labels in the “Failed Tests” section would not appropriately encourage the user to take appropriate action.
This change makes several improvements to the label badges:
- Always right align the badges for consistent display.
- Remove background fill for badges. Instead, use a border.
- Use a consistent styling for all tests (passed and failed).
- The text color no longer uses true black (#000000).
- The `.badge.pink` CSS definition has been switched to `.badge.purple`, and the definitions for blue, gray, and green have also been updated to more closely follow the official WordPress color palette.
Props: pbiron, garrett-eclipse, hedgefield, Clorith, xkon, melchoyce, mdwolinski, alexdenning.
Fixes #46623.
Built from https://develop.svn.wordpress.org/trunk@45169
git-svn-id: http://core.svn.wordpress.org/trunk@44978 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-04-12 13:04:52 -04:00
'color' => 'blue' ,
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
),
'description' => '' ,
'actions' => '' ,
'test' => 'wordpress_version' ,
);
$core_current_version = get_bloginfo ( 'version' );
$core_updates = get_core_updates ();
if ( ! is_array ( $core_updates ) ) {
$result [ 'status' ] = 'recommended' ;
$result [ 'label' ] = sprintf (
2019-09-02 20:41:05 -04:00
/* translators: %s: Your current version of WordPress. */
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
__ ( 'WordPress version %s' ),
$core_current_version
);
$result [ 'description' ] = sprintf (
'<p>%s</p>' ,
2021-11-02 13:37:57 -04:00
__ ( 'Unable to check if any new versions of WordPress are available.' )
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
);
$result [ 'actions' ] = sprintf (
'<a href="%s">%s</a>' ,
esc_url ( admin_url ( 'update-core.php?force-check=1' ) ),
__ ( 'Check for updates manually' )
);
} else {
foreach ( $core_updates as $core => $update ) {
if ( 'upgrade' === $update -> response ) {
$current_version = explode ( '.' , $core_current_version );
$new_version = explode ( '.' , $update -> version );
$current_major = $current_version [ 0 ] . '.' . $current_version [ 1 ];
$new_major = $new_version [ 0 ] . '.' . $new_version [ 1 ];
$result [ 'label' ] = sprintf (
2019-09-02 20:41:05 -04:00
/* translators: %s: The latest version of WordPress available. */
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
__ ( 'WordPress update available (%s)' ),
$update -> version
);
$result [ 'actions' ] = sprintf (
'<a href="%s">%s</a>' ,
esc_url ( admin_url ( 'update-core.php' ) ),
__ ( 'Install the latest version of WordPress' )
);
if ( $current_major !== $new_major ) {
// This is a major version mismatch.
$result [ 'status' ] = 'recommended' ;
$result [ 'description' ] = sprintf (
'<p>%s</p>' ,
__ ( 'A new version of WordPress is available.' )
);
} else {
// This is a minor version, sometimes considered more critical.
2019-04-06 12:00:51 -04:00
$result [ 'status' ] = 'critical' ;
$result [ 'badge' ][ 'label' ] = __ ( 'Security' );
$result [ 'description' ] = sprintf (
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
'<p>%s</p>' ,
__ ( 'A new minor update is available for your site. Because minor updates often address security, it’s important to install them.' )
);
}
} else {
$result [ 'status' ] = 'good' ;
$result [ 'label' ] = sprintf (
2019-09-02 20:41:05 -04:00
/* translators: %s: The current version of WordPress installed on this site. */
2019-09-23 15:39:58 -04:00
__ ( 'Your version of WordPress (%s) is up to date' ),
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
$core_current_version
);
$result [ 'description' ] = sprintf (
'<p>%s</p>' ,
__ ( 'You are currently running the latest version of WordPress available, keep it up!' )
);
}
}
}
return $result ;
}
/**
* Test if plugins are outdated , or unnecessary .
*
2022-09-01 11:28:16 -04:00
* The test checks if your plugins are up to date , and encourages you to remove any
2020-06-25 08:43:07 -04:00
* that are not in use .
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
*
* @ since 5.2 . 0
*
* @ return array The test result .
*/
public function get_test_plugin_version () {
$result = array (
2019-07-16 18:13:58 -04:00
'label' => __ ( 'Your plugins are all up to date' ),
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
'status' => 'good' ,
'badge' => array (
2019-04-02 06:08:56 -04:00
'label' => __ ( 'Security' ),
Site Health: Improve the test badge implementation.
Label badges for each Site Health test currently display in either red, orange, or green, regardless of if the test passed or failed. This is confusing, as seeing red labels in the “Passed Test” section could alarm users (when really everything is OK and no action is required), and seeing green labels in the “Failed Tests” section would not appropriately encourage the user to take appropriate action.
This change makes several improvements to the label badges:
- Always right align the badges for consistent display.
- Remove background fill for badges. Instead, use a border.
- Use a consistent styling for all tests (passed and failed).
- The text color no longer uses true black (#000000).
- The `.badge.pink` CSS definition has been switched to `.badge.purple`, and the definitions for blue, gray, and green have also been updated to more closely follow the official WordPress color palette.
Props: pbiron, garrett-eclipse, hedgefield, Clorith, xkon, melchoyce, mdwolinski, alexdenning.
Fixes #46623.
Built from https://develop.svn.wordpress.org/trunk@45169
git-svn-id: http://core.svn.wordpress.org/trunk@44978 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-04-12 13:04:52 -04:00
'color' => 'blue' ,
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
),
'description' => sprintf (
'<p>%s</p>' ,
__ ( 'Plugins extend your site’s functionality with things like contact forms, ecommerce and much more. That means they have deep access to your site, so it’s vital to keep them up to date.' )
),
2019-04-12 13:40:53 -04:00
'actions' => sprintf (
'<p><a href="%s">%s</a></p>' ,
esc_url ( admin_url ( 'plugins.php' ) ),
__ ( 'Manage your plugins' )
),
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
'test' => 'plugin_version' ,
);
$plugins = get_plugins ();
$plugin_updates = get_plugin_updates ();
2022-05-05 12:29:08 -04:00
$plugins_active = 0 ;
$plugins_total = 0 ;
$plugins_need_update = 0 ;
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
// Loop over the available plugins and check their versions and active state.
foreach ( $plugins as $plugin_path => $plugin ) {
$plugins_total ++ ;
if ( is_plugin_active ( $plugin_path ) ) {
$plugins_active ++ ;
}
if ( array_key_exists ( $plugin_path , $plugin_updates ) ) {
2019-04-02 17:32:53 -04:00
$plugins_need_update ++ ;
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
}
}
// Add a notice if there are outdated plugins.
2019-04-02 17:32:53 -04:00
if ( $plugins_need_update > 0 ) {
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
$result [ 'status' ] = 'critical' ;
$result [ 'label' ] = __ ( 'You have plugins waiting to be updated' );
$result [ 'description' ] .= sprintf (
'<p>%s</p>' ,
sprintf (
2019-04-02 17:32:53 -04:00
/* translators: %d: The number of outdated plugins. */
_n (
'Your site has %d plugin waiting to be updated.' ,
'Your site has %d plugins waiting to be updated.' ,
$plugins_need_update
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
),
2019-04-02 17:32:53 -04:00
$plugins_need_update
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
)
);
2019-04-12 13:40:53 -04:00
$result [ 'actions' ] .= sprintf (
'<p><a href="%s">%s</a></p>' ,
2019-05-15 10:13:05 -04:00
esc_url ( network_admin_url ( 'plugins.php?plugin_status=upgrade' ) ),
2019-04-12 13:40:53 -04:00
__ ( 'Update your plugins' )
);
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
} else {
2019-04-02 17:32:53 -04:00
if ( 1 === $plugins_active ) {
$result [ 'description' ] .= sprintf (
'<p>%s</p>' ,
__ ( 'Your site has 1 active plugin, and it is up to date.' )
);
2022-08-03 10:32:12 -04:00
} elseif ( $plugins_active > 0 ) {
2019-04-02 17:32:53 -04:00
$result [ 'description' ] .= sprintf (
'<p>%s</p>' ,
sprintf (
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
/* translators: %d: The number of active plugins. */
_n (
2019-05-16 21:00:54 -04:00
'Your site has %d active plugin, and it is up to date.' ,
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
'Your site has %d active plugins, and they are all up to date.' ,
$plugins_active
2019-04-02 17:32:53 -04:00
),
$plugins_active
)
);
2022-08-03 09:09:09 -04:00
} else {
$result [ 'description' ] .= sprintf (
'<p>%s</p>' ,
__ ( 'Your site does not have any active plugins.' )
);
2019-04-02 17:32:53 -04:00
}
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
}
// Check if there are inactive plugins.
2019-05-01 14:08:53 -04:00
if ( $plugins_total > $plugins_active && ! is_multisite () ) {
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
$unused_plugins = $plugins_total - $plugins_active ;
$result [ 'status' ] = 'recommended' ;
2019-04-02 22:01:51 -04:00
$result [ 'label' ] = __ ( 'You should remove inactive plugins' );
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
$result [ 'description' ] .= sprintf (
2019-04-02 17:32:53 -04:00
'<p>%s %s</p>' ,
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
sprintf (
2019-04-02 17:32:53 -04:00
/* translators: %d: The number of inactive plugins. */
_n (
'Your site has %d inactive plugin.' ,
'Your site has %d inactive plugins.' ,
$unused_plugins
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
),
$unused_plugins
2019-04-02 17:32:53 -04:00
),
Administration: Replace contracted verb forms for better consistency.
This changeset replaces contracted verb forms like `doesn't`, `can't`, or `isn't` with non-contracted forms like `does not`, `cannot`, or `is not`, for better consistency across the WordPress administration. It also updates some corresponding unit tests strings.
Props Presskopp, socalchristina, aandrewdixon, francina, SergeyBiryukov, JeffPaul, audrasjb, hellofromTonya.
Fixes #38913.
See #39176.
Built from https://develop.svn.wordpress.org/trunk@52978
git-svn-id: http://core.svn.wordpress.org/trunk@52567 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-03-22 12:25:03 -04:00
__ ( 'Inactive plugins are tempting targets for attackers. If you are not going to use a plugin, you should consider removing it.' )
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
);
2019-04-12 13:40:53 -04:00
$result [ 'actions' ] .= sprintf (
'<p><a href="%s">%s</a></p>' ,
esc_url ( admin_url ( 'plugins.php?plugin_status=inactive' ) ),
__ ( 'Manage inactive plugins' )
);
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
}
return $result ;
}
/**
* Test if themes are outdated , or unnecessary .
*
2020-06-25 08:43:07 -04:00
* С hecks if your site has a default theme ( to fall back on if there is a need ),
* if your themes are up to date and , finally , encourages you to remove any themes
* that are not needed .
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
*
* @ since 5.2 . 0
*
* @ return array The test results .
*/
public function get_test_theme_version () {
$result = array (
2019-07-16 18:13:58 -04:00
'label' => __ ( 'Your themes are all up to date' ),
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
'status' => 'good' ,
'badge' => array (
2019-04-02 06:08:56 -04:00
'label' => __ ( 'Security' ),
Site Health: Improve the test badge implementation.
Label badges for each Site Health test currently display in either red, orange, or green, regardless of if the test passed or failed. This is confusing, as seeing red labels in the “Passed Test” section could alarm users (when really everything is OK and no action is required), and seeing green labels in the “Failed Tests” section would not appropriately encourage the user to take appropriate action.
This change makes several improvements to the label badges:
- Always right align the badges for consistent display.
- Remove background fill for badges. Instead, use a border.
- Use a consistent styling for all tests (passed and failed).
- The text color no longer uses true black (#000000).
- The `.badge.pink` CSS definition has been switched to `.badge.purple`, and the definitions for blue, gray, and green have also been updated to more closely follow the official WordPress color palette.
Props: pbiron, garrett-eclipse, hedgefield, Clorith, xkon, melchoyce, mdwolinski, alexdenning.
Fixes #46623.
Built from https://develop.svn.wordpress.org/trunk@45169
git-svn-id: http://core.svn.wordpress.org/trunk@44978 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-04-12 13:04:52 -04:00
'color' => 'blue' ,
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
),
'description' => sprintf (
'<p>%s</p>' ,
__ ( 'Themes add your site’s look and feel. It’s important to keep them up to date, to stay consistent with your brand and keep your site secure.' )
),
2019-04-12 13:40:53 -04:00
'actions' => sprintf (
'<p><a href="%s">%s</a></p>' ,
esc_url ( admin_url ( 'themes.php' ) ),
__ ( 'Manage your themes' )
),
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
'test' => 'theme_version' ,
);
$theme_updates = get_theme_updates ();
$themes_total = 0 ;
$themes_need_updates = 0 ;
$themes_inactive = 0 ;
// This value is changed during processing to determine how many themes are considered a reasonable amount.
$allowed_theme_count = 1 ;
$has_default_theme = false ;
$has_unused_themes = false ;
$show_unused_themes = true ;
$using_default_theme = false ;
// Populate a list of all themes available in the install.
$all_themes = wp_get_themes ();
$active_theme = wp_get_theme ();
2019-08-03 20:02:55 -04:00
// If WP_DEFAULT_THEME doesn't exist, fall back to the latest core default theme.
$default_theme = wp_get_theme ( WP_DEFAULT_THEME );
if ( ! $default_theme -> exists () ) {
$default_theme = WP_Theme :: get_core_default_theme ();
}
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
2019-08-03 20:02:55 -04:00
if ( $default_theme ) {
$has_default_theme = true ;
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
2019-08-03 20:02:55 -04:00
if (
$active_theme -> get_stylesheet () === $default_theme -> get_stylesheet ()
||
is_child_theme () && $active_theme -> get_template () === $default_theme -> get_template ()
) {
$using_default_theme = true ;
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
}
2019-08-03 20:02:55 -04:00
}
foreach ( $all_themes as $theme_slug => $theme ) {
$themes_total ++ ;
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
if ( array_key_exists ( $theme_slug , $theme_updates ) ) {
$themes_need_updates ++ ;
}
}
// If this is a child theme, increase the allowed theme count by one, to account for the parent.
2019-08-03 20:02:55 -04:00
if ( is_child_theme () ) {
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
$allowed_theme_count ++ ;
}
2019-04-23 17:37:53 -04:00
// If there's a default theme installed and not in use, we count that as allowed as well.
if ( $has_default_theme && ! $using_default_theme ) {
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
$allowed_theme_count ++ ;
}
if ( $themes_total > $allowed_theme_count ) {
$has_unused_themes = true ;
$themes_inactive = ( $themes_total - $allowed_theme_count );
}
// Check if any themes need to be updated.
if ( $themes_need_updates > 0 ) {
$result [ 'status' ] = 'critical' ;
$result [ 'label' ] = __ ( 'You have themes waiting to be updated' );
$result [ 'description' ] .= sprintf (
'<p>%s</p>' ,
sprintf (
2019-04-02 17:32:53 -04:00
/* translators: %d: The number of outdated themes. */
_n (
'Your site has %d theme waiting to be updated.' ,
'Your site has %d themes waiting to be updated.' ,
$themes_need_updates
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
),
$themes_need_updates
)
);
} else {
// Give positive feedback about the site being good about keeping things up to date.
2019-04-02 17:32:53 -04:00
if ( 1 === $themes_total ) {
$result [ 'description' ] .= sprintf (
'<p>%s</p>' ,
__ ( 'Your site has 1 installed theme, and it is up to date.' )
);
2022-08-03 10:32:12 -04:00
} elseif ( $themes_total > 0 ) {
2019-04-02 17:32:53 -04:00
$result [ 'description' ] .= sprintf (
'<p>%s</p>' ,
sprintf (
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
/* translators: %d: The number of themes. */
_n (
2019-05-16 21:00:54 -04:00
'Your site has %d installed theme, and it is up to date.' ,
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
'Your site has %d installed themes, and they are all up to date.' ,
$themes_total
2019-04-02 17:32:53 -04:00
),
$themes_total
)
);
2022-08-03 09:09:09 -04:00
} else {
$result [ 'description' ] .= sprintf (
'<p>%s</p>' ,
__ ( 'Your site does not have any installed themes.' )
);
2019-04-02 17:32:53 -04:00
}
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
}
2019-05-01 14:08:53 -04:00
if ( $has_unused_themes && $show_unused_themes && ! is_multisite () ) {
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
// This is a child theme, so we want to be a bit more explicit in our messages.
2020-05-18 00:38:10 -04:00
if ( $active_theme -> parent () ) {
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
// Recommend removing inactive themes, except a default theme, your current one, and the parent theme.
$result [ 'status' ] = 'recommended' ;
$result [ 'label' ] = __ ( 'You should remove inactive themes' );
if ( $using_default_theme ) {
$result [ 'description' ] .= sprintf (
2019-04-02 17:32:53 -04:00
'<p>%s %s</p>' ,
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
sprintf (
2019-04-02 17:32:53 -04:00
/* translators: %d: The number of inactive themes. */
_n (
'Your site has %d inactive theme.' ,
'Your site has %d inactive themes.' ,
$themes_inactive
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
),
2019-04-02 17:32:53 -04:00
$themes_inactive
),
sprintf (
/* translators: 1: The currently active theme. 2: The active theme's parent theme. */
Administration: Replace contracted verb forms for better consistency.
This changeset replaces contracted verb forms like `doesn't`, `can't`, or `isn't` with non-contracted forms like `does not`, `cannot`, or `is not`, for better consistency across the WordPress administration. It also updates some corresponding unit tests strings.
Props Presskopp, socalchristina, aandrewdixon, francina, SergeyBiryukov, JeffPaul, audrasjb, hellofromTonya.
Fixes #38913.
See #39176.
Built from https://develop.svn.wordpress.org/trunk@52978
git-svn-id: http://core.svn.wordpress.org/trunk@52567 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-03-22 12:25:03 -04:00
__ ( 'To enhance your site’s security, you should consider removing any themes you are not using. You should keep your active theme, %1$s, and %2$s, its parent theme.' ),
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
$active_theme -> name ,
$active_theme -> parent () -> name
)
);
} else {
$result [ 'description' ] .= sprintf (
2019-04-02 17:32:53 -04:00
'<p>%s %s</p>' ,
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
sprintf (
2019-04-02 17:32:53 -04:00
/* translators: %d: The number of inactive themes. */
_n (
'Your site has %d inactive theme.' ,
'Your site has %d inactive themes.' ,
$themes_inactive
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
),
2019-04-02 17:32:53 -04:00
$themes_inactive
),
sprintf (
/* translators: 1: The default theme for WordPress. 2: The currently active theme. 3: The active theme's parent theme. */
Administration: Replace contracted verb forms for better consistency.
This changeset replaces contracted verb forms like `doesn't`, `can't`, or `isn't` with non-contracted forms like `does not`, `cannot`, or `is not`, for better consistency across the WordPress administration. It also updates some corresponding unit tests strings.
Props Presskopp, socalchristina, aandrewdixon, francina, SergeyBiryukov, JeffPaul, audrasjb, hellofromTonya.
Fixes #38913.
See #39176.
Built from https://develop.svn.wordpress.org/trunk@52978
git-svn-id: http://core.svn.wordpress.org/trunk@52567 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-03-22 12:25:03 -04:00
__ ( 'To enhance your site’s security, you should consider removing any themes you are not using. You should keep %1$s, the default WordPress theme, %2$s, your active theme, and %3$s, its parent theme.' ),
2019-08-03 20:02:55 -04:00
$default_theme ? $default_theme -> name : WP_DEFAULT_THEME ,
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
$active_theme -> name ,
$active_theme -> parent () -> name
)
);
}
} else {
// Recommend removing all inactive themes.
$result [ 'status' ] = 'recommended' ;
$result [ 'label' ] = __ ( 'You should remove inactive themes' );
if ( $using_default_theme ) {
$result [ 'description' ] .= sprintf (
2019-04-02 17:32:53 -04:00
'<p>%s %s</p>' ,
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
sprintf (
2019-04-02 17:32:53 -04:00
/* translators: 1: The amount of inactive themes. 2: The currently active theme. */
_n (
'Your site has %1$d inactive theme, other than %2$s, your active theme.' ,
'Your site has %1$d inactive themes, other than %2$s, your active theme.' ,
$themes_inactive
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
),
$themes_inactive ,
$active_theme -> name
2019-04-02 17:32:53 -04:00
),
2021-11-02 13:37:57 -04:00
__ ( 'You should consider removing any unused themes to enhance your site’s security.' )
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
);
} else {
$result [ 'description' ] .= sprintf (
2019-04-02 17:32:53 -04:00
'<p>%s %s</p>' ,
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
sprintf (
2019-04-02 17:32:53 -04:00
/* translators: 1: The amount of inactive themes. 2: The default theme for WordPress. 3: The currently active theme. */
_n (
'Your site has %1$d inactive theme, other than %2$s, the default WordPress theme, and %3$s, your active theme.' ,
'Your site has %1$d inactive themes, other than %2$s, the default WordPress theme, and %3$s, your active theme.' ,
$themes_inactive
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
),
$themes_inactive ,
2019-08-03 20:02:55 -04:00
$default_theme ? $default_theme -> name : WP_DEFAULT_THEME ,
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
$active_theme -> name
2019-04-02 17:32:53 -04:00
),
2021-11-02 13:37:57 -04:00
__ ( 'You should consider removing any unused themes to enhance your site’s security.' )
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
);
}
}
}
2019-08-03 20:48:56 -04:00
// If no default Twenty* theme exists.
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
if ( ! $has_default_theme ) {
$result [ 'status' ] = 'recommended' ;
$result [ 'label' ] = __ ( 'Have a default theme available' );
$result [ 'description' ] .= sprintf (
'<p>%s</p>' ,
2020-07-03 17:59:03 -04:00
__ ( 'Your site does not have any default theme. Default themes are used by WordPress automatically if anything is wrong with your chosen theme.' )
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
);
}
return $result ;
}
/**
* Test if the supplied PHP version is supported .
*
* @ since 5.2 . 0
*
* @ return array The test results .
*/
public function get_test_php_version () {
$response = wp_check_php_version ();
$result = array (
'label' => sprintf (
2019-09-02 20:41:05 -04:00
/* translators: %s: The current PHP version. */
2020-02-10 19:41:05 -05:00
__ ( 'Your site is running the current version of PHP (%s)' ),
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
PHP_VERSION
),
'status' => 'good' ,
'badge' => array (
2019-04-06 12:00:51 -04:00
'label' => __ ( 'Performance' ),
Site Health: Improve the test badge implementation.
Label badges for each Site Health test currently display in either red, orange, or green, regardless of if the test passed or failed. This is confusing, as seeing red labels in the “Passed Test” section could alarm users (when really everything is OK and no action is required), and seeing green labels in the “Failed Tests” section would not appropriately encourage the user to take appropriate action.
This change makes several improvements to the label badges:
- Always right align the badges for consistent display.
- Remove background fill for badges. Instead, use a border.
- Use a consistent styling for all tests (passed and failed).
- The text color no longer uses true black (#000000).
- The `.badge.pink` CSS definition has been switched to `.badge.purple`, and the definitions for blue, gray, and green have also been updated to more closely follow the official WordPress color palette.
Props: pbiron, garrett-eclipse, hedgefield, Clorith, xkon, melchoyce, mdwolinski, alexdenning.
Fixes #46623.
Built from https://develop.svn.wordpress.org/trunk@45169
git-svn-id: http://core.svn.wordpress.org/trunk@44978 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-04-12 13:04:52 -04:00
'color' => 'blue' ,
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
),
'description' => sprintf (
'<p>%s</p>' ,
2019-09-23 15:39:58 -04:00
sprintf (
/* translators: %s: The minimum recommended PHP version. */
2021-01-27 19:17:58 -05:00
__ ( 'PHP is the programming language used to build and maintain WordPress. Newer versions of PHP are created with increased performance in mind, so you may see a positive effect on your site’s performance. The minimum recommended version of PHP is %s.' ),
2020-04-27 18:01:08 -04:00
$response ? $response [ 'recommended_version' ] : ''
2019-09-23 15:39:58 -04:00
)
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
),
'actions' => sprintf (
2020-10-19 19:39:04 -04:00
'<p><a href="%s" target="_blank" rel="noopener">%s <span class="screen-reader-text">%s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>' ,
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
esc_url ( wp_get_update_php_url () ),
__ ( 'Learn more about updating PHP' ),
2019-09-02 20:41:05 -04:00
/* translators: Accessibility text. */
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
__ ( '(opens in a new tab)' )
),
'test' => 'php_version' ,
);
// PHP is up to date.
if ( ! $response || version_compare ( PHP_VERSION , $response [ 'recommended_version' ], '>=' ) ) {
return $result ;
}
2019-09-23 15:39:58 -04:00
// The PHP version is older than the recommended version, but still receiving active support.
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
if ( $response [ 'is_supported' ] ) {
2019-09-23 15:39:58 -04:00
$result [ 'label' ] = sprintf (
/* translators: %s: The server PHP version. */
2020-02-10 19:41:05 -05:00
__ ( 'Your site is running an older version of PHP (%s)' ),
2019-09-23 15:39:58 -04:00
PHP_VERSION
);
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
$result [ 'status' ] = 'recommended' ;
return $result ;
}
2019-04-06 12:00:51 -04:00
// The PHP version is only receiving security fixes.
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
if ( $response [ 'is_secure' ] ) {
2019-09-23 15:39:58 -04:00
$result [ 'label' ] = sprintf (
/* translators: %s: The server PHP version. */
2020-02-10 19:41:05 -05:00
__ ( 'Your site is running an older version of PHP (%s), which should be updated' ),
2019-09-23 15:39:58 -04:00
PHP_VERSION
);
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
$result [ 'status' ] = 'recommended' ;
return $result ;
}
// Anything no longer secure must be updated.
2019-09-23 15:39:58 -04:00
$result [ 'label' ] = sprintf (
/* translators: %s: The server PHP version. */
2020-02-10 19:41:05 -05:00
__ ( 'Your site is running an outdated version of PHP (%s), which requires an update' ),
2019-09-23 15:39:58 -04:00
PHP_VERSION
);
2019-04-06 12:00:51 -04:00
$result [ 'status' ] = 'critical' ;
$result [ 'badge' ][ 'label' ] = __ ( 'Security' );
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
return $result ;
}
/**
* Check if the passed extension or function are available .
*
* Make the check for available PHP modules into a simple boolean operator for a cleaner test runner .
*
* @ since 5.2 . 0
Code Modernization: Rename parameters that use reserved keywords in `wp-admin/includes/class-wp-site-health.php`.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.
This commit:
* Renames the `$class` parameter to `$class_name` in `WP_Site_Health::test_php_extension_availability()`.
* Renames some other parameters for consistency.
Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116].
Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #55327.
Built from https://develop.svn.wordpress.org/trunk@53117
git-svn-id: http://core.svn.wordpress.org/trunk@52706 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-10 10:29:04 -04:00
* @ since 5.3 . 0 The `$constant_name` and `$class_name` parameters were added .
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
*
Code Modernization: Rename parameters that use reserved keywords in `wp-admin/includes/class-wp-site-health.php`.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.
This commit:
* Renames the `$class` parameter to `$class_name` in `WP_Site_Health::test_php_extension_availability()`.
* Renames some other parameters for consistency.
Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116].
Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #55327.
Built from https://develop.svn.wordpress.org/trunk@53117
git-svn-id: http://core.svn.wordpress.org/trunk@52706 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-10 10:29:04 -04:00
* @ param string $extension_name Optional . The extension name to test . Default null .
* @ param string $function_name Optional . The function name to test . Default null .
* @ param string $constant_name Optional . The constant name to test for . Default null .
* @ param string $class_name Optional . The class name to test for . Default null .
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
* @ return bool Whether or not the extension and function are available .
*/
Code Modernization: Rename parameters that use reserved keywords in `wp-admin/includes/class-wp-site-health.php`.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.
This commit:
* Renames the `$class` parameter to `$class_name` in `WP_Site_Health::test_php_extension_availability()`.
* Renames some other parameters for consistency.
Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116].
Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #55327.
Built from https://develop.svn.wordpress.org/trunk@53117
git-svn-id: http://core.svn.wordpress.org/trunk@52706 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-10 10:29:04 -04:00
private function test_php_extension_availability ( $extension_name = null , $function_name = null , $constant_name = null , $class_name = null ) {
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
// If no extension or function is passed, claim to fail testing, as we have nothing to test against.
Code Modernization: Rename parameters that use reserved keywords in `wp-admin/includes/class-wp-site-health.php`.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.
This commit:
* Renames the `$class` parameter to `$class_name` in `WP_Site_Health::test_php_extension_availability()`.
* Renames some other parameters for consistency.
Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116].
Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #55327.
Built from https://develop.svn.wordpress.org/trunk@53117
git-svn-id: http://core.svn.wordpress.org/trunk@52706 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-10 10:29:04 -04:00
if ( ! $extension_name && ! $function_name && ! $constant_name && ! $class_name ) {
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
return false ;
}
Code Modernization: Rename parameters that use reserved keywords in `wp-admin/includes/class-wp-site-health.php`.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.
This commit:
* Renames the `$class` parameter to `$class_name` in `WP_Site_Health::test_php_extension_availability()`.
* Renames some other parameters for consistency.
Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116].
Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #55327.
Built from https://develop.svn.wordpress.org/trunk@53117
git-svn-id: http://core.svn.wordpress.org/trunk@52706 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-10 10:29:04 -04:00
if ( $extension_name && ! extension_loaded ( $extension_name ) ) {
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
return false ;
}
Code Modernization: Rename parameters that use reserved keywords in `wp-admin/includes/class-wp-site-health.php`.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.
This commit:
* Renames the `$class` parameter to `$class_name` in `WP_Site_Health::test_php_extension_availability()`.
* Renames some other parameters for consistency.
Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116].
Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #55327.
Built from https://develop.svn.wordpress.org/trunk@53117
git-svn-id: http://core.svn.wordpress.org/trunk@52706 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-10 10:29:04 -04:00
if ( $function_name && ! function_exists ( $function_name ) ) {
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
return false ;
}
Code Modernization: Rename parameters that use reserved keywords in `wp-admin/includes/class-wp-site-health.php`.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.
This commit:
* Renames the `$class` parameter to `$class_name` in `WP_Site_Health::test_php_extension_availability()`.
* Renames some other parameters for consistency.
Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116].
Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #55327.
Built from https://develop.svn.wordpress.org/trunk@53117
git-svn-id: http://core.svn.wordpress.org/trunk@52706 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-10 10:29:04 -04:00
if ( $constant_name && ! defined ( $constant_name ) ) {
2019-09-23 15:50:56 -04:00
return false ;
}
Code Modernization: Rename parameters that use reserved keywords in `wp-admin/includes/class-wp-site-health.php`.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.
This commit:
* Renames the `$class` parameter to `$class_name` in `WP_Site_Health::test_php_extension_availability()`.
* Renames some other parameters for consistency.
Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116].
Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #55327.
Built from https://develop.svn.wordpress.org/trunk@53117
git-svn-id: http://core.svn.wordpress.org/trunk@52706 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-10 10:29:04 -04:00
if ( $class_name && ! class_exists ( $class_name ) ) {
2019-09-23 15:50:56 -04:00
return false ;
}
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
return true ;
}
/**
* Test if required PHP modules are installed on the host .
*
* This test builds on the recommendations made by the WordPress Hosting Team
* as seen at https :// make . wordpress . org / hosting / handbook / handbook / server - environment / #php-extensions
*
2019-04-01 16:17:54 -04:00
* @ since 5.2 . 0
*
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
* @ return array
*/
public function get_test_php_extensions () {
$result = array (
'label' => __ ( 'Required and recommended modules are installed' ),
'status' => 'good' ,
'badge' => array (
2019-04-02 06:08:56 -04:00
'label' => __ ( 'Performance' ),
Site Health: Improve the test badge implementation.
Label badges for each Site Health test currently display in either red, orange, or green, regardless of if the test passed or failed. This is confusing, as seeing red labels in the “Passed Test” section could alarm users (when really everything is OK and no action is required), and seeing green labels in the “Failed Tests” section would not appropriately encourage the user to take appropriate action.
This change makes several improvements to the label badges:
- Always right align the badges for consistent display.
- Remove background fill for badges. Instead, use a border.
- Use a consistent styling for all tests (passed and failed).
- The text color no longer uses true black (#000000).
- The `.badge.pink` CSS definition has been switched to `.badge.purple`, and the definitions for blue, gray, and green have also been updated to more closely follow the official WordPress color palette.
Props: pbiron, garrett-eclipse, hedgefield, Clorith, xkon, melchoyce, mdwolinski, alexdenning.
Fixes #46623.
Built from https://develop.svn.wordpress.org/trunk@45169
git-svn-id: http://core.svn.wordpress.org/trunk@44978 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-04-12 13:04:52 -04:00
'color' => 'blue' ,
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
),
'description' => sprintf (
'<p>%s</p><p>%s</p>' ,
2019-04-12 13:40:53 -04:00
__ ( 'PHP modules perform most of the tasks on the server that make your site run. Any changes to these must be made by your server administrator.' ),
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
sprintf (
2019-05-16 20:07:54 -04:00
/* translators: 1: Link to the hosting group page about recommended PHP modules. 2: Additional link attributes. 3: Accessibility text. */
2019-05-17 07:50:58 -04:00
__ ( 'The WordPress Hosting Team maintains a list of those modules, both recommended and required, in <a href="%1$s" %2$s>the team handbook%3$s</a>.' ),
2019-05-16 20:07:54 -04:00
/* translators: Localized team handbook, if one exists. */
esc_url ( __ ( 'https://make.wordpress.org/hosting/handbook/handbook/server-environment/#php-extensions' ) ),
2020-10-19 19:39:04 -04:00
'target="_blank" rel="noopener"' ,
2019-04-12 13:40:53 -04:00
sprintf (
2019-05-17 07:50:58 -04:00
' <span class="screen-reader-text">%s</span><span aria-hidden="true" class="dashicons dashicons-external"></span>' ,
2019-09-02 20:41:05 -04:00
/* translators: Accessibility text. */
2019-04-12 13:40:53 -04:00
__ ( '(opens in a new tab)' )
)
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
)
),
'actions' => '' ,
'test' => 'php_extensions' ,
);
$modules = array (
'curl' => array (
'function' => 'curl_version' ,
'required' => false ,
),
2019-09-23 15:50:56 -04:00
'dom' => array (
'class' => 'DOMNode' ,
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
'required' => false ,
),
2019-09-23 15:50:56 -04:00
'exif' => array (
'function' => 'exif_read_data' ,
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
'required' => false ,
),
'fileinfo' => array (
'function' => 'finfo_file' ,
'required' => false ,
),
2019-09-23 15:50:56 -04:00
'hash' => array (
'function' => 'hash' ,
'required' => false ,
),
2021-09-12 06:09:57 -04:00
'imagick' => array (
'extension' => 'imagick' ,
'required' => false ,
),
2019-09-23 15:50:56 -04:00
'json' => array (
'function' => 'json_last_error' ,
'required' => true ,
),
'mbstring' => array (
'function' => 'mb_check_encoding' ,
'required' => false ,
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
),
'mysqli' => array (
'function' => 'mysqli_connect' ,
'required' => false ,
),
'libsodium' => array (
2019-09-23 15:50:56 -04:00
'constant' => 'SODIUM_LIBRARY_VERSION' ,
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
'required' => false ,
'php_bundled_version' => '7.2.0' ,
),
'openssl' => array (
'function' => 'openssl_encrypt' ,
'required' => false ,
),
'pcre' => array (
'function' => 'preg_match' ,
'required' => false ,
),
2019-09-23 15:50:56 -04:00
'mod_xml' => array (
'extension' => 'libxml' ,
'required' => false ,
),
'zip' => array (
'class' => 'ZipArchive' ,
'required' => false ,
),
'filter' => array (
'function' => 'filter_list' ,
'required' => false ,
),
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
'gd' => array (
'extension' => 'gd' ,
'required' => false ,
'fallback_for' => 'imagick' ,
),
2019-09-23 15:50:56 -04:00
'iconv' => array (
'function' => 'iconv' ,
'required' => false ,
),
Site Health: Add Intl to the list of recommended PHP extensions.
**Why is the PHP Intl extension important?**
WordPress is a global, international software, with support for a multitude of languages and with infinite combinations. Approximately half of the installations are in a language that is not the default (English), and this leads us to think about localization, transliteration, encoding conversions, calendar operations, collation… in short, everything you have with the different languages and formats that are around the planet. And this is what the [https://www.php.net/manual/en/intro.intl.php PHP Intl extension] provides.
**What do we as the WordPress Community gain from this extension?**
This extension provides a lot of functions for better internationalization support, including but not limited to:
* [https://www.php.net/manual/en/collator.compare.php collator_compare()] to compare Unicode text strings
* [https://www.php.net/manual/en/numberformatter.format.php numfmt_format()] to format a number according to the selected locale
* the [https://www.php.net/manual/en/normalizer.normalize.php normalization] of characters
* the [https://www.php.net/manual/en/messageformatter.formatmessage.php formatting] of messages
* getting the [https://www.php.net/manual/en/intlcalendar.getfirstdayofweek.php first day of the week] according to the locale.
In addition to functionality and ease of development, the extension can also help improve security, with classes like `Spoofchecker` that can tell you [https://www.php.net/manual/en/spoofchecker.areconfusable.php if ‘google.com’, ‘goog1e.com’ can confuse the user], or functions related to Internet domains, both to convert an [https://www.php.net/manual/en/function.idn-to-ascii.php IDN domain to text] and [https://www.php.net/manual/en/function.idn-to-utf8.php text to IDN].
**Hosting Team Recommendation**
Taking into account that WordPress continues to grow, the Hosting Team has considered a good recommendation, but not an obligation, for all hosts that work with WordPress to offer this extension, by default, to all users.
Reference: [https://make.wordpress.org/hosting/2021/05/20/why-hosters-should-install-the-php-intl-extension/ Why hosters should install the PHP-intl extension].
Follow-up to [44986], [46268].
Props zodiac1978, JavierCasares, jrf, Clorith, josklever.
Fixes #52654.
Built from https://develop.svn.wordpress.org/trunk@51804
git-svn-id: http://core.svn.wordpress.org/trunk@51411 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-11 14:20:59 -04:00
'intl' => array (
'extension' => 'intl' ,
'required' => false ,
),
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
'mcrypt' => array (
'extension' => 'mcrypt' ,
'required' => false ,
'fallback_for' => 'libsodium' ,
),
2019-09-23 15:50:56 -04:00
'simplexml' => array (
'extension' => 'simplexml' ,
'required' => false ,
'fallback_for' => 'mod_xml' ,
),
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
'xmlreader' => array (
'extension' => 'xmlreader' ,
'required' => false ,
2019-09-23 15:50:56 -04:00
'fallback_for' => 'mod_xml' ,
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
),
'zlib' => array (
'extension' => 'zlib' ,
'required' => false ,
'fallback_for' => 'zip' ,
),
);
/**
* An array representing all the modules we wish to test for .
*
* @ since 5.2 . 0
2019-09-23 15:50:56 -04:00
* @ since 5.3 . 0 The `$constant` and `$class` parameters were added .
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
*
* @ param array $modules {
2020-07-23 03:39:02 -04:00
* An associative array of modules to test for .
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
*
2020-07-23 03:39:02 -04:00
* @ type array ... $ 0 {
* An associative array of module properties used during testing .
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
* One of either `$function` or `$extension` must be provided , or they will fail by default .
*
2020-07-23 03:39:02 -04:00
* @ type string $function Optional . A function name to test for the existence of .
* @ type string $extension Optional . An extension to check if is loaded in PHP .
* @ type string $constant Optional . A constant name to check for to verify an extension exists .
* @ type string $class Optional . A class name to check for to verify an extension exists .
* @ type bool $required Is this a required feature or not .
* @ type string $fallback_for Optional . The module this module replaces as a fallback .
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
* }
* }
*/
$modules = apply_filters ( 'site_status_test_php_modules' , $modules );
$failures = array ();
foreach ( $modules as $library => $module ) {
Code Modernization: Rename parameters that use reserved keywords in `wp-admin/includes/class-wp-site-health.php`.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.
This commit:
* Renames the `$class` parameter to `$class_name` in `WP_Site_Health::test_php_extension_availability()`.
* Renames some other parameters for consistency.
Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116].
Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #55327.
Built from https://develop.svn.wordpress.org/trunk@53117
git-svn-id: http://core.svn.wordpress.org/trunk@52706 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-10 10:29:04 -04:00
$extension_name = ( isset ( $module [ 'extension' ] ) ? $module [ 'extension' ] : null );
$function_name = ( isset ( $module [ 'function' ] ) ? $module [ 'function' ] : null );
$constant_name = ( isset ( $module [ 'constant' ] ) ? $module [ 'constant' ] : null );
$class_name = ( isset ( $module [ 'class' ] ) ? $module [ 'class' ] : null );
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
// If this module is a fallback for another function, check if that other function passed.
if ( isset ( $module [ 'fallback_for' ] ) ) {
/*
2020-07-03 17:59:03 -04:00
* If that other function has a failure , mark this module as required for usual operations .
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
* If that other function hasn 't failed, skip this test as it' s only a fallback .
*/
if ( isset ( $failures [ $module [ 'fallback_for' ] ] ) ) {
$module [ 'required' ] = true ;
} else {
continue ;
}
}
Code Modernization: Rename parameters that use reserved keywords in `wp-admin/includes/class-wp-site-health.php`.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.
This commit:
* Renames the `$class` parameter to `$class_name` in `WP_Site_Health::test_php_extension_availability()`.
* Renames some other parameters for consistency.
Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116].
Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #55327.
Built from https://develop.svn.wordpress.org/trunk@53117
git-svn-id: http://core.svn.wordpress.org/trunk@52706 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-10 10:29:04 -04:00
if ( ! $this -> test_php_extension_availability ( $extension_name , $function_name , $constant_name , $class_name )
&& ( ! isset ( $module [ 'php_bundled_version' ] )
|| version_compare ( PHP_VERSION , $module [ 'php_bundled_version' ], '<' ) )
) {
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
if ( $module [ 'required' ] ) {
$result [ 'status' ] = 'critical' ;
$class = 'error' ;
$screen_reader = __ ( 'Error' );
$message = sprintf (
/* translators: %s: The module name. */
__ ( 'The required module, %s, is not installed, or has been disabled.' ),
$library
);
} else {
$class = 'warning' ;
$screen_reader = __ ( 'Warning' );
$message = sprintf (
/* translators: %s: The module name. */
__ ( 'The optional module, %s, is not installed, or has been disabled.' ),
$library
);
}
if ( ! $module [ 'required' ] && 'good' === $result [ 'status' ] ) {
$result [ 'status' ] = 'recommended' ;
}
2019-05-15 10:26:07 -04:00
$failures [ $library ] = " <span class='dashicons $class '><span class='screen-reader-text'> $screen_reader </span></span> $message " ;
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
}
}
if ( ! empty ( $failures ) ) {
$output = '<ul>' ;
foreach ( $failures as $failure ) {
$output .= sprintf (
'<li>%s</li>' ,
$failure
);
}
$output .= '</ul>' ;
}
if ( 'good' !== $result [ 'status' ] ) {
if ( 'recommended' === $result [ 'status' ] ) {
$result [ 'label' ] = __ ( 'One or more recommended modules are missing' );
}
if ( 'critical' === $result [ 'status' ] ) {
$result [ 'label' ] = __ ( 'One or more required modules are missing' );
}
2020-03-28 23:46:06 -04:00
$result [ 'description' ] .= $output ;
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
}
return $result ;
}
2019-11-28 10:48:03 -05:00
/**
* Test if the PHP default timezone is set to UTC .
*
* @ since 5.3 . 1
*
* @ return array The test results .
*/
public function get_test_php_default_timezone () {
$result = array (
'label' => __ ( 'PHP default timezone is valid' ),
'status' => 'good' ,
'badge' => array (
'label' => __ ( 'Performance' ),
'color' => 'blue' ,
),
'description' => sprintf (
'<p>%s</p>' ,
__ ( 'PHP default timezone was configured by WordPress on loading. This is necessary for correct calculations of dates and times.' )
),
2020-03-28 23:46:06 -04:00
'actions' => '' ,
2019-11-28 10:48:03 -05:00
'test' => 'php_default_timezone' ,
);
if ( 'UTC' !== date_default_timezone_get () ) {
$result [ 'status' ] = 'critical' ;
$result [ 'label' ] = __ ( 'PHP default timezone is invalid' );
$result [ 'description' ] = sprintf (
'<p>%s</p>' ,
sprintf (
/* translators: %s: date_default_timezone_set() */
__ ( 'PHP default timezone was changed after WordPress loading by a %s function call. This interferes with correct calculations of dates and times.' ),
'<code>date_default_timezone_set()</code>'
)
);
}
return $result ;
}
2020-04-16 04:20:09 -04:00
/**
* Test if there ' s an active PHP session that can affect loopback requests .
*
* @ since 5.5 . 0
*
* @ return array The test results .
*/
public function get_test_php_sessions () {
$result = array (
'label' => __ ( 'No PHP sessions detected' ),
'status' => 'good' ,
'badge' => array (
'label' => __ ( 'Performance' ),
'color' => 'blue' ,
),
'description' => sprintf (
'<p>%s</p>' ,
sprintf (
/* translators: 1: session_start(), 2: session_write_close() */
__ ( 'PHP sessions created by a %1$s function call may interfere with REST API and loopback requests. An active session should be closed by %2$s before making any HTTP requests.' ),
'<code>session_start()</code>' ,
'<code>session_write_close()</code>'
)
),
'test' => 'php_sessions' ,
);
2020-08-05 20:25:07 -04:00
if ( function_exists ( 'session_status' ) && PHP_SESSION_ACTIVE === session_status () ) {
2020-04-16 04:20:09 -04:00
$result [ 'status' ] = 'critical' ;
$result [ 'label' ] = __ ( 'An active PHP session was detected' );
$result [ 'description' ] = sprintf (
'<p>%s</p>' ,
sprintf (
/* translators: 1: session_start(), 2: session_write_close() */
__ ( 'A PHP session was created by a %1$s function call. This interferes with REST API and loopback requests. The session should be closed by %2$s before making any HTTP requests.' ),
'<code>session_start()</code>' ,
'<code>session_write_close()</code>'
)
);
}
return $result ;
}
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
/**
* Test if the SQL server is up to date .
*
* @ since 5.2 . 0
*
* @ return array The test results .
*/
public function get_test_sql_server () {
2020-02-08 15:10:05 -05:00
if ( ! $this -> mysql_server_version ) {
$this -> prepare_sql_data ();
}
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
$result = array (
'label' => __ ( 'SQL server is up to date' ),
'status' => 'good' ,
'badge' => array (
2019-04-06 12:00:51 -04:00
'label' => __ ( 'Performance' ),
Site Health: Improve the test badge implementation.
Label badges for each Site Health test currently display in either red, orange, or green, regardless of if the test passed or failed. This is confusing, as seeing red labels in the “Passed Test” section could alarm users (when really everything is OK and no action is required), and seeing green labels in the “Failed Tests” section would not appropriately encourage the user to take appropriate action.
This change makes several improvements to the label badges:
- Always right align the badges for consistent display.
- Remove background fill for badges. Instead, use a border.
- Use a consistent styling for all tests (passed and failed).
- The text color no longer uses true black (#000000).
- The `.badge.pink` CSS definition has been switched to `.badge.purple`, and the definitions for blue, gray, and green have also been updated to more closely follow the official WordPress color palette.
Props: pbiron, garrett-eclipse, hedgefield, Clorith, xkon, melchoyce, mdwolinski, alexdenning.
Fixes #46623.
Built from https://develop.svn.wordpress.org/trunk@45169
git-svn-id: http://core.svn.wordpress.org/trunk@44978 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-04-12 13:04:52 -04:00
'color' => 'blue' ,
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
),
'description' => sprintf (
'<p>%s</p>' ,
2019-04-12 13:40:53 -04:00
__ ( 'The SQL server is a required piece of software for the database WordPress uses to store all your site’s content and settings.' )
),
'actions' => sprintf (
2020-10-19 19:39:04 -04:00
'<p><a href="%s" target="_blank" rel="noopener">%s <span class="screen-reader-text">%s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>' ,
2019-04-12 13:40:53 -04:00
/* translators: Localized version of WordPress requirements if one exists. */
esc_url ( __ ( 'https://wordpress.org/about/requirements/' ) ),
2019-07-16 18:28:57 -04:00
__ ( 'Learn more about what WordPress requires to run.' ),
2019-09-02 20:41:05 -04:00
/* translators: Accessibility text. */
2019-04-12 13:40:53 -04:00
__ ( '(opens in a new tab)' )
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
),
'test' => 'sql_server' ,
);
$db_dropin = file_exists ( WP_CONTENT_DIR . '/db.php' );
if ( ! $this -> mysql_rec_version_check ) {
$result [ 'status' ] = 'recommended' ;
$result [ 'label' ] = __ ( 'Outdated SQL server' );
$result [ 'description' ] .= sprintf (
'<p>%s</p>' ,
sprintf (
2019-04-02 17:32:53 -04:00
/* translators: 1: The database engine in use (MySQL or MariaDB). 2: Database server recommended version number. */
2021-11-02 13:37:57 -04:00
__ ( 'For optimal performance and security reasons, you should consider running %1$s version %2$s or higher. Contact your web hosting company to correct this.' ),
2019-04-03 07:01:53 -04:00
( $this -> is_mariadb ? 'MariaDB' : 'MySQL' ),
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
$this -> health_check_mysql_rec_version
)
);
}
if ( ! $this -> mysql_min_version_check ) {
$result [ 'status' ] = 'critical' ;
2019-04-06 12:00:51 -04:00
$result [ 'label' ] = __ ( 'Severely outdated SQL server' );
$result [ 'badge' ][ 'label' ] = __ ( 'Security' );
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
$result [ 'description' ] .= sprintf (
'<p>%s</p>' ,
sprintf (
2019-04-02 17:32:53 -04:00
/* translators: 1: The database engine in use (MySQL or MariaDB). 2: Database server minimum version number. */
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
__ ( 'WordPress requires %1$s version %2$s or higher. Contact your web hosting company to correct this.' ),
2019-04-03 07:01:53 -04:00
( $this -> is_mariadb ? 'MariaDB' : 'MySQL' ),
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
$this -> health_check_mysql_required_version
)
);
}
if ( $db_dropin ) {
$result [ 'description' ] .= sprintf (
'<p>%s</p>' ,
wp_kses (
sprintf (
2019-04-02 17:32:53 -04:00
/* translators: 1: The name of the drop-in. 2: The name of the database engine. */
__ ( 'You are using a %1$s drop-in which might mean that a %2$s database is not being used.' ),
'<code>wp-content/db.php</code>' ,
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
( $this -> is_mariadb ? 'MariaDB' : 'MySQL' )
),
array (
'code' => true ,
)
)
);
}
return $result ;
}
/**
* Test if the database server is capable of using utf8mb4 .
*
* @ since 5.2 . 0
*
* @ return array The test results .
*/
public function get_test_utf8mb4_support () {
global $wpdb ;
2020-02-08 15:10:05 -05:00
if ( ! $this -> mysql_server_version ) {
$this -> prepare_sql_data ();
}
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
$result = array (
'label' => __ ( 'UTF8MB4 is supported' ),
'status' => 'good' ,
'badge' => array (
2019-04-02 06:08:56 -04:00
'label' => __ ( 'Performance' ),
Site Health: Improve the test badge implementation.
Label badges for each Site Health test currently display in either red, orange, or green, regardless of if the test passed or failed. This is confusing, as seeing red labels in the “Passed Test” section could alarm users (when really everything is OK and no action is required), and seeing green labels in the “Failed Tests” section would not appropriately encourage the user to take appropriate action.
This change makes several improvements to the label badges:
- Always right align the badges for consistent display.
- Remove background fill for badges. Instead, use a border.
- Use a consistent styling for all tests (passed and failed).
- The text color no longer uses true black (#000000).
- The `.badge.pink` CSS definition has been switched to `.badge.purple`, and the definitions for blue, gray, and green have also been updated to more closely follow the official WordPress color palette.
Props: pbiron, garrett-eclipse, hedgefield, Clorith, xkon, melchoyce, mdwolinski, alexdenning.
Fixes #46623.
Built from https://develop.svn.wordpress.org/trunk@45169
git-svn-id: http://core.svn.wordpress.org/trunk@44978 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-04-12 13:04:52 -04:00
'color' => 'blue' ,
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
),
'description' => sprintf (
'<p>%s</p>' ,
2019-10-04 22:39:58 -04:00
__ ( 'UTF8MB4 is the character set WordPress prefers for database storage because it safely supports the widest set of characters and encodings, including Emoji, enabling better support for non-English languages.' )
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
),
'actions' => '' ,
'test' => 'utf8mb4_support' ,
);
if ( ! $this -> is_mariadb ) {
if ( version_compare ( $this -> mysql_server_version , '5.5.3' , '<' ) ) {
$result [ 'status' ] = 'recommended' ;
$result [ 'label' ] = __ ( 'utf8mb4 requires a MySQL update' );
$result [ 'description' ] .= sprintf (
'<p>%s</p>' ,
sprintf (
/* translators: %s: Version number. */
2019-04-12 13:40:53 -04:00
__ ( 'WordPress’ utf8mb4 support requires MySQL version %s or greater. Please contact your server administrator.' ),
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
'5.5.3'
)
);
} else {
$result [ 'description' ] .= sprintf (
'<p>%s</p>' ,
__ ( 'Your MySQL version supports utf8mb4.' )
);
}
2020-01-28 19:45:18 -05:00
} else { // MariaDB introduced utf8mb4 support in 5.5.0.
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
if ( version_compare ( $this -> mysql_server_version , '5.5.0' , '<' ) ) {
$result [ 'status' ] = 'recommended' ;
$result [ 'label' ] = __ ( 'utf8mb4 requires a MariaDB update' );
$result [ 'description' ] .= sprintf (
'<p>%s</p>' ,
sprintf (
/* translators: %s: Version number. */
2019-04-12 13:40:53 -04:00
__ ( 'WordPress’ utf8mb4 support requires MariaDB version %s or greater. Please contact your server administrator.' ),
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
'5.5.0'
)
);
} else {
$result [ 'description' ] .= sprintf (
'<p>%s</p>' ,
__ ( 'Your MariaDB version supports utf8mb4.' )
);
}
}
if ( $wpdb -> use_mysqli ) {
// phpcs:ignore WordPress.DB.RestrictedFunctions.mysql_mysqli_get_client_info
$mysql_client_version = mysqli_get_client_info ();
} else {
2019-09-25 09:47:58 -04:00
// phpcs:ignore WordPress.DB.RestrictedFunctions.mysql_mysql_get_client_info,PHPCompatibility.Extensions.RemovedExtensions.mysql_DeprecatedRemoved
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
$mysql_client_version = mysql_get_client_info ();
}
/*
* libmysql has supported utf8mb4 since 5.5 . 3 , same as the MySQL server .
* mysqlnd has supported utf8mb4 since 5.0 . 9.
*/
if ( false !== strpos ( $mysql_client_version , 'mysqlnd' ) ) {
$mysql_client_version = preg_replace ( '/^\D+([\d.]+).*/' , '$1' , $mysql_client_version );
if ( version_compare ( $mysql_client_version , '5.0.9' , '<' ) ) {
$result [ 'status' ] = 'recommended' ;
$result [ 'label' ] = __ ( 'utf8mb4 requires a newer client library' );
$result [ 'description' ] .= sprintf (
'<p>%s</p>' ,
sprintf (
2019-04-02 17:32:53 -04:00
/* translators: 1: Name of the library, 2: Number of version. */
2019-04-12 13:40:53 -04:00
__ ( 'WordPress’ utf8mb4 support requires MySQL client library (%1$s) version %2$s or newer. Please contact your server administrator.' ),
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
'mysqlnd' ,
'5.0.9'
)
);
}
} else {
if ( version_compare ( $mysql_client_version , '5.5.3' , '<' ) ) {
$result [ 'status' ] = 'recommended' ;
2019-04-13 14:18:52 -04:00
$result [ 'label' ] = __ ( 'utf8mb4 requires a newer client library' );
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
$result [ 'description' ] .= sprintf (
'<p>%s</p>' ,
sprintf (
2019-04-02 17:32:53 -04:00
/* translators: 1: Name of the library, 2: Number of version. */
2019-04-12 13:40:53 -04:00
__ ( 'WordPress’ utf8mb4 support requires MySQL client library (%1$s) version %2$s or newer. Please contact your server administrator.' ),
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
'libmysql' ,
'5.5.3'
)
);
}
}
return $result ;
}
/**
* Test if the site can communicate with WordPress . org .
*
* @ since 5.2 . 0
*
* @ return array The test results .
*/
public function get_test_dotorg_communication () {
$result = array (
'label' => __ ( 'Can communicate with WordPress.org' ),
'status' => '' ,
'badge' => array (
2019-04-02 06:08:56 -04:00
'label' => __ ( 'Security' ),
Site Health: Improve the test badge implementation.
Label badges for each Site Health test currently display in either red, orange, or green, regardless of if the test passed or failed. This is confusing, as seeing red labels in the “Passed Test” section could alarm users (when really everything is OK and no action is required), and seeing green labels in the “Failed Tests” section would not appropriately encourage the user to take appropriate action.
This change makes several improvements to the label badges:
- Always right align the badges for consistent display.
- Remove background fill for badges. Instead, use a border.
- Use a consistent styling for all tests (passed and failed).
- The text color no longer uses true black (#000000).
- The `.badge.pink` CSS definition has been switched to `.badge.purple`, and the definitions for blue, gray, and green have also been updated to more closely follow the official WordPress color palette.
Props: pbiron, garrett-eclipse, hedgefield, Clorith, xkon, melchoyce, mdwolinski, alexdenning.
Fixes #46623.
Built from https://develop.svn.wordpress.org/trunk@45169
git-svn-id: http://core.svn.wordpress.org/trunk@44978 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-04-12 13:04:52 -04:00
'color' => 'blue' ,
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
),
'description' => sprintf (
'<p>%s</p>' ,
__ ( 'Communicating with the WordPress servers is used to check for new versions, and to both install and update WordPress core, themes or plugins.' )
),
'actions' => '' ,
'test' => 'dotorg_communication' ,
);
$wp_dotorg = wp_remote_get (
'https://api.wordpress.org' ,
array (
'timeout' => 10 ,
)
);
if ( ! is_wp_error ( $wp_dotorg ) ) {
$result [ 'status' ] = 'good' ;
} else {
$result [ 'status' ] = 'critical' ;
$result [ 'label' ] = __ ( 'Could not reach WordPress.org' );
$result [ 'description' ] .= sprintf (
'<p>%s</p>' ,
sprintf (
'<span class="error"><span class="screen-reader-text">%s</span></span> %s' ,
__ ( 'Error' ),
sprintf (
2019-04-02 17:32:53 -04:00
/* translators: 1: The IP address WordPress.org resolves to. 2: The error returned by the lookup. */
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
__ ( 'Your site is unable to reach WordPress.org at %1$s, and returned the error: %2$s' ),
2019-04-12 13:40:53 -04:00
gethostbyname ( 'api.wordpress.org' ),
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
$wp_dotorg -> get_error_message ()
)
)
);
2019-04-12 13:40:53 -04:00
$result [ 'actions' ] = sprintf (
2020-10-19 19:39:04 -04:00
'<p><a href="%s" target="_blank" rel="noopener">%s <span class="screen-reader-text">%s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>' ,
2019-04-12 13:40:53 -04:00
/* translators: Localized Support reference. */
esc_url ( __ ( 'https://wordpress.org/support' ) ),
__ ( 'Get help resolving this issue.' ),
2019-09-02 20:41:05 -04:00
/* translators: Accessibility text. */
2019-04-12 13:40:53 -04:00
__ ( '(opens in a new tab)' )
);
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
}
return $result ;
}
/**
* Test if debug information is enabled .
*
2020-06-25 08:43:07 -04:00
* When WP_DEBUG is enabled , errors and information may be disclosed to site visitors ,
* or logged to a publicly accessible file .
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
*
2020-06-25 08:43:07 -04:00
* Debugging is also frequently left enabled after looking for errors on a site ,
* as site owners do not understand the implications of this .
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
*
* @ since 5.2 . 0
*
* @ return array The test results .
*/
public function get_test_is_in_debug_mode () {
$result = array (
'label' => __ ( 'Your site is not set to output debug information' ),
'status' => 'good' ,
'badge' => array (
2019-04-02 06:08:56 -04:00
'label' => __ ( 'Security' ),
Site Health: Improve the test badge implementation.
Label badges for each Site Health test currently display in either red, orange, or green, regardless of if the test passed or failed. This is confusing, as seeing red labels in the “Passed Test” section could alarm users (when really everything is OK and no action is required), and seeing green labels in the “Failed Tests” section would not appropriately encourage the user to take appropriate action.
This change makes several improvements to the label badges:
- Always right align the badges for consistent display.
- Remove background fill for badges. Instead, use a border.
- Use a consistent styling for all tests (passed and failed).
- The text color no longer uses true black (#000000).
- The `.badge.pink` CSS definition has been switched to `.badge.purple`, and the definitions for blue, gray, and green have also been updated to more closely follow the official WordPress color palette.
Props: pbiron, garrett-eclipse, hedgefield, Clorith, xkon, melchoyce, mdwolinski, alexdenning.
Fixes #46623.
Built from https://develop.svn.wordpress.org/trunk@45169
git-svn-id: http://core.svn.wordpress.org/trunk@44978 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-04-12 13:04:52 -04:00
'color' => 'blue' ,
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
),
'description' => sprintf (
'<p>%s</p>' ,
__ ( 'Debug mode is often enabled to gather more details about an error or site failure, but may contain sensitive information which should not be available on a publicly available website.' )
),
2019-04-12 13:40:53 -04:00
'actions' => sprintf (
2020-10-19 19:39:04 -04:00
'<p><a href="%s" target="_blank" rel="noopener">%s <span class="screen-reader-text">%s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>' ,
2019-04-12 13:40:53 -04:00
/* translators: Documentation explaining debugging in WordPress. */
esc_url ( __ ( 'https://wordpress.org/support/article/debugging-in-wordpress/' ) ),
2019-07-16 18:28:57 -04:00
__ ( 'Learn more about debugging in WordPress.' ),
2019-09-02 20:41:05 -04:00
/* translators: Accessibility text. */
2019-04-12 13:40:53 -04:00
__ ( '(opens in a new tab)' )
),
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
'test' => 'is_in_debug_mode' ,
);
if ( defined ( 'WP_DEBUG' ) && WP_DEBUG ) {
if ( defined ( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG ) {
2021-07-30 15:38:57 -04:00
$result [ 'label' ] = __ ( 'Your site is set to log errors to a potentially public file' );
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
2020-02-10 00:16:07 -05:00
$result [ 'status' ] = ( 0 === strpos ( ini_get ( 'error_log' ), ABSPATH ) ) ? 'critical' : 'recommended' ;
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
$result [ 'description' ] .= sprintf (
'<p>%s</p>' ,
2019-04-02 17:32:53 -04:00
sprintf (
2019-04-11 22:27:51 -04:00
/* translators: %s: WP_DEBUG_LOG */
2020-07-03 17:59:03 -04:00
__ ( 'The value, %s, has been added to this website’s configuration file. This means any errors on the site will be written to a file which is potentially available to all users.' ),
2019-04-02 17:32:53 -04:00
'<code>WP_DEBUG_LOG</code>'
)
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
);
}
if ( defined ( 'WP_DEBUG_DISPLAY' ) && WP_DEBUG_DISPLAY ) {
$result [ 'label' ] = __ ( 'Your site is set to display errors to site visitors' );
$result [ 'status' ] = 'critical' ;
2020-10-20 12:23:07 -04:00
// On development environments, set the status to recommended.
if ( $this -> is_development_environment () ) {
$result [ 'status' ] = 'recommended' ;
}
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
$result [ 'description' ] .= sprintf (
'<p>%s</p>' ,
2019-04-02 17:32:53 -04:00
sprintf (
2019-04-11 22:27:51 -04:00
/* translators: 1: WP_DEBUG_DISPLAY, 2: WP_DEBUG */
__ ( 'The value, %1$s, has either been enabled by %2$s or added to your configuration file. This will make errors display on the front end of your site.' ),
'<code>WP_DEBUG_DISPLAY</code>' ,
'<code>WP_DEBUG</code>'
2019-04-02 17:32:53 -04:00
)
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
);
}
}
return $result ;
}
/**
* Test if your site is serving content over HTTPS .
*
2019-04-01 16:23:50 -04:00
* Many sites have varying degrees of HTTPS support , the most common of which is sites that have it
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
* enabled , but only if you visit the right site address .
*
* @ since 5.2 . 0
2020-12-23 14:13:04 -05:00
* @ since 5.7 . 0 Updated to rely on { @ see wp_is_using_https ()} and { @ see wp_is_https_supported ()} .
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
*
* @ return array The test results .
*/
public function get_test_https_status () {
2021-05-15 13:38:05 -04:00
// Enforce fresh HTTPS detection results. This is normally invoked by using cron,
// but for Site Health it should always rely on the latest results.
2021-01-29 14:10:58 -05:00
wp_update_https_detection_errors ();
Security, Site Health: Make migrating a site to HTTPS a one-click interaction.
Switching a WordPress site from HTTP to HTTPS has historically been a tedious task. While on the surface the Site Address and WordPress Address have to be updated, existing content still remains using HTTP URLs where hard-coded in the database. Furthermore, updating _two_ URLs to migrate to HTTPS is still a fairly unintuitive step which is not clearly explained.
This changeset simplifies migration from HTTP to HTTPS and, where possible, makes it a one-click interaction.
* Automatically replace insecure versions of the Site Address (`home_url()`) with its HTTPS counterpart on the fly if the site has been migrated from HTTP to HTTPS. This is accomplished by introducing a `https_migration_required` option and enabling it when the `home_url()` is accordingly changed.
* A new `wp_replace_insecure_home_url()` function is hooked into various pieces of content to replace URLs accordingly.
* The migration only kicks in when the Site Address (`home_url()`) and WordPress Address (`site_url()`) match, which is the widely common case. Configurations where these differ are often maintained by more advanced users, where this migration routine would be less essential - something to potentially iterate on in the future though.
* The migration does not actually update content in the database. More savvy users that prefer to do that can prevent the migration logic from running by either deleting the `https_migration_required` option or using the new `wp_should_replace_insecure_home_url` filter.
* For fresh sites that do not have any content yet at the point of changing the URLs to HTTPS, the migration will also be skipped since it would not be relevant.
* Expose a primary action in the Site Health recommendation, if HTTPS is already supported by the environment, built on top of the HTTPS detection mechanism from [49904]. When clicked, the default behavior is to update `home_url()` and `site_url()` in one go to their HTTPS counterpart.
* A new `wp_update_urls_to_https()` function takes care of the update routine.
* A new `update_https` meta capability is introduced to control access.
* If the site's URLs are controlled by constants, this update is not automatically possible, so in these scenarios the user is informed about that in the HTTPS status check in Site Health.
* Allow hosting providers to modify the URLs linked to in the HTTPS status check in Site Health, similar to how that is possible for the URLs around updating the PHP version.
* A `WP_UPDATE_HTTPS_URL` environment variable or `wp_update_https_url` filter can be used to provide a custom URL with guidance about updating the site to use HTTPS.
* A `WP_DIRECT_UPDATE_HTTPS_URL` environment variable or `wp_direct_update_https_url` filter can be used to provide a custom URL for the primary CTA to update the site to use HTTPS.
Props flixos90, timothyblynjacobs.
Fixes #51437.
Built from https://develop.svn.wordpress.org/trunk@50131
git-svn-id: http://core.svn.wordpress.org/trunk@49810 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-01 19:10:01 -05:00
$default_update_url = wp_get_default_update_https_url ();
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
$result = array (
2020-12-23 14:13:04 -05:00
'label' => __ ( 'Your website is using an active HTTPS connection' ),
2019-03-28 12:15:51 -04:00
'status' => 'good' ,
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
'badge' => array (
2019-04-02 06:08:56 -04:00
'label' => __ ( 'Security' ),
Site Health: Improve the test badge implementation.
Label badges for each Site Health test currently display in either red, orange, or green, regardless of if the test passed or failed. This is confusing, as seeing red labels in the “Passed Test” section could alarm users (when really everything is OK and no action is required), and seeing green labels in the “Failed Tests” section would not appropriately encourage the user to take appropriate action.
This change makes several improvements to the label badges:
- Always right align the badges for consistent display.
- Remove background fill for badges. Instead, use a border.
- Use a consistent styling for all tests (passed and failed).
- The text color no longer uses true black (#000000).
- The `.badge.pink` CSS definition has been switched to `.badge.purple`, and the definitions for blue, gray, and green have also been updated to more closely follow the official WordPress color palette.
Props: pbiron, garrett-eclipse, hedgefield, Clorith, xkon, melchoyce, mdwolinski, alexdenning.
Fixes #46623.
Built from https://develop.svn.wordpress.org/trunk@45169
git-svn-id: http://core.svn.wordpress.org/trunk@44978 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-04-12 13:04:52 -04:00
'color' => 'blue' ,
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
),
2019-03-28 12:15:51 -04:00
'description' => sprintf (
'<p>%s</p>' ,
2019-09-30 13:54:58 -04:00
__ ( 'An HTTPS connection is a more secure way of browsing the web. Many services now have HTTPS as a requirement. HTTPS allows you to take advantage of new features that can increase site speed, improve search rankings, and gain the trust of your visitors by helping to protect their online privacy.' )
2019-03-28 12:15:51 -04:00
),
'actions' => sprintf (
Security, Site Health: Make migrating a site to HTTPS a one-click interaction.
Switching a WordPress site from HTTP to HTTPS has historically been a tedious task. While on the surface the Site Address and WordPress Address have to be updated, existing content still remains using HTTP URLs where hard-coded in the database. Furthermore, updating _two_ URLs to migrate to HTTPS is still a fairly unintuitive step which is not clearly explained.
This changeset simplifies migration from HTTP to HTTPS and, where possible, makes it a one-click interaction.
* Automatically replace insecure versions of the Site Address (`home_url()`) with its HTTPS counterpart on the fly if the site has been migrated from HTTP to HTTPS. This is accomplished by introducing a `https_migration_required` option and enabling it when the `home_url()` is accordingly changed.
* A new `wp_replace_insecure_home_url()` function is hooked into various pieces of content to replace URLs accordingly.
* The migration only kicks in when the Site Address (`home_url()`) and WordPress Address (`site_url()`) match, which is the widely common case. Configurations where these differ are often maintained by more advanced users, where this migration routine would be less essential - something to potentially iterate on in the future though.
* The migration does not actually update content in the database. More savvy users that prefer to do that can prevent the migration logic from running by either deleting the `https_migration_required` option or using the new `wp_should_replace_insecure_home_url` filter.
* For fresh sites that do not have any content yet at the point of changing the URLs to HTTPS, the migration will also be skipped since it would not be relevant.
* Expose a primary action in the Site Health recommendation, if HTTPS is already supported by the environment, built on top of the HTTPS detection mechanism from [49904]. When clicked, the default behavior is to update `home_url()` and `site_url()` in one go to their HTTPS counterpart.
* A new `wp_update_urls_to_https()` function takes care of the update routine.
* A new `update_https` meta capability is introduced to control access.
* If the site's URLs are controlled by constants, this update is not automatically possible, so in these scenarios the user is informed about that in the HTTPS status check in Site Health.
* Allow hosting providers to modify the URLs linked to in the HTTPS status check in Site Health, similar to how that is possible for the URLs around updating the PHP version.
* A `WP_UPDATE_HTTPS_URL` environment variable or `wp_update_https_url` filter can be used to provide a custom URL with guidance about updating the site to use HTTPS.
* A `WP_DIRECT_UPDATE_HTTPS_URL` environment variable or `wp_direct_update_https_url` filter can be used to provide a custom URL for the primary CTA to update the site to use HTTPS.
Props flixos90, timothyblynjacobs.
Fixes #51437.
Built from https://develop.svn.wordpress.org/trunk@50131
git-svn-id: http://core.svn.wordpress.org/trunk@49810 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-01 19:10:01 -05:00
'<p><a href="%s" target="_blank" rel="noopener">%s<span class="screen-reader-text"> %s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>' ,
esc_url ( $default_update_url ),
2019-07-16 18:28:57 -04:00
__ ( 'Learn more about why you should use HTTPS' ),
2019-09-02 20:41:05 -04:00
/* translators: Accessibility text. */
2019-04-12 13:40:53 -04:00
__ ( '(opens in a new tab)' )
2019-03-28 12:15:51 -04:00
),
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
'test' => 'https_status' ,
);
2020-12-23 14:13:04 -05:00
if ( ! wp_is_using_https () ) {
2021-05-15 13:38:05 -04:00
// If the website is not using HTTPS, provide more information
// about whether it is supported and how it can be enabled.
2021-04-14 09:02:08 -04:00
$result [ 'status' ] = 'recommended' ;
2020-12-23 14:13:04 -05:00
$result [ 'label' ] = __ ( 'Your website does not use HTTPS' );
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
2021-01-29 14:10:58 -05:00
if ( wp_is_site_url_using_https () ) {
if ( is_ssl () ) {
$result [ 'description' ] = sprintf (
'<p>%s</p>' ,
sprintf (
/* translators: %s: URL to Settings > General > Site Address. */
__ ( 'You are accessing this website using HTTPS, but your <a href="%s">Site Address</a> is not set up to use HTTPS by default.' ),
esc_url ( admin_url ( 'options-general.php' ) . '#home' )
)
);
} else {
$result [ 'description' ] = sprintf (
'<p>%s</p>' ,
sprintf (
/* translators: %s: URL to Settings > General > Site Address. */
__ ( 'Your <a href="%s">Site Address</a> is not set up to use HTTPS.' ),
esc_url ( admin_url ( 'options-general.php' ) . '#home' )
)
);
}
2020-12-23 14:13:04 -05:00
} else {
2021-01-29 14:10:58 -05:00
if ( is_ssl () ) {
$result [ 'description' ] = sprintf (
'<p>%s</p>' ,
sprintf (
/* translators: 1: URL to Settings > General > WordPress Address, 2: URL to Settings > General > Site Address. */
__ ( 'You are accessing this website using HTTPS, but your <a href="%1$s">WordPress Address</a> and <a href="%2$s">Site Address</a> are not set up to use HTTPS by default.' ),
esc_url ( admin_url ( 'options-general.php' ) . '#siteurl' ),
esc_url ( admin_url ( 'options-general.php' ) . '#home' )
)
);
} else {
$result [ 'description' ] = sprintf (
'<p>%s</p>' ,
sprintf (
/* translators: 1: URL to Settings > General > WordPress Address, 2: URL to Settings > General > Site Address. */
__ ( 'Your <a href="%1$s">WordPress Address</a> and <a href="%2$s">Site Address</a> are not set up to use HTTPS.' ),
esc_url ( admin_url ( 'options-general.php' ) . '#siteurl' ),
esc_url ( admin_url ( 'options-general.php' ) . '#home' )
)
);
}
2020-12-23 14:13:04 -05:00
}
if ( wp_is_https_supported () ) {
$result [ 'description' ] .= sprintf (
'<p>%s</p>' ,
__ ( 'HTTPS is already supported for your website.' )
);
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
Security, Site Health: Make migrating a site to HTTPS a one-click interaction.
Switching a WordPress site from HTTP to HTTPS has historically been a tedious task. While on the surface the Site Address and WordPress Address have to be updated, existing content still remains using HTTP URLs where hard-coded in the database. Furthermore, updating _two_ URLs to migrate to HTTPS is still a fairly unintuitive step which is not clearly explained.
This changeset simplifies migration from HTTP to HTTPS and, where possible, makes it a one-click interaction.
* Automatically replace insecure versions of the Site Address (`home_url()`) with its HTTPS counterpart on the fly if the site has been migrated from HTTP to HTTPS. This is accomplished by introducing a `https_migration_required` option and enabling it when the `home_url()` is accordingly changed.
* A new `wp_replace_insecure_home_url()` function is hooked into various pieces of content to replace URLs accordingly.
* The migration only kicks in when the Site Address (`home_url()`) and WordPress Address (`site_url()`) match, which is the widely common case. Configurations where these differ are often maintained by more advanced users, where this migration routine would be less essential - something to potentially iterate on in the future though.
* The migration does not actually update content in the database. More savvy users that prefer to do that can prevent the migration logic from running by either deleting the `https_migration_required` option or using the new `wp_should_replace_insecure_home_url` filter.
* For fresh sites that do not have any content yet at the point of changing the URLs to HTTPS, the migration will also be skipped since it would not be relevant.
* Expose a primary action in the Site Health recommendation, if HTTPS is already supported by the environment, built on top of the HTTPS detection mechanism from [49904]. When clicked, the default behavior is to update `home_url()` and `site_url()` in one go to their HTTPS counterpart.
* A new `wp_update_urls_to_https()` function takes care of the update routine.
* A new `update_https` meta capability is introduced to control access.
* If the site's URLs are controlled by constants, this update is not automatically possible, so in these scenarios the user is informed about that in the HTTPS status check in Site Health.
* Allow hosting providers to modify the URLs linked to in the HTTPS status check in Site Health, similar to how that is possible for the URLs around updating the PHP version.
* A `WP_UPDATE_HTTPS_URL` environment variable or `wp_update_https_url` filter can be used to provide a custom URL with guidance about updating the site to use HTTPS.
* A `WP_DIRECT_UPDATE_HTTPS_URL` environment variable or `wp_direct_update_https_url` filter can be used to provide a custom URL for the primary CTA to update the site to use HTTPS.
Props flixos90, timothyblynjacobs.
Fixes #51437.
Built from https://develop.svn.wordpress.org/trunk@50131
git-svn-id: http://core.svn.wordpress.org/trunk@49810 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-01 19:10:01 -05:00
if ( defined ( 'WP_HOME' ) || defined ( 'WP_SITEURL' ) ) {
$result [ 'description' ] .= sprintf (
'<p>%s</p>' ,
sprintf (
/* translators: 1: wp-config.php, 2: WP_HOME, 3: WP_SITEURL */
__ ( 'However, your WordPress Address is currently controlled by a PHP constant and therefore cannot be updated. You need to edit your %1$s and remove or update the definitions of %2$s and %3$s.' ),
'<code>wp-config.php</code>' ,
'<code>WP_HOME</code>' ,
'<code>WP_SITEURL</code>'
)
);
} elseif ( current_user_can ( 'update_https' ) ) {
$default_direct_update_url = add_query_arg ( 'action' , 'update_https' , wp_nonce_url ( admin_url ( 'site-health.php' ), 'wp_update_https' ) );
$direct_update_url = wp_get_direct_update_https_url ();
if ( ! empty ( $direct_update_url ) ) {
$result [ 'actions' ] = sprintf (
'<p class="button-container"><a class="button button-primary" href="%1$s" target="_blank" rel="noopener">%2$s<span class="screen-reader-text"> %3$s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>' ,
esc_url ( $direct_update_url ),
__ ( 'Update your site to use HTTPS' ),
/* translators: Accessibility text. */
__ ( '(opens in a new tab)' )
);
} else {
$result [ 'actions' ] = sprintf (
'<p class="button-container"><a class="button button-primary" href="%1$s">%2$s</a></p>' ,
esc_url ( $default_direct_update_url ),
__ ( 'Update your site to use HTTPS' )
);
}
}
2020-12-23 14:13:04 -05:00
} else {
Security, Site Health: Make migrating a site to HTTPS a one-click interaction.
Switching a WordPress site from HTTP to HTTPS has historically been a tedious task. While on the surface the Site Address and WordPress Address have to be updated, existing content still remains using HTTP URLs where hard-coded in the database. Furthermore, updating _two_ URLs to migrate to HTTPS is still a fairly unintuitive step which is not clearly explained.
This changeset simplifies migration from HTTP to HTTPS and, where possible, makes it a one-click interaction.
* Automatically replace insecure versions of the Site Address (`home_url()`) with its HTTPS counterpart on the fly if the site has been migrated from HTTP to HTTPS. This is accomplished by introducing a `https_migration_required` option and enabling it when the `home_url()` is accordingly changed.
* A new `wp_replace_insecure_home_url()` function is hooked into various pieces of content to replace URLs accordingly.
* The migration only kicks in when the Site Address (`home_url()`) and WordPress Address (`site_url()`) match, which is the widely common case. Configurations where these differ are often maintained by more advanced users, where this migration routine would be less essential - something to potentially iterate on in the future though.
* The migration does not actually update content in the database. More savvy users that prefer to do that can prevent the migration logic from running by either deleting the `https_migration_required` option or using the new `wp_should_replace_insecure_home_url` filter.
* For fresh sites that do not have any content yet at the point of changing the URLs to HTTPS, the migration will also be skipped since it would not be relevant.
* Expose a primary action in the Site Health recommendation, if HTTPS is already supported by the environment, built on top of the HTTPS detection mechanism from [49904]. When clicked, the default behavior is to update `home_url()` and `site_url()` in one go to their HTTPS counterpart.
* A new `wp_update_urls_to_https()` function takes care of the update routine.
* A new `update_https` meta capability is introduced to control access.
* If the site's URLs are controlled by constants, this update is not automatically possible, so in these scenarios the user is informed about that in the HTTPS status check in Site Health.
* Allow hosting providers to modify the URLs linked to in the HTTPS status check in Site Health, similar to how that is possible for the URLs around updating the PHP version.
* A `WP_UPDATE_HTTPS_URL` environment variable or `wp_update_https_url` filter can be used to provide a custom URL with guidance about updating the site to use HTTPS.
* A `WP_DIRECT_UPDATE_HTTPS_URL` environment variable or `wp_direct_update_https_url` filter can be used to provide a custom URL for the primary CTA to update the site to use HTTPS.
Props flixos90, timothyblynjacobs.
Fixes #51437.
Built from https://develop.svn.wordpress.org/trunk@50131
git-svn-id: http://core.svn.wordpress.org/trunk@49810 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-01 19:10:01 -05:00
// If host-specific "Update HTTPS" URL is provided, include a link.
$update_url = wp_get_update_https_url ();
if ( $update_url !== $default_update_url ) {
$result [ 'description' ] .= sprintf (
'<p><a href="%s" target="_blank" rel="noopener">%s<span class="screen-reader-text"> %s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>' ,
esc_url ( $update_url ),
__ ( 'Talk to your web host about supporting HTTPS for your website.' ),
/* translators: Accessibility text. */
__ ( '(opens in a new tab)' )
);
} else {
$result [ 'description' ] .= sprintf (
'<p>%s</p>' ,
__ ( 'Talk to your web host about supporting HTTPS for your website.' )
);
}
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
}
}
return $result ;
}
/**
* Check if the HTTP API can handle SSL / TLS requests .
*
* @ since 5.2 . 0
*
2022-08-31 18:46:11 -04:00
* @ return array The test result .
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
*/
public function get_test_ssl_support () {
$result = array (
'label' => '' ,
'status' => '' ,
'badge' => array (
2019-04-02 06:08:56 -04:00
'label' => __ ( 'Security' ),
Site Health: Improve the test badge implementation.
Label badges for each Site Health test currently display in either red, orange, or green, regardless of if the test passed or failed. This is confusing, as seeing red labels in the “Passed Test” section could alarm users (when really everything is OK and no action is required), and seeing green labels in the “Failed Tests” section would not appropriately encourage the user to take appropriate action.
This change makes several improvements to the label badges:
- Always right align the badges for consistent display.
- Remove background fill for badges. Instead, use a border.
- Use a consistent styling for all tests (passed and failed).
- The text color no longer uses true black (#000000).
- The `.badge.pink` CSS definition has been switched to `.badge.purple`, and the definitions for blue, gray, and green have also been updated to more closely follow the official WordPress color palette.
Props: pbiron, garrett-eclipse, hedgefield, Clorith, xkon, melchoyce, mdwolinski, alexdenning.
Fixes #46623.
Built from https://develop.svn.wordpress.org/trunk@45169
git-svn-id: http://core.svn.wordpress.org/trunk@44978 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-04-12 13:04:52 -04:00
'color' => 'blue' ,
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
),
'description' => sprintf (
'<p>%s</p>' ,
__ ( 'Securely communicating between servers are needed for transactions such as fetching files, conducting sales on store sites, and much more.' )
),
'actions' => '' ,
'test' => 'ssl_support' ,
);
$supports_https = wp_http_supports ( array ( 'ssl' ) );
if ( $supports_https ) {
$result [ 'status' ] = 'good' ;
$result [ 'label' ] = __ ( 'Your site can communicate securely with other services' );
} else {
$result [ 'status' ] = 'critical' ;
$result [ 'label' ] = __ ( 'Your site is unable to communicate securely with other services' );
$result [ 'description' ] .= sprintf (
'<p>%s</p>' ,
__ ( 'Talk to your web host about OpenSSL support for PHP.' )
);
}
return $result ;
}
/**
* Test if scheduled events run as intended .
*
2020-06-25 08:43:07 -04:00
* If scheduled events are not running , this may indicate something with WP_Cron is not working
* as intended , or that there are orphaned events hanging around from older code .
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
*
* @ since 5.2 . 0
*
* @ return array The test results .
*/
public function get_test_scheduled_events () {
$result = array (
'label' => __ ( 'Scheduled events are running' ),
'status' => 'good' ,
'badge' => array (
2019-04-02 06:08:56 -04:00
'label' => __ ( 'Performance' ),
Site Health: Improve the test badge implementation.
Label badges for each Site Health test currently display in either red, orange, or green, regardless of if the test passed or failed. This is confusing, as seeing red labels in the “Passed Test” section could alarm users (when really everything is OK and no action is required), and seeing green labels in the “Failed Tests” section would not appropriately encourage the user to take appropriate action.
This change makes several improvements to the label badges:
- Always right align the badges for consistent display.
- Remove background fill for badges. Instead, use a border.
- Use a consistent styling for all tests (passed and failed).
- The text color no longer uses true black (#000000).
- The `.badge.pink` CSS definition has been switched to `.badge.purple`, and the definitions for blue, gray, and green have also been updated to more closely follow the official WordPress color palette.
Props: pbiron, garrett-eclipse, hedgefield, Clorith, xkon, melchoyce, mdwolinski, alexdenning.
Fixes #46623.
Built from https://develop.svn.wordpress.org/trunk@45169
git-svn-id: http://core.svn.wordpress.org/trunk@44978 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-04-12 13:04:52 -04:00
'color' => 'blue' ,
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
),
'description' => sprintf (
'<p>%s</p>' ,
2019-04-01 16:30:52 -04:00
__ ( 'Scheduled events are what periodically looks for updates to plugins, themes and WordPress itself. It is also what makes sure scheduled posts are published on time. It may also be used by various plugins to make sure that planned actions are executed.' )
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
),
'actions' => '' ,
'test' => 'scheduled_events' ,
);
$this -> wp_schedule_test_init ();
if ( is_wp_error ( $this -> has_missed_cron () ) ) {
$result [ 'status' ] = 'critical' ;
$result [ 'label' ] = __ ( 'It was not possible to check your scheduled events' );
$result [ 'description' ] = sprintf (
'<p>%s</p>' ,
sprintf (
/* translators: %s: The error message returned while from the cron scheduler. */
2019-04-02 17:32:53 -04:00
__ ( 'While trying to test your site’s scheduled events, the following error was returned: %s' ),
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
$this -> has_missed_cron () -> get_error_message ()
)
);
2019-08-14 20:35:55 -04:00
} elseif ( $this -> has_missed_cron () ) {
$result [ 'status' ] = 'recommended' ;
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
2019-08-14 20:35:55 -04:00
$result [ 'label' ] = __ ( 'A scheduled event has failed' );
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
2019-08-14 20:35:55 -04:00
$result [ 'description' ] = sprintf (
'<p>%s</p>' ,
sprintf (
/* translators: %s: The name of the failed cron event. */
__ ( 'The scheduled event, %s, failed to run. Your site still works, but this may indicate that scheduling posts or automated updates may not work as intended.' ),
$this -> last_missed_cron
)
);
} elseif ( $this -> has_late_cron () ) {
$result [ 'status' ] = 'recommended' ;
$result [ 'label' ] = __ ( 'A scheduled event is late' );
$result [ 'description' ] = sprintf (
'<p>%s</p>' ,
sprintf (
/* translators: %s: The name of the late cron event. */
__ ( 'The scheduled event, %s, is late to run. Your site still works, but this may indicate that scheduling posts or automated updates may not work as intended.' ),
$this -> last_late_cron
)
);
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
}
return $result ;
}
/**
* Test if WordPress can run automated background updates .
*
2020-06-25 08:43:07 -04:00
* Background updates in WordPress are primarily used for minor releases and security updates .
* It ' s important to either have these working , or be aware that they are intentionally disabled
* for whatever reason .
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
*
* @ since 5.2 . 0
*
* @ return array The test results .
*/
public function get_test_background_updates () {
$result = array (
'label' => __ ( 'Background updates are working' ),
'status' => 'good' ,
'badge' => array (
2019-04-02 06:08:56 -04:00
'label' => __ ( 'Security' ),
Site Health: Improve the test badge implementation.
Label badges for each Site Health test currently display in either red, orange, or green, regardless of if the test passed or failed. This is confusing, as seeing red labels in the “Passed Test” section could alarm users (when really everything is OK and no action is required), and seeing green labels in the “Failed Tests” section would not appropriately encourage the user to take appropriate action.
This change makes several improvements to the label badges:
- Always right align the badges for consistent display.
- Remove background fill for badges. Instead, use a border.
- Use a consistent styling for all tests (passed and failed).
- The text color no longer uses true black (#000000).
- The `.badge.pink` CSS definition has been switched to `.badge.purple`, and the definitions for blue, gray, and green have also been updated to more closely follow the official WordPress color palette.
Props: pbiron, garrett-eclipse, hedgefield, Clorith, xkon, melchoyce, mdwolinski, alexdenning.
Fixes #46623.
Built from https://develop.svn.wordpress.org/trunk@45169
git-svn-id: http://core.svn.wordpress.org/trunk@44978 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-04-12 13:04:52 -04:00
'color' => 'blue' ,
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
),
'description' => sprintf (
'<p>%s</p>' ,
__ ( 'Background updates ensure that WordPress can auto-update if a security update is released for the version you are currently using.' )
),
'actions' => '' ,
'test' => 'background_updates' ,
);
if ( ! class_exists ( 'WP_Site_Health_Auto_Updates' ) ) {
2020-02-06 01:33:11 -05:00
require_once ABSPATH . 'wp-admin/includes/class-wp-site-health-auto-updates.php' ;
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
}
// Run the auto-update tests in a separate class,
// as there are many considerations to be made.
$automatic_updates = new WP_Site_Health_Auto_Updates ();
$tests = $automatic_updates -> run_tests ();
$output = '<ul>' ;
foreach ( $tests as $test ) {
$severity_string = __ ( 'Passed' );
if ( 'fail' === $test -> severity ) {
$result [ 'label' ] = __ ( 'Background updates are not working as expected' );
$result [ 'status' ] = 'critical' ;
$severity_string = __ ( 'Error' );
}
if ( 'warning' === $test -> severity && 'good' === $result [ 'status' ] ) {
$result [ 'label' ] = __ ( 'Background updates may not be working properly' );
$result [ 'status' ] = 'recommended' ;
$severity_string = __ ( 'Warning' );
}
$output .= sprintf (
2019-05-15 10:26:07 -04:00
'<li><span class="dashicons %s"><span class="screen-reader-text">%s</span></span> %s</li>' ,
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
esc_attr ( $test -> severity ),
$severity_string ,
$test -> description
);
}
$output .= '</ul>' ;
if ( 'good' !== $result [ 'status' ] ) {
2020-03-28 23:46:06 -04:00
$result [ 'description' ] .= $output ;
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
}
return $result ;
}
2020-07-21 13:07:05 -04:00
/**
* Test if plugin and theme auto - updates appear to be configured correctly .
*
* @ since 5.5 . 0
*
* @ return array The test results .
*/
public function get_test_plugin_theme_auto_updates () {
$result = array (
2020-07-21 20:17:04 -04:00
'label' => __ ( 'Plugin and theme auto-updates appear to be configured correctly' ),
2020-07-21 13:07:05 -04:00
'status' => 'good' ,
'badge' => array (
'label' => __ ( 'Security' ),
'color' => 'blue' ,
),
'description' => sprintf (
'<p>%s</p>' ,
2020-07-21 20:17:04 -04:00
__ ( 'Plugin and theme auto-updates ensure that the latest versions are always installed.' )
2020-07-21 13:07:05 -04:00
),
'actions' => '' ,
'test' => 'plugin_theme_auto_updates' ,
);
$check_plugin_theme_updates = $this -> detect_plugin_theme_auto_update_issues ();
$result [ 'status' ] = $check_plugin_theme_updates -> status ;
2020-07-21 20:07:02 -04:00
if ( 'good' !== $result [ 'status' ] ) {
2020-07-21 13:07:05 -04:00
$result [ 'label' ] = __ ( 'Your site may have problems auto-updating plugins and themes' );
$result [ 'description' ] .= sprintf (
'<p>%s</p>' ,
$check_plugin_theme_updates -> message
);
}
return $result ;
}
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
/**
* Test if loopbacks work as expected .
*
2020-06-25 08:43:07 -04:00
* A loopback is when WordPress queries itself , for example to start a new WP_Cron instance ,
* or when editing a plugin or theme . This has shown itself to be a recurring issue ,
* as code can very easily break this interaction .
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
*
* @ since 5.2 . 0
*
* @ return array The test results .
*/
public function get_test_loopback_requests () {
$result = array (
'label' => __ ( 'Your site can perform loopback requests' ),
'status' => 'good' ,
'badge' => array (
2019-04-02 06:08:56 -04:00
'label' => __ ( 'Performance' ),
Site Health: Improve the test badge implementation.
Label badges for each Site Health test currently display in either red, orange, or green, regardless of if the test passed or failed. This is confusing, as seeing red labels in the “Passed Test” section could alarm users (when really everything is OK and no action is required), and seeing green labels in the “Failed Tests” section would not appropriately encourage the user to take appropriate action.
This change makes several improvements to the label badges:
- Always right align the badges for consistent display.
- Remove background fill for badges. Instead, use a border.
- Use a consistent styling for all tests (passed and failed).
- The text color no longer uses true black (#000000).
- The `.badge.pink` CSS definition has been switched to `.badge.purple`, and the definitions for blue, gray, and green have also been updated to more closely follow the official WordPress color palette.
Props: pbiron, garrett-eclipse, hedgefield, Clorith, xkon, melchoyce, mdwolinski, alexdenning.
Fixes #46623.
Built from https://develop.svn.wordpress.org/trunk@45169
git-svn-id: http://core.svn.wordpress.org/trunk@44978 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-04-12 13:04:52 -04:00
'color' => 'blue' ,
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
),
'description' => sprintf (
'<p>%s</p>' ,
__ ( 'Loopback requests are used to run scheduled events, and are also used by the built-in editors for themes and plugins to verify code stability.' )
),
'actions' => '' ,
'test' => 'loopback_requests' ,
);
$check_loopback = $this -> can_perform_loopback ();
$result [ 'status' ] = $check_loopback -> status ;
2020-07-21 20:07:02 -04:00
if ( 'good' !== $result [ 'status' ] ) {
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
$result [ 'label' ] = __ ( 'Your site could not complete a loopback request' );
$result [ 'description' ] .= sprintf (
'<p>%s</p>' ,
$check_loopback -> message
);
}
return $result ;
}
/**
* Test if HTTP requests are blocked .
*
General: Remove “whitelist” and “blacklist” in favor of more clear and inclusive language.
“The WordPress open source community cares about diversity. We strive to maintain a welcoming environment where everyone can feel included.”
With this commit, all occurrences of “whitelist” and “blacklist” (with the single exception of the `$new_whitelist_options` global variable) are removed. A new ticket has been opened to explore renaming the `$new_whitelist_options` variable (#50434).
Changing to more specific names or rewording sentences containing these terms not only makes the code more inclusive, but also helps provide clarity. These terms are often ambiguous. What is being blocked or allowed is not always immediately clear. This can make it more difficult for non-native English speakers to read through the codebase.
Words matter. If one contributor feels more welcome because these terms are removed, this was worth the effort.
Props strangerstudios, jorbin, desrosj, joemcgill, timothyblynjacobs, ocean90, ayeshrajans, davidbaumwald, earnjam.
See #48900, #50434.
Fixes #50413.
Built from https://develop.svn.wordpress.org/trunk@48121
git-svn-id: http://core.svn.wordpress.org/trunk@47890 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-22 13:26:13 -04:00
* It ' s possible to block all outgoing communication ( with the possibility of allowing certain
* hosts ) via the HTTP API . This may create problems for users as many features are running as
* services these days .
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
*
* @ since 5.2 . 0
*
* @ return array The test results .
*/
public function get_test_http_requests () {
$result = array (
'label' => __ ( 'HTTP requests seem to be working as expected' ),
'status' => 'good' ,
'badge' => array (
2019-04-02 06:08:56 -04:00
'label' => __ ( 'Performance' ),
Site Health: Improve the test badge implementation.
Label badges for each Site Health test currently display in either red, orange, or green, regardless of if the test passed or failed. This is confusing, as seeing red labels in the “Passed Test” section could alarm users (when really everything is OK and no action is required), and seeing green labels in the “Failed Tests” section would not appropriately encourage the user to take appropriate action.
This change makes several improvements to the label badges:
- Always right align the badges for consistent display.
- Remove background fill for badges. Instead, use a border.
- Use a consistent styling for all tests (passed and failed).
- The text color no longer uses true black (#000000).
- The `.badge.pink` CSS definition has been switched to `.badge.purple`, and the definitions for blue, gray, and green have also been updated to more closely follow the official WordPress color palette.
Props: pbiron, garrett-eclipse, hedgefield, Clorith, xkon, melchoyce, mdwolinski, alexdenning.
Fixes #46623.
Built from https://develop.svn.wordpress.org/trunk@45169
git-svn-id: http://core.svn.wordpress.org/trunk@44978 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-04-12 13:04:52 -04:00
'color' => 'blue' ,
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
),
'description' => sprintf (
'<p>%s</p>' ,
__ ( 'It is possible for site maintainers to block all, or some, communication to other sites and services. If set up incorrectly, this may prevent plugins and themes from working as intended.' )
),
'actions' => '' ,
'test' => 'http_requests' ,
);
$blocked = false ;
$hosts = array ();
2019-05-16 18:08:54 -04:00
if ( defined ( 'WP_HTTP_BLOCK_EXTERNAL' ) && WP_HTTP_BLOCK_EXTERNAL ) {
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
$blocked = true ;
}
if ( defined ( 'WP_ACCESSIBLE_HOSTS' ) ) {
$hosts = explode ( ',' , WP_ACCESSIBLE_HOSTS );
}
2020-10-18 13:27:06 -04:00
if ( $blocked && 0 === count ( $hosts ) ) {
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
$result [ 'status' ] = 'critical' ;
$result [ 'label' ] = __ ( 'HTTP requests are blocked' );
$result [ 'description' ] .= sprintf (
'<p>%s</p>' ,
2019-04-02 17:32:53 -04:00
sprintf (
/* translators: %s: Name of the constant used. */
__ ( 'HTTP requests have been blocked by the %s constant, with no allowed hosts.' ),
'<code>WP_HTTP_BLOCK_EXTERNAL</code>'
)
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
);
}
2020-10-18 13:27:06 -04:00
if ( $blocked && 0 < count ( $hosts ) ) {
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
$result [ 'status' ] = 'recommended' ;
$result [ 'label' ] = __ ( 'HTTP requests are partially blocked' );
$result [ 'description' ] .= sprintf (
'<p>%s</p>' ,
sprintf (
General: Remove “whitelist” and “blacklist” in favor of more clear and inclusive language.
“The WordPress open source community cares about diversity. We strive to maintain a welcoming environment where everyone can feel included.”
With this commit, all occurrences of “whitelist” and “blacklist” (with the single exception of the `$new_whitelist_options` global variable) are removed. A new ticket has been opened to explore renaming the `$new_whitelist_options` variable (#50434).
Changing to more specific names or rewording sentences containing these terms not only makes the code more inclusive, but also helps provide clarity. These terms are often ambiguous. What is being blocked or allowed is not always immediately clear. This can make it more difficult for non-native English speakers to read through the codebase.
Words matter. If one contributor feels more welcome because these terms are removed, this was worth the effort.
Props strangerstudios, jorbin, desrosj, joemcgill, timothyblynjacobs, ocean90, ayeshrajans, davidbaumwald, earnjam.
See #48900, #50434.
Fixes #50413.
Built from https://develop.svn.wordpress.org/trunk@48121
git-svn-id: http://core.svn.wordpress.org/trunk@47890 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-22 13:26:13 -04:00
/* translators: 1: Name of the constant used. 2: List of allowed hostnames. */
__ ( 'HTTP requests have been blocked by the %1$s constant, with some allowed hosts: %2$s.' ),
2019-04-02 17:32:53 -04:00
'<code>WP_HTTP_BLOCK_EXTERNAL</code>' ,
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
implode ( ',' , $hosts )
)
);
}
return $result ;
}
/**
* Test if the REST API is accessible .
*
* Various security measures may block the REST API from working , or it may have been disabled in general .
* This is required for the new block editor to work , so we explicitly test for this .
*
* @ since 5.2 . 0
*
* @ return array The test results .
*/
public function get_test_rest_availability () {
$result = array (
'label' => __ ( 'The REST API is available' ),
'status' => 'good' ,
'badge' => array (
2019-04-02 06:08:56 -04:00
'label' => __ ( 'Performance' ),
Site Health: Improve the test badge implementation.
Label badges for each Site Health test currently display in either red, orange, or green, regardless of if the test passed or failed. This is confusing, as seeing red labels in the “Passed Test” section could alarm users (when really everything is OK and no action is required), and seeing green labels in the “Failed Tests” section would not appropriately encourage the user to take appropriate action.
This change makes several improvements to the label badges:
- Always right align the badges for consistent display.
- Remove background fill for badges. Instead, use a border.
- Use a consistent styling for all tests (passed and failed).
- The text color no longer uses true black (#000000).
- The `.badge.pink` CSS definition has been switched to `.badge.purple`, and the definitions for blue, gray, and green have also been updated to more closely follow the official WordPress color palette.
Props: pbiron, garrett-eclipse, hedgefield, Clorith, xkon, melchoyce, mdwolinski, alexdenning.
Fixes #46623.
Built from https://develop.svn.wordpress.org/trunk@45169
git-svn-id: http://core.svn.wordpress.org/trunk@44978 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-04-12 13:04:52 -04:00
'color' => 'blue' ,
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
),
'description' => sprintf (
'<p>%s</p>' ,
__ ( 'The REST API is one way WordPress, and other applications, communicate with the server. One example is the block editor screen, which relies on this to display, and save, your posts and pages.' )
),
'actions' => '' ,
'test' => 'rest_availability' ,
);
$cookies = wp_unslash ( $_COOKIE );
$timeout = 10 ;
$headers = array (
'Cache-Control' => 'no-cache' ,
'X-WP-Nonce' => wp_create_nonce ( 'wp_rest' ),
);
2019-09-21 12:06:57 -04:00
/** This filter is documented in wp-includes/class-wp-http-streams.php */
$sslverify = apply_filters ( 'https_local_ssl_verify' , false );
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
// Include Basic auth in loopback requests.
if ( isset ( $_SERVER [ 'PHP_AUTH_USER' ] ) && isset ( $_SERVER [ 'PHP_AUTH_PW' ] ) ) {
$headers [ 'Authorization' ] = 'Basic ' . base64_encode ( wp_unslash ( $_SERVER [ 'PHP_AUTH_USER' ] ) . ':' . wp_unslash ( $_SERVER [ 'PHP_AUTH_PW' ] ) );
}
$url = rest_url ( 'wp/v2/types/post' );
// The context for this is editing with the new block editor.
$url = add_query_arg (
array (
'context' => 'edit' ,
),
$url
);
2019-09-21 12:06:57 -04:00
$r = wp_remote_get ( $url , compact ( 'cookies' , 'headers' , 'timeout' , 'sslverify' ) );
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
if ( is_wp_error ( $r ) ) {
$result [ 'status' ] = 'critical' ;
$result [ 'label' ] = __ ( 'The REST API encountered an error' );
$result [ 'description' ] .= sprintf (
'<p>%s</p>' ,
sprintf (
'%s<br>%s' ,
__ ( 'The REST API request failed due to an error.' ),
sprintf (
2020-02-18 11:48:06 -05:00
/* translators: 1: The WordPress error message. 2: The WordPress error code. */
__ ( 'Error: %1$s (%2$s)' ),
$r -> get_error_message (),
$r -> get_error_code ()
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
)
)
);
} elseif ( 200 !== wp_remote_retrieve_response_code ( $r ) ) {
$result [ 'status' ] = 'recommended' ;
$result [ 'label' ] = __ ( 'The REST API encountered an unexpected result' );
$result [ 'description' ] .= sprintf (
'<p>%s</p>' ,
sprintf (
2020-02-18 11:48:06 -05:00
/* translators: 1: The HTTP error code. 2: The HTTP error message. */
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
__ ( 'The REST API call gave the following unexpected result: (%1$d) %2$s.' ),
wp_remote_retrieve_response_code ( $r ),
2020-07-25 11:38:06 -04:00
esc_html ( wp_remote_retrieve_body ( $r ) )
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
)
);
} else {
$json = json_decode ( wp_remote_retrieve_body ( $r ), true );
if ( false !== $json && ! isset ( $json [ 'capabilities' ] ) ) {
$result [ 'status' ] = 'recommended' ;
$result [ 'label' ] = __ ( 'The REST API did not behave correctly' );
$result [ 'description' ] .= sprintf (
'<p>%s</p>' ,
sprintf (
2019-09-02 20:41:05 -04:00
/* translators: %s: The name of the query parameter being tested. */
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
__ ( 'The REST API did not process the %s query parameter correctly.' ),
'<code>context</code>'
)
);
}
}
return $result ;
}
2020-07-21 11:21:02 -04:00
/**
2020-07-21 11:40:03 -04:00
* Test if 'file_uploads' directive in PHP . ini is turned off .
2020-07-21 11:21:02 -04:00
*
* @ since 5.5 . 0
*
* @ return array The test results .
*/
public function get_test_file_uploads () {
$result = array (
2021-07-30 15:38:57 -04:00
'label' => __ ( 'Files can be uploaded' ),
2020-07-21 11:21:02 -04:00
'status' => 'good' ,
'badge' => array (
'label' => __ ( 'Performance' ),
'color' => 'blue' ,
),
'description' => sprintf (
'<p>%s</p>' ,
sprintf (
2020-07-21 11:53:04 -04:00
/* translators: 1: file_uploads, 2: php.ini */
__ ( 'The %1$s directive in %2$s determines if uploading files is allowed on your site.' ),
2020-07-21 11:21:02 -04:00
'<code>file_uploads</code>' ,
'<code>php.ini</code>'
)
),
'actions' => '' ,
'test' => 'file_uploads' ,
);
if ( ! function_exists ( 'ini_get' ) ) {
$result [ 'status' ] = 'critical' ;
$result [ 'description' ] .= sprintf (
/* translators: %s: ini_get() */
__ ( 'The %s function has been disabled, some media settings are unavailable because of this.' ),
'<code>ini_get()</code>'
);
return $result ;
}
if ( empty ( ini_get ( 'file_uploads' ) ) ) {
$result [ 'status' ] = 'critical' ;
$result [ 'description' ] .= sprintf (
'<p>%s</p>' ,
sprintf (
2020-07-21 11:53:04 -04:00
/* translators: 1: file_uploads, 2: 0 */
__ ( '%1$s is set to %2$s. You won\'t be able to upload files on your site.' ),
2020-07-21 11:21:02 -04:00
'<code>file_uploads</code>' ,
'<code>0</code>'
)
);
return $result ;
}
2020-08-16 13:54:05 -04:00
$post_max_size = ini_get ( 'post_max_size' );
$upload_max_filesize = ini_get ( 'upload_max_filesize' );
2020-07-21 11:40:03 -04:00
2020-08-16 13:54:05 -04:00
if ( wp_convert_hr_to_bytes ( $post_max_size ) < wp_convert_hr_to_bytes ( $upload_max_filesize ) ) {
2020-07-21 11:53:04 -04:00
$result [ 'label' ] = sprintf (
/* translators: 1: post_max_size, 2: upload_max_filesize */
2021-07-30 15:38:57 -04:00
__ ( 'The "%1$s" value is smaller than "%2$s"' ),
2020-07-21 11:53:04 -04:00
'post_max_size' ,
'upload_max_filesize'
);
2021-02-09 07:05:07 -05:00
$result [ 'status' ] = 'recommended' ;
if ( 0 === wp_convert_hr_to_bytes ( $post_max_size ) ) {
$result [ 'description' ] = sprintf (
'<p>%s</p>' ,
sprintf (
/* translators: 1: post_max_size, 2: upload_max_filesize */
__ ( 'The setting for %1$s is currently configured as 0, this could cause some problems when trying to upload files through plugin or theme features that rely on various upload methods. It is recommended to configure this setting to a fixed value, ideally matching the value of %2$s, as some upload methods read the value 0 as either unlimited, or disabled.' ),
'<code>post_max_size</code>' ,
'<code>upload_max_filesize</code>'
)
);
} else {
$result [ 'description' ] = sprintf (
'<p>%s</p>' ,
sprintf (
/* translators: 1: post_max_size, 2: upload_max_filesize */
__ ( 'The setting for %1$s is smaller than %2$s, this could cause some problems when trying to upload files.' ),
'<code>post_max_size</code>' ,
'<code>upload_max_filesize</code>'
)
);
}
2020-07-21 11:21:02 -04:00
return $result ;
}
return $result ;
}
2020-10-27 14:32:07 -04:00
/**
* Tests if the Authorization header has the expected values .
*
* @ since 5.6 . 0
*
* @ return array
*/
public function get_test_authorization_header () {
$result = array (
2021-07-30 15:38:57 -04:00
'label' => __ ( 'The Authorization header is working as expected' ),
2020-10-27 14:32:07 -04:00
'status' => 'good' ,
'badge' => array (
'label' => __ ( 'Security' ),
'color' => 'blue' ,
),
'description' => sprintf (
'<p>%s</p>' ,
__ ( 'The Authorization header comes from the third-party applications you approve. Without it, those apps cannot connect to your site.' )
),
'actions' => '' ,
'test' => 'authorization_header' ,
);
if ( ! isset ( $_SERVER [ 'PHP_AUTH_USER' ], $_SERVER [ 'PHP_AUTH_PW' ] ) ) {
2021-07-30 15:38:57 -04:00
$result [ 'label' ] = __ ( 'The authorization header is missing' );
2020-10-27 14:32:07 -04:00
} elseif ( 'user' !== $_SERVER [ 'PHP_AUTH_USER' ] || 'pwd' !== $_SERVER [ 'PHP_AUTH_PW' ] ) {
2021-07-30 15:38:57 -04:00
$result [ 'label' ] = __ ( 'The authorization header is invalid' );
2020-10-27 14:32:07 -04:00
} else {
return $result ;
}
$result [ 'status' ] = 'recommended' ;
if ( ! function_exists ( 'got_mod_rewrite' ) ) {
require_once ABSPATH . 'wp-admin/includes/misc.php' ;
}
if ( got_mod_rewrite () ) {
$result [ 'actions' ] .= sprintf (
'<p><a href="%s">%s</a></p>' ,
esc_url ( admin_url ( 'options-permalink.php' ) ),
__ ( 'Flush permalinks' )
);
} else {
$result [ 'actions' ] .= sprintf (
'<p><a href="%s" target="_blank" rel="noopener">%s <span class="screen-reader-text">%s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>' ,
2020-11-18 10:04:05 -05:00
__ ( 'https://developer.wordpress.org/rest-api/frequently-asked-questions/#why-is-authentication-not-working' ),
2020-10-27 14:32:07 -04:00
__ ( 'Learn how to configure the Authorization header.' ),
/* translators: Accessibility text. */
__ ( '(opens in a new tab)' )
);
}
return $result ;
}
Site Health: Introduce persistent object cache check.
This changeset adds a new `persistent_object_cache` check which determines whether the site uses a persistent object cache, and if not, recommends it if it is beneficial for the site. A support resource to learn more about object caching has been created and is linked in the check.
A few filters are included for customization of the check, aimed primarily at hosting providers to provide more specific information in regards to their environment:
* `site_status_persistent_object_cache_url` filters the URL to learn more about object caching, so that e.g. a hosting-specific object caching support resource could be linked.
* `site_status_persistent_object_cache_notes` filters the notes added to the check description, so that more fine tuned information on object caching based on the environment can be provided.
* `site_status_should_suggest_persistent_object_cache` is a short-circuit filter which allows using entirely custom logic to determine whether a persistent object cache would make sense for the site.
* `site_status_persistent_object_cache_thresholds` filters the thresholds in the default logic to determine whether a persistent object cache would make sense for the site, which is based on the amount of data in the database.
Note that due to the nature of this check it is only run in production environments.
Props furi3r, tillkruss, spacedmonkey, audrasjb, Clorith.
Fixes #56040.
Built from https://develop.svn.wordpress.org/trunk@53955
git-svn-id: http://core.svn.wordpress.org/trunk@53514 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-29 12:54:12 -04:00
/**
2022-09-01 11:28:16 -04:00
* Tests if a full page cache is available .
*
* @ since 6.1 . 0
Site Health: Introduce persistent object cache check.
This changeset adds a new `persistent_object_cache` check which determines whether the site uses a persistent object cache, and if not, recommends it if it is beneficial for the site. A support resource to learn more about object caching has been created and is linked in the check.
A few filters are included for customization of the check, aimed primarily at hosting providers to provide more specific information in regards to their environment:
* `site_status_persistent_object_cache_url` filters the URL to learn more about object caching, so that e.g. a hosting-specific object caching support resource could be linked.
* `site_status_persistent_object_cache_notes` filters the notes added to the check description, so that more fine tuned information on object caching based on the environment can be provided.
* `site_status_should_suggest_persistent_object_cache` is a short-circuit filter which allows using entirely custom logic to determine whether a persistent object cache would make sense for the site.
* `site_status_persistent_object_cache_thresholds` filters the thresholds in the default logic to determine whether a persistent object cache would make sense for the site, which is based on the amount of data in the database.
Note that due to the nature of this check it is only run in production environments.
Props furi3r, tillkruss, spacedmonkey, audrasjb, Clorith.
Fixes #56040.
Built from https://develop.svn.wordpress.org/trunk@53955
git-svn-id: http://core.svn.wordpress.org/trunk@53514 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-29 12:54:12 -04:00
*
2022-09-01 11:28:16 -04:00
* @ return array The test result .
*/
public function get_test_page_cache () {
$description = '<p>' . __ ( 'Page cache enhances the speed and performance of your site by saving and serving static pages instead of calling for a page every time a user visits.' ) . '</p>' ;
$description .= '<p>' . __ ( 'Page cache is detected by looking for an active page cache plugin as well as making three requests to the homepage and looking for one or more of the following HTTP client caching response headers:' ) . '</p>' ;
$description .= '<code>' . implode ( '</code>, <code>' , array_keys ( $this -> get_page_cache_headers () ) ) . '.</code>' ;
$result = array (
'badge' => array (
'label' => __ ( 'Performance' ),
'color' => 'blue' ,
),
'description' => wp_kses_post ( $description ),
'test' => 'page_cache' ,
'status' => 'good' ,
'label' => '' ,
'actions' => sprintf (
'<p><a href="%1$s" target="_blank" rel="noopener noreferrer">%2$s <span class="screen-reader-text">%3$s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>' ,
__ ( 'https://wordpress.org/support/article/optimization/#Caching' ),
__ ( 'Learn more about page cache' ),
/* translators: Accessibility text. */
__ ( '(opens in a new tab)' )
),
);
$page_cache_detail = $this -> get_page_cache_detail ();
if ( is_wp_error ( $page_cache_detail ) ) {
$result [ 'label' ] = __ ( 'Unable to detect the presence of page cache' );
$result [ 'status' ] = 'recommended' ;
$error_info = sprintf (
/* translators: 1: Error message, 2: Error code. */
__ ( 'Unable to detect page cache due to possible loopback request problem. Please verify that the loopback request test is passing. Error: %1$s (Code: %2$s)' ),
$page_cache_detail -> get_error_message (),
$page_cache_detail -> get_error_code ()
);
$result [ 'description' ] = wp_kses_post ( " <p> $error_info </p> " ) . $result [ 'description' ];
return $result ;
}
$result [ 'status' ] = $page_cache_detail [ 'status' ];
switch ( $page_cache_detail [ 'status' ] ) {
case 'recommended' :
$result [ 'label' ] = __ ( 'Page cache is not detected but the server response time is OK' );
break ;
case 'good' :
$result [ 'label' ] = __ ( 'Page cache is detected and the server response time is good' );
break ;
default :
if ( empty ( $page_cache_detail [ 'headers' ] ) && ! $page_cache_detail [ 'advanced_cache_present' ] ) {
$result [ 'label' ] = __ ( 'Page cache is not detected and the server response time is slow' );
} else {
$result [ 'label' ] = __ ( 'Page cache is detected but the server response time is still slow' );
}
}
$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.' );
} 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 (
/* 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 (
/* 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' ] ),
number_format_i18n ( $threshold )
);
}
if ( empty ( $page_cache_detail [ 'headers' ] ) ) {
$page_cache_test_summary [] = '<span class="dashicons dashicons-warning"></span> ' . __ ( 'No client caching response headers were detected.' );
} else {
$headers_summary = '<span class="dashicons dashicons-yes-alt"></span>' ;
$headers_summary .= ' ' . sprintf (
/* translators: %d: Number of caching headers. */
_n (
'There was %d client caching response header detected:' ,
'There were %d client caching response headers detected:' ,
count ( $page_cache_detail [ 'headers' ] )
),
count ( $page_cache_detail [ 'headers' ] )
);
$headers_summary .= ' <code>' . implode ( '</code>, <code>' , $page_cache_detail [ 'headers' ] ) . '</code>.' ;
$page_cache_test_summary [] = $headers_summary ;
}
}
if ( $page_cache_detail [ 'advanced_cache_present' ] ) {
$page_cache_test_summary [] = '<span class="dashicons dashicons-yes-alt"></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.' );
}
$result [ 'description' ] .= '<ul><li>' . implode ( '</li><li>' , $page_cache_test_summary ) . '</li></ul>' ;
return $result ;
}
/**
* Tests if the site uses persistent object cache and recommends to use it if not .
Site Health: Introduce persistent object cache check.
This changeset adds a new `persistent_object_cache` check which determines whether the site uses a persistent object cache, and if not, recommends it if it is beneficial for the site. A support resource to learn more about object caching has been created and is linked in the check.
A few filters are included for customization of the check, aimed primarily at hosting providers to provide more specific information in regards to their environment:
* `site_status_persistent_object_cache_url` filters the URL to learn more about object caching, so that e.g. a hosting-specific object caching support resource could be linked.
* `site_status_persistent_object_cache_notes` filters the notes added to the check description, so that more fine tuned information on object caching based on the environment can be provided.
* `site_status_should_suggest_persistent_object_cache` is a short-circuit filter which allows using entirely custom logic to determine whether a persistent object cache would make sense for the site.
* `site_status_persistent_object_cache_thresholds` filters the thresholds in the default logic to determine whether a persistent object cache would make sense for the site, which is based on the amount of data in the database.
Note that due to the nature of this check it is only run in production environments.
Props furi3r, tillkruss, spacedmonkey, audrasjb, Clorith.
Fixes #56040.
Built from https://develop.svn.wordpress.org/trunk@53955
git-svn-id: http://core.svn.wordpress.org/trunk@53514 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-29 12:54:12 -04:00
*
* @ since 6.1 . 0
*
* @ return array The test result .
*/
public function get_test_persistent_object_cache () {
/**
* Filters the action URL for the persistent object cache health check .
*
* @ since 6.1 . 0
*
* @ param string $action_url Learn more link for persistent object cache health check .
*/
$action_url = apply_filters (
'site_status_persistent_object_cache_url' ,
/* translators: Localized Support reference. */
2022-08-31 18:19:12 -04:00
__ ( 'https://wordpress.org/support/article/optimization/#persistent-object-cache' )
Site Health: Introduce persistent object cache check.
This changeset adds a new `persistent_object_cache` check which determines whether the site uses a persistent object cache, and if not, recommends it if it is beneficial for the site. A support resource to learn more about object caching has been created and is linked in the check.
A few filters are included for customization of the check, aimed primarily at hosting providers to provide more specific information in regards to their environment:
* `site_status_persistent_object_cache_url` filters the URL to learn more about object caching, so that e.g. a hosting-specific object caching support resource could be linked.
* `site_status_persistent_object_cache_notes` filters the notes added to the check description, so that more fine tuned information on object caching based on the environment can be provided.
* `site_status_should_suggest_persistent_object_cache` is a short-circuit filter which allows using entirely custom logic to determine whether a persistent object cache would make sense for the site.
* `site_status_persistent_object_cache_thresholds` filters the thresholds in the default logic to determine whether a persistent object cache would make sense for the site, which is based on the amount of data in the database.
Note that due to the nature of this check it is only run in production environments.
Props furi3r, tillkruss, spacedmonkey, audrasjb, Clorith.
Fixes #56040.
Built from https://develop.svn.wordpress.org/trunk@53955
git-svn-id: http://core.svn.wordpress.org/trunk@53514 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-29 12:54:12 -04:00
);
$result = array (
'test' => 'persistent_object_cache' ,
'status' => 'good' ,
'badge' => array (
'label' => __ ( 'Performance' ),
'color' => 'blue' ,
),
'label' => __ ( 'A persistent object cache is being used' ),
'description' => sprintf (
'<p>%s</p>' ,
2022-08-31 20:19:18 -04:00
__ ( 'A persistent object cache makes your site’s database more efficient, resulting in faster load times because WordPress can retrieve your site’s content and settings much more quickly.' )
Site Health: Introduce persistent object cache check.
This changeset adds a new `persistent_object_cache` check which determines whether the site uses a persistent object cache, and if not, recommends it if it is beneficial for the site. A support resource to learn more about object caching has been created and is linked in the check.
A few filters are included for customization of the check, aimed primarily at hosting providers to provide more specific information in regards to their environment:
* `site_status_persistent_object_cache_url` filters the URL to learn more about object caching, so that e.g. a hosting-specific object caching support resource could be linked.
* `site_status_persistent_object_cache_notes` filters the notes added to the check description, so that more fine tuned information on object caching based on the environment can be provided.
* `site_status_should_suggest_persistent_object_cache` is a short-circuit filter which allows using entirely custom logic to determine whether a persistent object cache would make sense for the site.
* `site_status_persistent_object_cache_thresholds` filters the thresholds in the default logic to determine whether a persistent object cache would make sense for the site, which is based on the amount of data in the database.
Note that due to the nature of this check it is only run in production environments.
Props furi3r, tillkruss, spacedmonkey, audrasjb, Clorith.
Fixes #56040.
Built from https://develop.svn.wordpress.org/trunk@53955
git-svn-id: http://core.svn.wordpress.org/trunk@53514 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-29 12:54:12 -04:00
),
'actions' => sprintf (
'<p><a href="%s" target="_blank" rel="noopener">%s <span class="screen-reader-text">%s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>' ,
esc_url ( $action_url ),
__ ( 'Learn more about persistent object caching.' ),
/* translators: Accessibility text. */
__ ( '(opens in a new tab)' )
),
);
if ( wp_using_ext_object_cache () ) {
return $result ;
}
if ( ! $this -> should_suggest_persistent_object_cache () ) {
$result [ 'label' ] = __ ( 'A persistent object cache is not required' );
return $result ;
}
$available_services = $this -> available_object_cache_services ();
$notes = __ ( 'Your hosting provider can tell you if a persistent object cache can be enabled on your site.' );
if ( ! empty ( $available_services ) ) {
$notes .= ' ' . sprintf (
/* translators: Available object caching services. */
__ ( 'Your host appears to support the following object caching services: %s.' ),
implode ( ', ' , $available_services )
);
}
/**
* Filters the second paragraph of the health check ' s description
* when suggesting the use of a persistent object cache .
*
* Hosts may want to replace the notes to recommend their preferred object caching solution .
*
* Plugin authors may want to append notes ( not replace ) on why object caching is recommended for their plugin .
*
* @ since 6.1 . 0
*
* @ param string $notes The notes appended to the health check description .
* @ param array $available_services The list of available persistent object cache services .
*/
$notes = apply_filters ( 'site_status_persistent_object_cache_notes' , $notes , $available_services );
$result [ 'status' ] = 'recommended' ;
$result [ 'label' ] = __ ( 'You should use a persistent object cache' );
$result [ 'description' ] .= sprintf (
'<p>%s</p>' ,
wp_kses (
$notes ,
array (
'a' => array ( 'href' => true ),
'code' => true ,
'em' => true ,
'strong' => true ,
)
)
);
return $result ;
}
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
/**
* Return a set of tests that belong to the site status page .
*
* Each site status test is defined here , they may be `direct` tests , that run on page load , or `async` tests
* which will run later down the line via JavaScript calls to improve page performance and hopefully also user
* experiences .
*
* @ since 5.2 . 0
2020-10-14 22:00:08 -04:00
* @ since 5.6 . 0 Added support for `has_rest` and `permissions` .
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
*
* @ return array The list of tests to run .
*/
public static function get_tests () {
$tests = array (
'direct' => array (
Upgrade/install: Revert upgrader rollback features.
Revert the rollback features introduced for theme and plugin upgrades during the WordPress 5.9 cycle. A bug (suspected to be in third party virtualisation software) causes the upgrades to fail consistently on some set ups. The revert is to allow contributors further time to investigate mitigation options.
Reverts [52337], [52289], [52284], [51951], [52192], [51902], [51899], [51898], [51815].
Props pbiron, dlh, peterwilsoncc, galbaras, SergeyBiryukov, afragen, costdev, bronsonquick, aristath, noisysocks, desrosj, TobiasBg, hellofromTonya, francina, Boniu91.
See #54543, #54166, #51857.
Built from https://develop.svn.wordpress.org/trunk@52351
git-svn-id: http://core.svn.wordpress.org/trunk@51943 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-09 19:06:04 -05:00
'wordpress_version' => array (
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
'label' => __ ( 'WordPress Version' ),
'test' => 'wordpress_version' ,
),
Upgrade/install: Revert upgrader rollback features.
Revert the rollback features introduced for theme and plugin upgrades during the WordPress 5.9 cycle. A bug (suspected to be in third party virtualisation software) causes the upgrades to fail consistently on some set ups. The revert is to allow contributors further time to investigate mitigation options.
Reverts [52337], [52289], [52284], [51951], [52192], [51902], [51899], [51898], [51815].
Props pbiron, dlh, peterwilsoncc, galbaras, SergeyBiryukov, afragen, costdev, bronsonquick, aristath, noisysocks, desrosj, TobiasBg, hellofromTonya, francina, Boniu91.
See #54543, #54166, #51857.
Built from https://develop.svn.wordpress.org/trunk@52351
git-svn-id: http://core.svn.wordpress.org/trunk@51943 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-09 19:06:04 -05:00
'plugin_version' => array (
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
'label' => __ ( 'Plugin Versions' ),
'test' => 'plugin_version' ,
),
Upgrade/install: Revert upgrader rollback features.
Revert the rollback features introduced for theme and plugin upgrades during the WordPress 5.9 cycle. A bug (suspected to be in third party virtualisation software) causes the upgrades to fail consistently on some set ups. The revert is to allow contributors further time to investigate mitigation options.
Reverts [52337], [52289], [52284], [51951], [52192], [51902], [51899], [51898], [51815].
Props pbiron, dlh, peterwilsoncc, galbaras, SergeyBiryukov, afragen, costdev, bronsonquick, aristath, noisysocks, desrosj, TobiasBg, hellofromTonya, francina, Boniu91.
See #54543, #54166, #51857.
Built from https://develop.svn.wordpress.org/trunk@52351
git-svn-id: http://core.svn.wordpress.org/trunk@51943 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-09 19:06:04 -05:00
'theme_version' => array (
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
'label' => __ ( 'Theme Versions' ),
'test' => 'theme_version' ,
),
Upgrade/install: Revert upgrader rollback features.
Revert the rollback features introduced for theme and plugin upgrades during the WordPress 5.9 cycle. A bug (suspected to be in third party virtualisation software) causes the upgrades to fail consistently on some set ups. The revert is to allow contributors further time to investigate mitigation options.
Reverts [52337], [52289], [52284], [51951], [52192], [51902], [51899], [51898], [51815].
Props pbiron, dlh, peterwilsoncc, galbaras, SergeyBiryukov, afragen, costdev, bronsonquick, aristath, noisysocks, desrosj, TobiasBg, hellofromTonya, francina, Boniu91.
See #54543, #54166, #51857.
Built from https://develop.svn.wordpress.org/trunk@52351
git-svn-id: http://core.svn.wordpress.org/trunk@51943 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-09 19:06:04 -05:00
'php_version' => array (
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
'label' => __ ( 'PHP Version' ),
'test' => 'php_version' ,
),
Upgrade/install: Revert upgrader rollback features.
Revert the rollback features introduced for theme and plugin upgrades during the WordPress 5.9 cycle. A bug (suspected to be in third party virtualisation software) causes the upgrades to fail consistently on some set ups. The revert is to allow contributors further time to investigate mitigation options.
Reverts [52337], [52289], [52284], [51951], [52192], [51902], [51899], [51898], [51815].
Props pbiron, dlh, peterwilsoncc, galbaras, SergeyBiryukov, afragen, costdev, bronsonquick, aristath, noisysocks, desrosj, TobiasBg, hellofromTonya, francina, Boniu91.
See #54543, #54166, #51857.
Built from https://develop.svn.wordpress.org/trunk@52351
git-svn-id: http://core.svn.wordpress.org/trunk@51943 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-09 19:06:04 -05:00
'php_extensions' => array (
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
'label' => __ ( 'PHP Extensions' ),
'test' => 'php_extensions' ,
),
Upgrade/install: Revert upgrader rollback features.
Revert the rollback features introduced for theme and plugin upgrades during the WordPress 5.9 cycle. A bug (suspected to be in third party virtualisation software) causes the upgrades to fail consistently on some set ups. The revert is to allow contributors further time to investigate mitigation options.
Reverts [52337], [52289], [52284], [51951], [52192], [51902], [51899], [51898], [51815].
Props pbiron, dlh, peterwilsoncc, galbaras, SergeyBiryukov, afragen, costdev, bronsonquick, aristath, noisysocks, desrosj, TobiasBg, hellofromTonya, francina, Boniu91.
See #54543, #54166, #51857.
Built from https://develop.svn.wordpress.org/trunk@52351
git-svn-id: http://core.svn.wordpress.org/trunk@51943 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-09 19:06:04 -05:00
'php_default_timezone' => array (
2019-11-28 10:48:03 -05:00
'label' => __ ( 'PHP Default Timezone' ),
'test' => 'php_default_timezone' ,
),
Upgrade/install: Revert upgrader rollback features.
Revert the rollback features introduced for theme and plugin upgrades during the WordPress 5.9 cycle. A bug (suspected to be in third party virtualisation software) causes the upgrades to fail consistently on some set ups. The revert is to allow contributors further time to investigate mitigation options.
Reverts [52337], [52289], [52284], [51951], [52192], [51902], [51899], [51898], [51815].
Props pbiron, dlh, peterwilsoncc, galbaras, SergeyBiryukov, afragen, costdev, bronsonquick, aristath, noisysocks, desrosj, TobiasBg, hellofromTonya, francina, Boniu91.
See #54543, #54166, #51857.
Built from https://develop.svn.wordpress.org/trunk@52351
git-svn-id: http://core.svn.wordpress.org/trunk@51943 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-09 19:06:04 -05:00
'php_sessions' => array (
2020-04-16 04:20:09 -04:00
'label' => __ ( 'PHP Sessions' ),
'test' => 'php_sessions' ,
),
Upgrade/install: Revert upgrader rollback features.
Revert the rollback features introduced for theme and plugin upgrades during the WordPress 5.9 cycle. A bug (suspected to be in third party virtualisation software) causes the upgrades to fail consistently on some set ups. The revert is to allow contributors further time to investigate mitigation options.
Reverts [52337], [52289], [52284], [51951], [52192], [51902], [51899], [51898], [51815].
Props pbiron, dlh, peterwilsoncc, galbaras, SergeyBiryukov, afragen, costdev, bronsonquick, aristath, noisysocks, desrosj, TobiasBg, hellofromTonya, francina, Boniu91.
See #54543, #54166, #51857.
Built from https://develop.svn.wordpress.org/trunk@52351
git-svn-id: http://core.svn.wordpress.org/trunk@51943 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-09 19:06:04 -05:00
'sql_server' => array (
2019-11-28 10:48:03 -05:00
'label' => __ ( 'Database Server version' ),
'test' => 'sql_server' ,
),
Upgrade/install: Revert upgrader rollback features.
Revert the rollback features introduced for theme and plugin upgrades during the WordPress 5.9 cycle. A bug (suspected to be in third party virtualisation software) causes the upgrades to fail consistently on some set ups. The revert is to allow contributors further time to investigate mitigation options.
Reverts [52337], [52289], [52284], [51951], [52192], [51902], [51899], [51898], [51815].
Props pbiron, dlh, peterwilsoncc, galbaras, SergeyBiryukov, afragen, costdev, bronsonquick, aristath, noisysocks, desrosj, TobiasBg, hellofromTonya, francina, Boniu91.
See #54543, #54166, #51857.
Built from https://develop.svn.wordpress.org/trunk@52351
git-svn-id: http://core.svn.wordpress.org/trunk@51943 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-09 19:06:04 -05:00
'utf8mb4_support' => array (
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
'label' => __ ( 'MySQL utf8mb4 support' ),
'test' => 'utf8mb4_support' ,
),
Upgrade/install: Revert upgrader rollback features.
Revert the rollback features introduced for theme and plugin upgrades during the WordPress 5.9 cycle. A bug (suspected to be in third party virtualisation software) causes the upgrades to fail consistently on some set ups. The revert is to allow contributors further time to investigate mitigation options.
Reverts [52337], [52289], [52284], [51951], [52192], [51902], [51899], [51898], [51815].
Props pbiron, dlh, peterwilsoncc, galbaras, SergeyBiryukov, afragen, costdev, bronsonquick, aristath, noisysocks, desrosj, TobiasBg, hellofromTonya, francina, Boniu91.
See #54543, #54166, #51857.
Built from https://develop.svn.wordpress.org/trunk@52351
git-svn-id: http://core.svn.wordpress.org/trunk@51943 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-09 19:06:04 -05:00
'ssl_support' => array (
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
'label' => __ ( 'Secure communication' ),
'test' => 'ssl_support' ,
),
Upgrade/install: Revert upgrader rollback features.
Revert the rollback features introduced for theme and plugin upgrades during the WordPress 5.9 cycle. A bug (suspected to be in third party virtualisation software) causes the upgrades to fail consistently on some set ups. The revert is to allow contributors further time to investigate mitigation options.
Reverts [52337], [52289], [52284], [51951], [52192], [51902], [51899], [51898], [51815].
Props pbiron, dlh, peterwilsoncc, galbaras, SergeyBiryukov, afragen, costdev, bronsonquick, aristath, noisysocks, desrosj, TobiasBg, hellofromTonya, francina, Boniu91.
See #54543, #54166, #51857.
Built from https://develop.svn.wordpress.org/trunk@52351
git-svn-id: http://core.svn.wordpress.org/trunk@51943 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-09 19:06:04 -05:00
'scheduled_events' => array (
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
'label' => __ ( 'Scheduled events' ),
'test' => 'scheduled_events' ,
),
Upgrade/install: Revert upgrader rollback features.
Revert the rollback features introduced for theme and plugin upgrades during the WordPress 5.9 cycle. A bug (suspected to be in third party virtualisation software) causes the upgrades to fail consistently on some set ups. The revert is to allow contributors further time to investigate mitigation options.
Reverts [52337], [52289], [52284], [51951], [52192], [51902], [51899], [51898], [51815].
Props pbiron, dlh, peterwilsoncc, galbaras, SergeyBiryukov, afragen, costdev, bronsonquick, aristath, noisysocks, desrosj, TobiasBg, hellofromTonya, francina, Boniu91.
See #54543, #54166, #51857.
Built from https://develop.svn.wordpress.org/trunk@52351
git-svn-id: http://core.svn.wordpress.org/trunk@51943 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-09 19:06:04 -05:00
'http_requests' => array (
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
'label' => __ ( 'HTTP Requests' ),
'test' => 'http_requests' ,
),
Upgrade/install: Revert upgrader rollback features.
Revert the rollback features introduced for theme and plugin upgrades during the WordPress 5.9 cycle. A bug (suspected to be in third party virtualisation software) causes the upgrades to fail consistently on some set ups. The revert is to allow contributors further time to investigate mitigation options.
Reverts [52337], [52289], [52284], [51951], [52192], [51902], [51899], [51898], [51815].
Props pbiron, dlh, peterwilsoncc, galbaras, SergeyBiryukov, afragen, costdev, bronsonquick, aristath, noisysocks, desrosj, TobiasBg, hellofromTonya, francina, Boniu91.
See #54543, #54166, #51857.
Built from https://develop.svn.wordpress.org/trunk@52351
git-svn-id: http://core.svn.wordpress.org/trunk@51943 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-09 19:06:04 -05:00
'rest_availability' => array (
2021-06-03 07:14:56 -04:00
'label' => __ ( 'REST API availability' ),
'test' => 'rest_availability' ,
'skip_cron' => true ,
),
Upgrade/install: Revert upgrader rollback features.
Revert the rollback features introduced for theme and plugin upgrades during the WordPress 5.9 cycle. A bug (suspected to be in third party virtualisation software) causes the upgrades to fail consistently on some set ups. The revert is to allow contributors further time to investigate mitigation options.
Reverts [52337], [52289], [52284], [51951], [52192], [51902], [51899], [51898], [51815].
Props pbiron, dlh, peterwilsoncc, galbaras, SergeyBiryukov, afragen, costdev, bronsonquick, aristath, noisysocks, desrosj, TobiasBg, hellofromTonya, francina, Boniu91.
See #54543, #54166, #51857.
Built from https://develop.svn.wordpress.org/trunk@52351
git-svn-id: http://core.svn.wordpress.org/trunk@51943 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-09 19:06:04 -05:00
'debug_enabled' => array (
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
'label' => __ ( 'Debugging enabled' ),
'test' => 'is_in_debug_mode' ,
),
Upgrade/install: Revert upgrader rollback features.
Revert the rollback features introduced for theme and plugin upgrades during the WordPress 5.9 cycle. A bug (suspected to be in third party virtualisation software) causes the upgrades to fail consistently on some set ups. The revert is to allow contributors further time to investigate mitigation options.
Reverts [52337], [52289], [52284], [51951], [52192], [51902], [51899], [51898], [51815].
Props pbiron, dlh, peterwilsoncc, galbaras, SergeyBiryukov, afragen, costdev, bronsonquick, aristath, noisysocks, desrosj, TobiasBg, hellofromTonya, francina, Boniu91.
See #54543, #54166, #51857.
Built from https://develop.svn.wordpress.org/trunk@52351
git-svn-id: http://core.svn.wordpress.org/trunk@51943 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-09 19:06:04 -05:00
'file_uploads' => array (
2020-07-21 11:21:02 -04:00
'label' => __ ( 'File uploads' ),
'test' => 'file_uploads' ,
),
Upgrade/install: Revert upgrader rollback features.
Revert the rollback features introduced for theme and plugin upgrades during the WordPress 5.9 cycle. A bug (suspected to be in third party virtualisation software) causes the upgrades to fail consistently on some set ups. The revert is to allow contributors further time to investigate mitigation options.
Reverts [52337], [52289], [52284], [51951], [52192], [51902], [51899], [51898], [51815].
Props pbiron, dlh, peterwilsoncc, galbaras, SergeyBiryukov, afragen, costdev, bronsonquick, aristath, noisysocks, desrosj, TobiasBg, hellofromTonya, francina, Boniu91.
See #54543, #54166, #51857.
Built from https://develop.svn.wordpress.org/trunk@52351
git-svn-id: http://core.svn.wordpress.org/trunk@51943 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-09 19:06:04 -05:00
'plugin_theme_auto_updates' => array (
2020-07-21 20:07:02 -04:00
'label' => __ ( 'Plugin and theme auto-updates' ),
'test' => 'plugin_theme_auto_updates' ,
),
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
),
'async' => array (
'dotorg_communication' => array (
2020-10-20 10:50:06 -04:00
'label' => __ ( 'Communication with WordPress.org' ),
'test' => rest_url ( 'wp-site-health/v1/tests/dotorg-communication' ),
'has_rest' => true ,
'async_direct_test' => array ( WP_Site_Health :: get_instance (), 'get_test_dotorg_communication' ),
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
),
'background_updates' => array (
2020-10-20 10:50:06 -04:00
'label' => __ ( 'Background updates' ),
'test' => rest_url ( 'wp-site-health/v1/tests/background-updates' ),
'has_rest' => true ,
'async_direct_test' => array ( WP_Site_Health :: get_instance (), 'get_test_background_updates' ),
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
),
'loopback_requests' => array (
2020-10-20 10:50:06 -04:00
'label' => __ ( 'Loopback request' ),
'test' => rest_url ( 'wp-site-health/v1/tests/loopback-requests' ),
'has_rest' => true ,
'async_direct_test' => array ( WP_Site_Health :: get_instance (), 'get_test_loopback_requests' ),
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
),
2021-01-29 14:10:58 -05:00
'https_status' => array (
'label' => __ ( 'HTTPS status' ),
'test' => rest_url ( 'wp-site-health/v1/tests/https-status' ),
'has_rest' => true ,
'async_direct_test' => array ( WP_Site_Health :: get_instance (), 'get_test_https_status' ),
),
2021-06-01 20:51:57 -04:00
),
);
// Conditionally include Authorization header test if the site isn't protected by Basic Auth.
2021-06-03 07:14:56 -04:00
if ( ! wp_is_site_protected_by_basic_auth () ) {
$tests [ 'async' ][ 'authorization_header' ] = array (
'label' => __ ( 'Authorization header' ),
'test' => rest_url ( 'wp-site-health/v1/tests/authorization-header' ),
'has_rest' => true ,
'headers' => array ( 'Authorization' => 'Basic ' . base64_encode ( 'user:pwd' ) ),
2021-05-20 07:09:56 -04:00
'skip_cron' => true ,
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
);
}
2022-08-31 18:46:11 -04:00
// Only check for caches in production environments.
Site Health: Introduce persistent object cache check.
This changeset adds a new `persistent_object_cache` check which determines whether the site uses a persistent object cache, and if not, recommends it if it is beneficial for the site. A support resource to learn more about object caching has been created and is linked in the check.
A few filters are included for customization of the check, aimed primarily at hosting providers to provide more specific information in regards to their environment:
* `site_status_persistent_object_cache_url` filters the URL to learn more about object caching, so that e.g. a hosting-specific object caching support resource could be linked.
* `site_status_persistent_object_cache_notes` filters the notes added to the check description, so that more fine tuned information on object caching based on the environment can be provided.
* `site_status_should_suggest_persistent_object_cache` is a short-circuit filter which allows using entirely custom logic to determine whether a persistent object cache would make sense for the site.
* `site_status_persistent_object_cache_thresholds` filters the thresholds in the default logic to determine whether a persistent object cache would make sense for the site, which is based on the amount of data in the database.
Note that due to the nature of this check it is only run in production environments.
Props furi3r, tillkruss, spacedmonkey, audrasjb, Clorith.
Fixes #56040.
Built from https://develop.svn.wordpress.org/trunk@53955
git-svn-id: http://core.svn.wordpress.org/trunk@53514 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-29 12:54:12 -04:00
if ( 'production' === wp_get_environment_type () ) {
2022-08-31 18:46:11 -04:00
$tests [ 'async' ][ 'page_cache' ] = array (
'label' => __ ( 'Page cache' ),
'test' => rest_url ( 'wp-site-health/v1/tests/page-cache' ),
'has_rest' => true ,
'async_direct_test' => array ( WP_Site_Health :: get_instance (), 'get_test_page_cache' ),
);
Site Health: Introduce persistent object cache check.
This changeset adds a new `persistent_object_cache` check which determines whether the site uses a persistent object cache, and if not, recommends it if it is beneficial for the site. A support resource to learn more about object caching has been created and is linked in the check.
A few filters are included for customization of the check, aimed primarily at hosting providers to provide more specific information in regards to their environment:
* `site_status_persistent_object_cache_url` filters the URL to learn more about object caching, so that e.g. a hosting-specific object caching support resource could be linked.
* `site_status_persistent_object_cache_notes` filters the notes added to the check description, so that more fine tuned information on object caching based on the environment can be provided.
* `site_status_should_suggest_persistent_object_cache` is a short-circuit filter which allows using entirely custom logic to determine whether a persistent object cache would make sense for the site.
* `site_status_persistent_object_cache_thresholds` filters the thresholds in the default logic to determine whether a persistent object cache would make sense for the site, which is based on the amount of data in the database.
Note that due to the nature of this check it is only run in production environments.
Props furi3r, tillkruss, spacedmonkey, audrasjb, Clorith.
Fixes #56040.
Built from https://develop.svn.wordpress.org/trunk@53955
git-svn-id: http://core.svn.wordpress.org/trunk@53514 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-29 12:54:12 -04:00
$tests [ 'direct' ][ 'persistent_object_cache' ] = array (
'label' => __ ( 'Persistent object cache' ),
'test' => 'persistent_object_cache' ,
);
}
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
/**
2019-04-17 10:35:50 -04:00
* Add or modify which site status tests are run on a site .
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
*
* The site health is determined by a set of tests based on best practices from
2021-07-01 16:37:57 -04:00
* both the WordPress Hosting Team and web standards in general .
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
*
* Some sites may not have the same requirements , for example the automatic update
* checks may be handled by a host , and are therefore disabled in core .
* Or maybe you want to introduce a new test , is caching enabled / disabled / stale for example .
*
2019-04-17 10:35:50 -04:00
* Tests may be added either as direct , or asynchronous ones . Any test that may require some time
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
* to complete should run asynchronously , to avoid extended loading periods within wp - admin .
*
* @ since 5.2 . 0
2021-07-01 16:37:57 -04:00
* @ since 5.6 . 0 Added the `async_direct_test` array key for asynchronous tests .
* Added the `skip_cron` array key for all tests .
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
*
2021-07-01 16:37:57 -04:00
* @ param array [] $tests {
* An associative array of direct and asynchronous tests .
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
*
2021-07-01 16:37:57 -04:00
* @ type array [] $direct {
* An array of direct tests .
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
*
2021-07-01 16:37:57 -04:00
* @ type array ... $identifier {
* `$identifier` should be a unique identifier for the test . Plugins and themes are encouraged to
* prefix test identifiers with their slug to avoid collisions between tests .
*
* @ type string $label The friendly label to identify the test .
* @ type callable $test The callback function that runs the test and returns its result .
* @ type bool $skip_cron Whether to skip this test when running as cron .
* }
* }
* @ type array [] $async {
* An array of asynchronous tests .
*
* @ type array ... $identifier {
* `$identifier` should be a unique identifier for the test . Plugins and themes are encouraged to
* prefix test identifiers with their slug to avoid collisions between tests .
*
* @ type string $label The friendly label to identify the test .
* @ type string $test An admin - ajax . php action to be called to perform the test , or
* if `$has_rest` is true , a URL to a REST API endpoint to perform
* the test .
* @ type bool $has_rest Whether the `$test` property points to a REST API endpoint .
* @ type bool $skip_cron Whether to skip this test when running as cron .
* @ type callable $async_direct_test A manner of directly calling the test marked as asynchronous ,
* as the scheduled event can not authenticate , and endpoints
* may require authentication .
* }
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
* }
* }
*/
$tests = apply_filters ( 'site_status_tests' , $tests );
2020-08-16 22:03:04 -04:00
// Ensure that the filtered tests contain the required array keys.
$tests = array_merge (
array (
'direct' => array (),
'async' => array (),
),
$tests
);
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
return $tests ;
}
/**
* Add a class to the body HTML tag .
*
* Filters the body class string for admin pages and adds our own class for easier styling .
*
* @ since 5.2 . 0
*
* @ param string $body_class The body class string .
* @ return string The modified body class string .
*/
public function admin_body_class ( $body_class ) {
2020-01-12 08:33:05 -05:00
$screen = get_current_screen ();
if ( 'site-health' !== $screen -> id ) {
return $body_class ;
}
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
$body_class .= ' site-health' ;
return $body_class ;
}
/**
* Initiate the WP_Cron schedule test cases .
*
* @ since 5.2 . 0
*/
private function wp_schedule_test_init () {
$this -> schedules = wp_get_schedules ();
$this -> get_cron_tasks ();
}
/**
* Populate our list of cron events and store them to a class - wide variable .
*
* @ since 5.2 . 0
*/
private function get_cron_tasks () {
$cron_tasks = _get_cron_array ();
if ( empty ( $cron_tasks ) ) {
$this -> crons = new WP_Error ( 'no_tasks' , __ ( 'No scheduled events exist on this site.' ) );
return ;
}
$this -> crons = array ();
foreach ( $cron_tasks as $time => $cron ) {
foreach ( $cron as $hook => $dings ) {
foreach ( $dings as $sig => $data ) {
$this -> crons [ " $hook - $sig - $time " ] = ( object ) array (
'hook' => $hook ,
'time' => $time ,
'sig' => $sig ,
'args' => $data [ 'args' ],
'schedule' => $data [ 'schedule' ],
'interval' => isset ( $data [ 'interval' ] ) ? $data [ 'interval' ] : null ,
);
}
}
}
}
/**
* Check if any scheduled tasks have been missed .
*
2020-06-25 08:43:07 -04:00
* Returns a boolean value of `true` if a scheduled task has been missed and ends processing .
*
2020-06-28 07:53:04 -04:00
* If the list of crons is an instance of WP_Error , returns the instance instead of a boolean value .
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
*
* @ since 5.2 . 0
*
2019-08-14 20:42:55 -04:00
* @ return bool | WP_Error True if a cron was missed , false if not . WP_Error if the cron is set to that .
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
*/
public function has_missed_cron () {
if ( is_wp_error ( $this -> crons ) ) {
return $this -> crons ;
}
foreach ( $this -> crons as $id => $cron ) {
2019-08-14 20:35:55 -04:00
if ( ( $cron -> time - time () ) < $this -> timeout_missed_cron ) {
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
$this -> last_missed_cron = $cron -> hook ;
return true ;
}
}
return false ;
}
2019-08-14 20:35:55 -04:00
/**
* Check if any scheduled tasks are late .
*
2020-06-25 08:43:07 -04:00
* Returns a boolean value of `true` if a scheduled task is late and ends processing .
*
2020-06-28 07:53:04 -04:00
* If the list of crons is an instance of WP_Error , returns the instance instead of a boolean value .
2019-08-14 20:35:55 -04:00
*
2019-08-14 20:42:55 -04:00
* @ since 5.3 . 0
*
* @ return bool | WP_Error True if a cron is late , false if not . WP_Error if the cron is set to that .
2019-08-14 20:35:55 -04:00
*/
public function has_late_cron () {
if ( is_wp_error ( $this -> crons ) ) {
return $this -> crons ;
}
foreach ( $this -> crons as $id => $cron ) {
$cron_offset = $cron -> time - time ();
if (
2020-07-21 20:15:02 -04:00
$cron_offset >= $this -> timeout_missed_cron &&
$cron_offset < $this -> timeout_late_cron
) {
2019-08-14 20:35:55 -04:00
$this -> last_late_cron = $cron -> hook ;
return true ;
}
}
return false ;
}
2020-07-21 13:07:05 -04:00
/**
* Check for potential issues with plugin and theme auto - updates .
*
* Though there is no way to 100 % determine if plugin and theme auto - updates are configured
* correctly , a few educated guesses could be made to flag any conditions that would
* potentially cause unexpected behaviors .
*
* @ since 5.5 . 0
*
* @ return object The test results .
*/
2021-10-18 13:52:58 -04:00
public function detect_plugin_theme_auto_update_issues () {
2020-07-23 15:03:04 -04:00
$mock_plugin = ( object ) array (
'id' => 'w.org/plugins/a-fake-plugin' ,
'slug' => 'a-fake-plugin' ,
'plugin' => 'a-fake-plugin/a-fake-plugin.php' ,
'new_version' => '9.9' ,
2020-07-23 16:13:05 -04:00
'url' => 'https://wordpress.org/plugins/a-fake-plugin/' ,
2020-07-23 15:03:04 -04:00
'package' => 'https://downloads.wordpress.org/plugin/a-fake-plugin.9.9.zip' ,
'icons' => array (
'2x' => 'https://ps.w.org/a-fake-plugin/assets/icon-256x256.png' ,
'1x' => 'https://ps.w.org/a-fake-plugin/assets/icon-128x128.png' ,
),
'banners' => array (
'2x' => 'https://ps.w.org/a-fake-plugin/assets/banner-1544x500.png' ,
'1x' => 'https://ps.w.org/a-fake-plugin/assets/banner-772x250.png' ,
),
'banners_rtl' => array (),
2020-07-23 16:13:05 -04:00
'tested' => '5.5.0' ,
2020-07-23 15:03:04 -04:00
'requires_php' => '5.6.20' ,
'compatibility' => new stdClass (),
);
$mock_theme = ( object ) array (
'theme' => 'a-fake-theme' ,
'new_version' => '9.9' ,
'url' => 'https://wordpress.org/themes/a-fake-theme/' ,
'package' => 'https://downloads.wordpress.org/theme/a-fake-theme.9.9.zip' ,
'requires' => '5.0.0' ,
'requires_php' => '5.6.20' ,
);
2020-10-20 13:39:07 -04:00
$test_plugins_enabled = wp_is_auto_update_forced_for_item ( 'plugin' , true , $mock_plugin );
$test_themes_enabled = wp_is_auto_update_forced_for_item ( 'theme' , true , $mock_theme );
2020-08-07 12:14:03 -04:00
2020-07-21 13:07:05 -04:00
$ui_enabled_for_plugins = wp_is_auto_update_enabled_for_type ( 'plugin' );
$ui_enabled_for_themes = wp_is_auto_update_enabled_for_type ( 'theme' );
$plugin_filter_present = has_filter ( 'auto_update_plugin' );
$theme_filter_present = has_filter ( 'auto_update_theme' );
2020-07-21 20:15:02 -04:00
if ( ( ! $test_plugins_enabled && $ui_enabled_for_plugins )
|| ( ! $test_themes_enabled && $ui_enabled_for_themes )
) {
2020-07-21 13:07:05 -04:00
return ( object ) array (
'status' => 'critical' ,
'message' => __ ( 'Auto-updates for plugins and/or themes appear to be disabled, but settings are still set to be displayed. This could cause auto-updates to not work as expected.' ),
);
}
2020-07-21 20:15:02 -04:00
if ( ( ! $test_plugins_enabled && $plugin_filter_present )
&& ( ! $test_themes_enabled && $theme_filter_present )
) {
2020-07-21 13:07:05 -04:00
return ( object ) array (
'status' => 'recommended' ,
2020-07-21 20:17:04 -04:00
'message' => __ ( 'Auto-updates for plugins and themes appear to be disabled. This will prevent your site from receiving new versions automatically when available.' ),
2020-07-21 13:07:05 -04:00
);
} elseif ( ! $test_plugins_enabled && $plugin_filter_present ) {
return ( object ) array (
'status' => 'recommended' ,
2020-07-21 20:17:04 -04:00
'message' => __ ( 'Auto-updates for plugins appear to be disabled. This will prevent your site from receiving new versions automatically when available.' ),
2020-07-21 13:07:05 -04:00
);
} elseif ( ! $test_themes_enabled && $theme_filter_present ) {
return ( object ) array (
'status' => 'recommended' ,
2020-07-21 20:17:04 -04:00
'message' => __ ( 'Auto-updates for themes appear to be disabled. This will prevent your site from receiving new versions automatically when available.' ),
2020-07-21 13:07:05 -04:00
);
}
return ( object ) array (
'status' => 'good' ,
2020-07-21 20:17:04 -04:00
'message' => __ ( 'There appear to be no issues with plugin and theme auto-updates.' ),
2020-07-21 13:07:05 -04:00
);
}
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
/**
* Run a loopback test on our site .
*
2019-04-01 16:30:52 -04:00
* Loopbacks are what WordPress uses to communicate with itself to start up WP_Cron , scheduled posts ,
* make sure plugin or theme edits don ' t cause site failures and similar .
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
*
* @ since 5.2 . 0
*
* @ return object The test results .
*/
2021-10-18 13:52:58 -04:00
public function can_perform_loopback () {
2021-02-21 19:51:09 -05:00
$body = array ( 'site-health' => 'loopback-test' );
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
$cookies = wp_unslash ( $_COOKIE );
$timeout = 10 ;
$headers = array (
'Cache-Control' => 'no-cache' ,
);
2019-09-21 12:06:57 -04:00
/** This filter is documented in wp-includes/class-wp-http-streams.php */
$sslverify = apply_filters ( 'https_local_ssl_verify' , false );
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
// Include Basic auth in loopback requests.
if ( isset ( $_SERVER [ 'PHP_AUTH_USER' ] ) && isset ( $_SERVER [ 'PHP_AUTH_PW' ] ) ) {
$headers [ 'Authorization' ] = 'Basic ' . base64_encode ( wp_unslash ( $_SERVER [ 'PHP_AUTH_USER' ] ) . ':' . wp_unslash ( $_SERVER [ 'PHP_AUTH_PW' ] ) );
}
2021-02-21 19:51:09 -05:00
$url = site_url ( 'wp-cron.php' );
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
2021-02-21 19:51:09 -05:00
/*
* A post request is used for the wp - cron . php loopback test to cause the file
* to finish early without triggering cron jobs . This has two benefits :
* - cron jobs are not triggered a second time on the site health page ,
* - the loopback request finishes sooner providing a quicker result .
*
* Using a POST request causes the loopback to differ slightly to the standard
* GET request WordPress uses for wp - cron . php loopback requests but is close
* enough . See https :// core . trac . wordpress . org / ticket / 52547
*/
$r = wp_remote_post ( $url , compact ( 'body' , 'cookies' , 'headers' , 'timeout' , 'sslverify' ) );
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
if ( is_wp_error ( $r ) ) {
return ( object ) array (
'status' => 'critical' ,
'message' => sprintf (
'%s<br>%s' ,
__ ( 'The loopback request to your site failed, this means features relying on them are not currently working as expected.' ),
sprintf (
2020-02-18 11:48:06 -05:00
/* translators: 1: The WordPress error message. 2: The WordPress error code. */
__ ( 'Error: %1$s (%2$s)' ),
$r -> get_error_message (),
$r -> get_error_code ()
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
)
),
);
}
if ( 200 !== wp_remote_retrieve_response_code ( $r ) ) {
return ( object ) array (
'status' => 'recommended' ,
'message' => sprintf (
2019-09-02 20:41:05 -04:00
/* translators: %d: The HTTP response code returned. */
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
__ ( 'The loopback request returned an unexpected http status code, %d, it was not possible to determine if this will prevent features from working as expected.' ),
wp_remote_retrieve_response_code ( $r )
),
);
}
return ( object ) array (
'status' => 'good' ,
'message' => __ ( 'The loopback request to your site completed successfully.' ),
);
}
2020-01-12 08:33:05 -05:00
/**
* Create a weekly cron event , if one does not already exist .
*
* @ since 5.4 . 0
*/
public function maybe_create_scheduled_event () {
if ( ! wp_next_scheduled ( 'wp_site_health_scheduled_check' ) && ! wp_installing () ) {
2020-03-14 12:36:07 -04:00
wp_schedule_event ( time () + DAY_IN_SECONDS , 'weekly' , 'wp_site_health_scheduled_check' );
2020-01-12 08:33:05 -05:00
}
}
/**
* Run our scheduled event to check and update the latest site health status for the website .
*
* @ since 5.4 . 0
*/
public function wp_cron_scheduled_check () {
// Bootstrap wp-admin, as WP_Cron doesn't do this for us.
2020-02-06 01:33:11 -05:00
require_once trailingslashit ( ABSPATH ) . 'wp-admin/includes/admin.php' ;
2020-01-12 08:33:05 -05:00
$tests = WP_Site_Health :: get_tests ();
$results = array ();
$site_status = array (
'good' => 0 ,
'recommended' => 0 ,
'critical' => 0 ,
);
2020-10-20 12:23:07 -04:00
// Don't run https test on development environments.
if ( $this -> is_development_environment () ) {
2021-01-29 14:10:58 -05:00
unset ( $tests [ 'async' ][ 'https_status' ] );
2020-01-12 08:33:05 -05:00
}
foreach ( $tests [ 'direct' ] as $test ) {
2021-05-20 07:09:56 -04:00
if ( ! empty ( $test [ 'skip_cron' ] ) ) {
continue ;
}
2020-01-12 08:33:05 -05:00
if ( is_string ( $test [ 'test' ] ) ) {
$test_function = sprintf (
'get_test_%s' ,
$test [ 'test' ]
);
if ( method_exists ( $this , $test_function ) && is_callable ( array ( $this , $test_function ) ) ) {
$results [] = $this -> perform_test ( array ( $this , $test_function ) );
continue ;
}
}
if ( is_callable ( $test [ 'test' ] ) ) {
$results [] = $this -> perform_test ( $test [ 'test' ] );
}
}
foreach ( $tests [ 'async' ] as $test ) {
2020-10-27 14:32:07 -04:00
if ( ! empty ( $test [ 'skip_cron' ] ) ) {
continue ;
}
2020-10-20 10:50:06 -04:00
// Local endpoints may require authentication, so asynchronous tests can pass a direct test runner as well.
if ( ! empty ( $test [ 'async_direct_test' ] ) && is_callable ( $test [ 'async_direct_test' ] ) ) {
// This test is callable, do so and continue to the next asynchronous check.
$results [] = $this -> perform_test ( $test [ 'async_direct_test' ] );
continue ;
}
2020-01-12 08:33:05 -05:00
if ( is_string ( $test [ 'test' ] ) ) {
2020-10-20 10:50:06 -04:00
// Check if this test has a REST API endpoint.
2020-01-12 08:33:05 -05:00
if ( isset ( $test [ 'has_rest' ] ) && $test [ 'has_rest' ] ) {
2020-10-20 10:50:06 -04:00
$result_fetch = wp_remote_get (
$test [ 'test' ],
2020-01-12 08:33:05 -05:00
array (
'body' => array (
'_wpnonce' => wp_create_nonce ( 'wp_rest' ),
),
)
);
} else {
$result_fetch = wp_remote_post (
admin_url ( 'admin-ajax.php' ),
array (
'body' => array (
'action' => $test [ 'test' ],
'_wpnonce' => wp_create_nonce ( 'health-check-site-status' ),
),
)
);
}
2020-10-20 10:50:06 -04:00
if ( ! is_wp_error ( $result_fetch ) && 200 === wp_remote_retrieve_response_code ( $result_fetch ) ) {
2020-04-27 18:01:08 -04:00
$result = json_decode ( wp_remote_retrieve_body ( $result_fetch ), true );
} else {
$result = false ;
}
if ( is_array ( $result ) ) {
$results [] = $result ;
2020-01-12 08:33:05 -05:00
} else {
$results [] = array (
'status' => 'recommended' ,
'label' => __ ( 'A test is unavailable' ),
);
}
}
}
foreach ( $results as $result ) {
if ( 'critical' === $result [ 'status' ] ) {
$site_status [ 'critical' ] ++ ;
} elseif ( 'recommended' === $result [ 'status' ] ) {
$site_status [ 'recommended' ] ++ ;
} else {
$site_status [ 'good' ] ++ ;
}
}
set_transient ( 'health-check-site-status-result' , wp_json_encode ( $site_status ) );
}
2020-10-20 12:23:07 -04:00
/**
* Checks if the current environment type is set to 'development' or 'local' .
*
* @ since 5.6 . 0
*
* @ return bool True if it is a development environment , false if not .
*/
public function is_development_environment () {
return in_array ( wp_get_environment_type (), array ( 'development' , 'local' ), true );
}
2022-08-31 18:46:11 -04:00
/**
* Returns a list of headers and its verification callback to verify if page cache is enabled or not .
*
* Note : key is header name and value could be callable function to verify header value .
* Empty value mean existence of header detect page cache is enabled .
*
* @ since 6.1 . 0
*
* @ return array List of client caching headers and their ( optional ) verification callbacks .
*/
public function get_page_cache_headers () {
$cache_hit_callback = static function ( $header_value ) {
return false !== strpos ( strtolower ( $header_value ), 'hit' );
};
$cache_headers = array (
'cache-control' => static function ( $header_value ) {
return ( bool ) preg_match ( '/max-age=[1-9]/' , $header_value );
},
'expires' => static function ( $header_value ) {
return strtotime ( $header_value ) > time ();
},
'age' => static function ( $header_value ) {
return is_numeric ( $header_value ) && $header_value > 0 ;
},
'last-modified' => '' ,
'etag' => '' ,
'x-cache-enabled' => static function ( $header_value ) {
return 'true' === strtolower ( $header_value );
},
'x-cache-disabled' => static function ( $header_value ) {
return ( 'on' !== strtolower ( $header_value ) );
},
'x-srcache-store-status' => $cache_hit_callback ,
'x-srcache-fetch-status' => $cache_hit_callback ,
);
/**
* Filters the list of cache headers supported by core .
*
* @ since 6.1 . 0
*
* @ param int $cache_headers Array of supported cache headers .
*/
return apply_filters ( 'site_status_page_cache_supported_cache_headers' , $cache_headers );
}
/**
* Checks if site has page cache enabled or not .
*
* @ since 6.1 . 0
*
* @ return WP_Error | array {
* Page cache detection details or else error information .
*
* @ type bool $advanced_cache_present Whether a page cache plugin is present .
* @ type array [] $page_caching_response_headers Sets of client caching headers for the responses .
* @ type float [] $response_timing Response timings .
* }
*/
private function check_for_page_caching () {
/** This filter is documented in wp-includes/class-wp-http-streams.php */
$sslverify = apply_filters ( 'https_local_ssl_verify' , false );
$headers = array ();
// Include basic auth in loopback requests. Note that this will only pass along basic auth when user is
// initiating the test. If a site requires basic auth, the test will fail when it runs in WP Cron as part of
// wp_site_health_scheduled_check. This logic is copied from WP_Site_Health::can_perform_loopback().
if ( isset ( $_SERVER [ 'PHP_AUTH_USER' ] ) && isset ( $_SERVER [ 'PHP_AUTH_PW' ] ) ) {
$headers [ 'Authorization' ] = 'Basic ' . base64_encode ( wp_unslash ( $_SERVER [ 'PHP_AUTH_USER' ] ) . ':' . wp_unslash ( $_SERVER [ 'PHP_AUTH_PW' ] ) );
}
$caching_headers = $this -> get_page_cache_headers ();
$page_caching_response_headers = array ();
$response_timing = array ();
for ( $i = 1 ; $i <= 3 ; $i ++ ) {
$start_time = microtime ( true );
$http_response = wp_remote_get ( home_url ( '/' ), compact ( 'sslverify' , 'headers' ) );
$end_time = microtime ( true );
if ( is_wp_error ( $http_response ) ) {
return $http_response ;
}
if ( wp_remote_retrieve_response_code ( $http_response ) !== 200 ) {
return new WP_Error (
'http_' . wp_remote_retrieve_response_code ( $http_response ),
wp_remote_retrieve_response_message ( $http_response )
);
}
$response_headers = array ();
foreach ( $caching_headers as $header => $callback ) {
$header_values = wp_remote_retrieve_header ( $http_response , $header );
if ( empty ( $header_values ) ) {
continue ;
}
$header_values = ( array ) $header_values ;
if ( empty ( $callback ) || ( is_callable ( $callback ) && count ( array_filter ( $header_values , $callback ) ) > 0 ) ) {
$response_headers [ $header ] = $header_values ;
}
}
$page_caching_response_headers [] = $response_headers ;
$response_timing [] = ( $end_time - $start_time ) * 1000 ;
}
return array (
'advanced_cache_present' => (
file_exists ( WP_CONTENT_DIR . '/advanced-cache.php' )
&&
( defined ( 'WP_CACHE' ) && WP_CACHE )
&&
/** This filter is documented in wp-settings.php */
apply_filters ( 'enable_loading_advanced_cache_dropin' , true )
),
'page_caching_response_headers' => $page_caching_response_headers ,
'response_timing' => $response_timing ,
);
}
/**
* Get page cache details .
*
* @ since 6.1 . 0
*
* @ return WP_Error | array {
* Page cache detail or else a WP_Error if unable to determine .
*
* @ type string $status Page cache status . Good , Recommended or Critical .
* @ type bool $advanced_cache_present Whether page cache plugin is available or not .
* @ type string [] $headers Client caching response headers detected .
* @ type float $response_time Response time of site .
* }
*/
private function get_page_cache_detail () {
$page_cache_detail = $this -> check_for_page_caching ();
if ( is_wp_error ( $page_cache_detail ) ) {
return $page_cache_detail ;
}
// Use the median server response time.
$response_timings = $page_cache_detail [ 'response_timing' ];
rsort ( $response_timings );
$page_speed = $response_timings [ floor ( count ( $response_timings ) / 2 ) ];
// Obtain unique set of all client caching response headers.
$headers = array ();
foreach ( $page_cache_detail [ 'page_caching_response_headers' ] as $page_caching_response_headers ) {
$headers = array_merge ( $headers , array_keys ( $page_caching_response_headers ) );
}
$headers = array_unique ( $headers );
// Page cache is detected if there are response headers or a page cache plugin is present.
$has_page_caching = ( count ( $headers ) > 0 || $page_cache_detail [ 'advanced_cache_present' ] );
if ( $page_speed && $page_speed < $this -> get_good_response_time_threshold () ) {
$result = $has_page_caching ? 'good' : 'recommended' ;
} else {
$result = 'critical' ;
}
return array (
'status' => $result ,
'advanced_cache_present' => $page_cache_detail [ 'advanced_cache_present' ],
'headers' => $headers ,
'response_time' => $page_speed ,
);
}
/**
* Get the threshold below which a response time is considered good .
*
* @ since 6.1 . 0
*
* @ return int Threshold in milliseconds .
*/
private function get_good_response_time_threshold () {
/**
* Filters the threshold below which a response time is considered good .
*
* The default is based on https :// web . dev / time - to - first - byte /.
*
* @ param int $threshold Threshold in milliseconds . Default 600.
*
* @ since 6.1 . 0
*/
return ( int ) apply_filters ( 'site_status_good_response_time_threshold' , 600 );
}
Site Health: Introduce persistent object cache check.
This changeset adds a new `persistent_object_cache` check which determines whether the site uses a persistent object cache, and if not, recommends it if it is beneficial for the site. A support resource to learn more about object caching has been created and is linked in the check.
A few filters are included for customization of the check, aimed primarily at hosting providers to provide more specific information in regards to their environment:
* `site_status_persistent_object_cache_url` filters the URL to learn more about object caching, so that e.g. a hosting-specific object caching support resource could be linked.
* `site_status_persistent_object_cache_notes` filters the notes added to the check description, so that more fine tuned information on object caching based on the environment can be provided.
* `site_status_should_suggest_persistent_object_cache` is a short-circuit filter which allows using entirely custom logic to determine whether a persistent object cache would make sense for the site.
* `site_status_persistent_object_cache_thresholds` filters the thresholds in the default logic to determine whether a persistent object cache would make sense for the site, which is based on the amount of data in the database.
Note that due to the nature of this check it is only run in production environments.
Props furi3r, tillkruss, spacedmonkey, audrasjb, Clorith.
Fixes #56040.
Built from https://develop.svn.wordpress.org/trunk@53955
git-svn-id: http://core.svn.wordpress.org/trunk@53514 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-29 12:54:12 -04:00
/**
* Determines whether to suggest using a persistent object cache .
*
* @ since 6.1 . 0
*
* @ global wpdb $wpdb WordPress database abstraction object .
*
* @ return bool Whether to suggest using a persistent object cache .
*/
public function should_suggest_persistent_object_cache () {
global $wpdb ;
/**
* Filters whether to suggest use of a persistent object cache and bypass default threshold checks .
*
* Using this filter allows to override the default logic , effectively short - circuiting the method .
*
* @ since 6.1 . 0
*
* @ param bool | null $suggest Boolean to short - circuit , for whether to suggest using a persistent object cache .
* Default null .
*/
$short_circuit = apply_filters ( 'site_status_should_suggest_persistent_object_cache' , null );
if ( is_bool ( $short_circuit ) ) {
return $short_circuit ;
}
2022-09-01 13:47:09 -04:00
if ( is_multisite () ) {
return true ;
}
Site Health: Introduce persistent object cache check.
This changeset adds a new `persistent_object_cache` check which determines whether the site uses a persistent object cache, and if not, recommends it if it is beneficial for the site. A support resource to learn more about object caching has been created and is linked in the check.
A few filters are included for customization of the check, aimed primarily at hosting providers to provide more specific information in regards to their environment:
* `site_status_persistent_object_cache_url` filters the URL to learn more about object caching, so that e.g. a hosting-specific object caching support resource could be linked.
* `site_status_persistent_object_cache_notes` filters the notes added to the check description, so that more fine tuned information on object caching based on the environment can be provided.
* `site_status_should_suggest_persistent_object_cache` is a short-circuit filter which allows using entirely custom logic to determine whether a persistent object cache would make sense for the site.
* `site_status_persistent_object_cache_thresholds` filters the thresholds in the default logic to determine whether a persistent object cache would make sense for the site, which is based on the amount of data in the database.
Note that due to the nature of this check it is only run in production environments.
Props furi3r, tillkruss, spacedmonkey, audrasjb, Clorith.
Fixes #56040.
Built from https://develop.svn.wordpress.org/trunk@53955
git-svn-id: http://core.svn.wordpress.org/trunk@53514 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-29 12:54:12 -04:00
/**
* Filters the thresholds used to determine whether to suggest the use of a persistent object cache .
*
* @ since 6.1 . 0
*
* @ param array $thresholds The list of threshold names and numbers .
*/
$thresholds = apply_filters (
'site_status_persistent_object_cache_thresholds' ,
array (
'alloptions_count' => 500 ,
'alloptions_bytes' => 100000 ,
'comments_count' => 1000 ,
'options_count' => 1000 ,
'posts_count' => 1000 ,
'terms_count' => 1000 ,
'users_count' => 1000 ,
)
);
$alloptions = wp_load_alloptions ();
if ( $thresholds [ 'alloptions_count' ] < count ( $alloptions ) ) {
return true ;
}
if ( $thresholds [ 'alloptions_bytes' ] < strlen ( serialize ( $alloptions ) ) ) {
return true ;
}
$table_names = implode ( " ',' " , array ( $wpdb -> comments , $wpdb -> options , $wpdb -> posts , $wpdb -> terms , $wpdb -> users ) );
// With InnoDB the `TABLE_ROWS` are estimates, which are accurate enough and faster to retrieve than individual `COUNT()` queries.
$results = $wpdb -> get_results (
$wpdb -> prepare (
// phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- This query cannot use interpolation.
" SELECT TABLE_NAME AS 'table', TABLE_ROWS AS 'rows', SUM(data_length + index_length) as 'bytes' FROM information_schema.TABLES WHERE TABLE_SCHEMA = %s AND TABLE_NAME IN (' $table_names ') GROUP BY TABLE_NAME; " ,
DB_NAME
),
OBJECT_K
);
$threshold_map = array (
'comments_count' => $wpdb -> comments ,
'options_count' => $wpdb -> options ,
'posts_count' => $wpdb -> posts ,
'terms_count' => $wpdb -> terms ,
'users_count' => $wpdb -> users ,
);
foreach ( $threshold_map as $threshold => $table ) {
if ( $thresholds [ $threshold ] <= $results [ $table ] -> rows ) {
return true ;
}
}
return false ;
}
/**
* Returns a list of available persistent object cache services .
*
* @ since 6.1 . 0
*
* @ return array The list of available persistent object cache services .
*/
private function available_object_cache_services () {
$extensions = array_map (
'extension_loaded' ,
array (
'APCu' => 'apcu' ,
'Redis' => 'redis' ,
'Relay' => 'relay' ,
'Memcache' => 'memcache' ,
'Memcached' => 'memcached' ,
)
);
$services = array_keys ( array_filter ( $extensions ) );
/**
* Filters the persistent object cache services available to the user .
*
* This can be useful to hide or add services not included in the defaults .
*
* @ since 6.1 . 0
*
* @ param array $services The list of available persistent object cache services .
*/
return apply_filters ( 'site_status_available_object_cache_services' , $services );
}
Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.
By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.
Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 23:55:53 -04:00
}