From 0aff1cf6bd2e4430f593501d5def73903e20faf2 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sat, 1 Feb 2020 00:39:09 +0000 Subject: [PATCH] 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 --- wp-admin/includes/ajax-actions.php | 8 ++++---- wp-admin/includes/class-wp-site-health.php | 2 +- wp-admin/includes/dashboard.php | 2 +- wp-admin/site-health-info.php | 2 +- wp-admin/site-health.php | 2 +- wp-includes/version.php | 2 +- wp-settings.php | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/wp-admin/includes/ajax-actions.php b/wp-admin/includes/ajax-actions.php index f230290bb9..6f38d2221c 100644 --- a/wp-admin/includes/ajax-actions.php +++ b/wp-admin/includes/ajax-actions.php @@ -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() ); } diff --git a/wp-admin/includes/class-wp-site-health.php b/wp-admin/includes/class-wp-site-health.php index afb51e4816..8afe9a8aa4 100644 --- a/wp-admin/includes/class-wp-site-health.php +++ b/wp-admin/includes/class-wp-site-health.php @@ -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(); } diff --git a/wp-admin/includes/dashboard.php b/wp-admin/includes/dashboard.php index e4cea79c43..919af94c0b 100644 --- a/wp-admin/includes/dashboard.php +++ b/wp-admin/includes/dashboard.php @@ -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' ); diff --git a/wp-admin/site-health-info.php b/wp-admin/site-health-info.php index 34471a0968..04851a577c 100644 --- a/wp-admin/site-health-info.php +++ b/wp-admin/site-health-info.php @@ -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' ); ?> diff --git a/wp-admin/site-health.php b/wp-admin/site-health.php index 52ff845289..eab04d48c5 100644 --- a/wp-admin/site-health.php +++ b/wp-admin/site-health.php @@ -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(); diff --git a/wp-includes/version.php b/wp-includes/version.php index 9c491baa37..0361ab7bbd 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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. diff --git a/wp-settings.php b/wp-settings.php index efae63bb11..13f9bbb3a5 100644 --- a/wp-settings.php +++ b/wp-settings.php @@ -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 ) {