Make WordPress Core

Ticket #47085: 47085.diff

File 47085.diff, 4.8 KB (added by donmhico, 2 years ago)
  • src/wp-admin/includes/class-wp-site-health.php

    diff --git src/wp-admin/includes/class-wp-site-health.php src/wp-admin/includes/class-wp-site-health.php
    index 01f97959c5..a1e8bdfa4e 100644
    class WP_Site_Health { 
    5151         */
    5252        public function enqueue_scripts() {
    5353                $screen = get_current_screen();
    54                 if ( 'site-health' !== $screen->id ) {
     54                if ( 'site-health' !== $screen->id && 'site-health-network' !== $screen->id ) {
    5555                        return;
    5656                }
    5757
    class WP_Site_Health { 
    8080                        $health_check_js_variables['site_status']['issues'] = $issue_counts;
    8181                }
    8282
    83                 if ( 'site-health' === $screen->id && ! isset( $_GET['tab'] ) ) {
     83                if ( ( 'site-health' === $screen->id || 'site-health-network' === $screen->id )
     84                        && ! isset( $_GET['tab'] ) ) {
    8485                        $tests = WP_Site_Health::get_tests();
    8586
    8687                        // Don't run https test on localhost
  • src/wp-admin/menu.php

    diff --git src/wp-admin/menu.php src/wp-admin/menu.php
    index 96c4c2a9c4..24b08e6633 100644
    $menu[75] = array( __( 'Tools' ), 'edit_posts', 'tools.php', 
    263263        $submenu['tools.php'][5]  = array( __( 'Available Tools' ), 'edit_posts', 'tools.php' );
    264264        $submenu['tools.php'][10] = array( __( 'Import' ), 'import', 'import.php' );
    265265        $submenu['tools.php'][15] = array( __( 'Export' ), 'export', 'export.php' );
    266         $submenu['tools.php'][20] = array( __( 'Site Health' ), 'view_site_health_checks', 'site-health.php' );
     266        // Hide Site Health in individual sites.
     267        if ( ! is_multisite() ) {
     268                $submenu['tools.php'][20] = array( __( 'Site Health' ), 'view_site_health_checks', 'site-health.php' );
     269        }
    267270        $submenu['tools.php'][25] = array( __( 'Export Personal Data' ), 'export_others_personal_data', 'export-personal-data.php' );
    268271        $submenu['tools.php'][30] = array( __( 'Erase Personal Data' ), 'erase_others_personal_data', 'erase-personal-data.php' );
    269272if ( is_multisite() && ! is_main_site() ) {
  • src/wp-admin/network/menu.php

    diff --git src/wp-admin/network/menu.php src/wp-admin/network/menu.php
    index dbd77fd763..61ad0edcd2 100644
    if ( defined( 'MULTISITE' ) && defined( 'WP_ALLOW_MULTISITE' ) && WP_ALLOW_MULTI 
    6767        $submenu['settings.php'][5]  = array( __( 'Network Settings' ), 'manage_network_options', 'settings.php' );
    6868        $submenu['settings.php'][10] = array( __( 'Network Setup' ), 'setup_network', 'setup.php' );
    6969}
     70
     71$menu[30] = array( __( 'Site Health' ), 'view_site_health_checks', 'site-health.php', '', 'menu-top menu-icon-site-health', 'menu-site-health', 'dashicons-heart' );
     72
    7073unset( $update_data );
    7174
    7275$menu[99] = array( '', 'exist', 'separator-last', '', 'wp-menu-separator' );
  • new file src/wp-admin/network/site-health.php

    diff --git src/wp-admin/network/site-health.php src/wp-admin/network/site-health.php
    new file mode 100644
    index 0000000000..ad0ecbfe4a
    - +  
     1<?php
     2/**
     3 * Network Site Health administration panel.
     4 *
     5 * @package WordPress
     6 * @subpackage Multisite
     7 * @since 5.3.0
     8 */
     9
     10/** Load WordPress Administration Bootstrap */
     11require_once( dirname( __FILE__ ) . '/admin.php' );
     12
     13require( ABSPATH . 'wp-admin/site-health.php' );
  • src/wp-admin/site-health.php

    diff --git src/wp-admin/site-health.php src/wp-admin/site-health.php
    index 5f19ebee0d..431b70cb3e 100644
    require_once( ABSPATH . 'wp-admin/admin-header.php' ); 
    5151        </div>
    5252
    5353        <nav class="health-check-tabs-wrapper hide-if-no-js" aria-label="<?php esc_attr_e( 'Secondary menu' ); ?>">
    54                 <a href="<?php echo esc_url( admin_url( 'site-health.php' ) ); ?>" class="health-check-tab active" aria-current="true">
     54                <a href="<?php echo esc_url( network_admin_url( 'site-health.php' ) ); ?>" class="health-check-tab active" aria-current="true">
    5555                        <?php
    5656                        /* translators: tab heading for Site Health Status page */
    5757                        _ex( 'Status', 'Site Health' );
    5858                        ?>
    5959                </a>
    6060
    61                 <a href="<?php echo esc_url( admin_url( 'site-health.php?tab=debug' ) ); ?>" class="health-check-tab">
     61                <a href="<?php echo esc_url( network_admin_url( 'site-health.php?tab=debug' ) ); ?>" class="health-check-tab">
    6262                        <?php
    6363                        /* translators: tab heading for Site Health Info page */
    6464                        _ex( 'Info', 'Site Health' );
  • src/wp-includes/admin-bar.php

    diff --git src/wp-includes/admin-bar.php src/wp-includes/admin-bar.php
    index d444da4a51..64e8b2ae89 100644
    function wp_admin_bar_my_sites_menu( $wp_admin_bar ) { 
    553553                                )
    554554                        );
    555555                }
     556
     557                if ( current_user_can( 'view_site_health_checks' ) ) {
     558                        $wp_admin_bar->add_menu(
     559                                array(
     560                                        'parent' => 'network-admin',
     561                                        'id'     => 'network-admin-sh',
     562                                        'title'  => __( 'Site Health' ),
     563                                        'href'   => network_admin_url( 'site-health.php' ),
     564                                )
     565                        );
     566                }
     567
    556568        }
    557569
    558570        // Add site links