WordPress.org

Make WordPress Core

Changeset 47149


Ignore:
Timestamp:
02/01/2020 12:37:14 AM (5 months ago)
Author:
SergeyBiryukov
Message:

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.

Location:
trunk/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/ajax-actions.php

    r47122 r47149  
    51235123    }
    51245124
    5125     $site_health = new WP_Site_Health();
     5125    $site_health = WP_Site_Health::get_instance();
    51265126    wp_send_json_success( $site_health->get_test_dotorg_communication() );
    51275127}
     
    51435143    }
    51445144
    5145     $site_health = new WP_Site_Health();
     5145    $site_health = WP_Site_Health::get_instance();
    51465146    wp_send_json_success( $site_health->get_test_is_in_debug_mode() );
    51475147}
     
    51635163    }
    51645164
    5165     $site_health = new WP_Site_Health();
     5165    $site_health = WP_Site_Health::get_instance();
    51665166    wp_send_json_success( $site_health->get_test_background_updates() );
    51675167}
     
    51845184    }
    51855185
    5186     $site_health = new WP_Site_Health();
     5186    $site_health = WP_Site_Health::get_instance();
    51875187    wp_send_json_success( $site_health->get_test_loopback_requests() );
    51885188}
  • trunk/src/wp-admin/includes/class-wp-site-health.php

    r47122 r47149  
    5757     * @return WP_Site_Health|null
    5858     */
    59     public static function initialize() {
     59    public static function get_instance() {
    6060        if ( null === self::$instance ) {
    6161            self::$instance = new WP_Site_Health();
  • trunk/src/wp-admin/includes/dashboard.php

    r47122 r47149  
    4949        }
    5050
    51         WP_Site_Health::initialize();
     51        WP_Site_Health::get_instance();
    5252
    5353        wp_enqueue_style( 'site-health' );
  • trunk/src/wp-admin/site-health-info.php

    r46586 r47149  
    2626}
    2727
    28 $health_check_site_status = new WP_Site_Health();
     28$health_check_site_status = WP_Site_Health::get_instance();
    2929
    3030require_once( ABSPATH . 'wp-admin/admin-header.php' );
  • trunk/src/wp-admin/site-health.php

    r46586 r47149  
    2828}
    2929
    30 $health_check_site_status = new WP_Site_Health();
     30$health_check_site_status = WP_Site_Health::get_instance();
    3131
    3232// Start by checking if this is a special request checking for the existence of certain filters.
  • trunk/src/wp-settings.php

    r47122 r47149  
    356356    require_once( ABSPATH . 'wp-admin/includes/class-wp-site-health.php' );
    357357}
    358 WP_Site_Health::initialize();
     358WP_Site_Health::get_instance();
    359359
    360360// Load active plugins.
Note: See TracChangeset for help on using the changeset viewer.