Site Health: Rename WP_Site_Health::initialize() introduced in [47063] to ::get_instance(), for clarity and consistency with other core classes.

Use `WP_Site_Health::get_instance()` where it's needed, instead of creating multiple instances of the class.

Props afercia, xkon, Clorith, SergeyBiryukov.
See #47606.
Built from https://develop.svn.wordpress.org/trunk@47149


git-svn-id: http://core.svn.wordpress.org/trunk@46949 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2020-02-01 00:39:09 +00:00
parent 3cd1514b91
commit 0aff1cf6bd
7 changed files with 10 additions and 10 deletions

View File

@ -5122,7 +5122,7 @@ function wp_ajax_health_check_dotorg_communication() {
require_once( ABSPATH . 'wp-admin/includes/class-wp-site-health.php' );
}
$site_health = new WP_Site_Health();
$site_health = WP_Site_Health::get_instance();
wp_send_json_success( $site_health->get_test_dotorg_communication() );
}
@ -5142,7 +5142,7 @@ function wp_ajax_health_check_is_in_debug_mode() {
require_once( ABSPATH . 'wp-admin/includes/class-wp-site-health.php' );
}
$site_health = new WP_Site_Health();
$site_health = WP_Site_Health::get_instance();
wp_send_json_success( $site_health->get_test_is_in_debug_mode() );
}
@ -5162,7 +5162,7 @@ function wp_ajax_health_check_background_updates() {
require_once( ABSPATH . 'wp-admin/includes/class-wp-site-health.php' );
}
$site_health = new WP_Site_Health();
$site_health = WP_Site_Health::get_instance();
wp_send_json_success( $site_health->get_test_background_updates() );
}
@ -5183,7 +5183,7 @@ function wp_ajax_health_check_loopback_requests() {
require_once( ABSPATH . 'wp-admin/includes/class-wp-site-health.php' );
}
$site_health = new WP_Site_Health();
$site_health = WP_Site_Health::get_instance();
wp_send_json_success( $site_health->get_test_loopback_requests() );
}

View File

@ -56,7 +56,7 @@ class WP_Site_Health {
*
* @return WP_Site_Health|null
*/
public static function initialize() {
public static function get_instance() {
if ( null === self::$instance ) {
self::$instance = new WP_Site_Health();
}

View File

@ -48,7 +48,7 @@ function wp_dashboard_setup() {
require_once( ABSPATH . 'wp-admin/includes/class-wp-site-health.php' );
}
WP_Site_Health::initialize();
WP_Site_Health::get_instance();
wp_enqueue_style( 'site-health' );
wp_enqueue_script( 'site-health' );

View File

@ -25,7 +25,7 @@ if ( ! class_exists( 'WP_Site_Health' ) ) {
require_once( ABSPATH . 'wp-admin/includes/class-wp-site-health.php' );
}
$health_check_site_status = new WP_Site_Health();
$health_check_site_status = WP_Site_Health::get_instance();
require_once( ABSPATH . 'wp-admin/admin-header.php' );
?>

View File

@ -27,7 +27,7 @@ if ( ! class_exists( 'WP_Site_Health' ) ) {
require_once( ABSPATH . 'wp-admin/includes/class-wp-site-health.php' );
}
$health_check_site_status = new WP_Site_Health();
$health_check_site_status = WP_Site_Health::get_instance();
// Start by checking if this is a special request checking for the existence of certain filters.
$health_check_site_status->check_wp_version_check_exists();

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.4-alpha-47148';
$wp_version = '5.4-alpha-47149';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.

View File

@ -355,7 +355,7 @@ if ( ! is_multisite() ) {
if ( ! class_exists( 'WP_Site_Health' ) ) {
require_once( ABSPATH . 'wp-admin/includes/class-wp-site-health.php' );
}
WP_Site_Health::initialize();
WP_Site_Health::get_instance();
// Load active plugins.
foreach ( wp_get_active_and_valid_plugins() as $plugin ) {