Make WordPress Core

Ticket #47085: 47085.2.diff

File 47085.2.diff, 6.6 KB (added by donmhico, 5 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..3c60304aa6 100644
    $submenu['plugins.php'][5] = array( __( 'Installed Plugins' ), 'manage_network_ 
    6262$submenu['plugins.php'][10] = array( _x( 'Add New', 'plugin' ), 'install_plugins', 'plugin-install.php' );
    6363$submenu['plugins.php'][15] = array( __( 'Plugin Editor' ), 'edit_plugins', 'plugin-editor.php' );
    6464
     65$menu[24] = array( __( 'Tools' ), 'view_site_health_checks', 'site-health.php', '', 'menu-top menu-icon-tools', 'menu-tools', 'dashicons-admin-tools' );
     66$submenu['site-health.php'][5]  = array( __( 'Site Health' ), 'view_site_health_checks', 'site-health.php' );
     67
    6568$menu[25] = array( __( 'Settings' ), 'manage_network_options', 'settings.php', '', 'menu-top menu-icon-settings', 'menu-settings', 'dashicons-admin-settings' );
    6669if ( defined( 'MULTISITE' ) && defined( 'WP_ALLOW_MULTISITE' ) && WP_ALLOW_MULTISITE ) {
    6770        $submenu['settings.php'][5]  = array( __( 'Network Settings' ), 'manage_network_options', 'settings.php' );
    6871        $submenu['settings.php'][10] = array( __( 'Network Setup' ), 'setup_network', 'setup.php' );
    6972}
     73
    7074unset( $update_data );
    7175
    7276$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-info.php

    diff --git src/wp-admin/site-health-info.php src/wp-admin/site-health-info.php
    index 4a23f15251..75f764a67a 100644
    require_once( ABSPATH . 'wp-admin/admin-header.php' ); 
    4646        </div>
    4747
    4848        <nav class="health-check-tabs-wrapper hide-if-no-js" aria-label="<?php esc_attr_e( 'Secondary menu' ); ?>">
    49                 <a href="<?php echo esc_url( admin_url( 'site-health.php' ) ); ?>" class="health-check-tab">
     49                <a href="<?php echo esc_url( network_admin_url( 'site-health.php' ) ); ?>" class="health-check-tab">
    5050                        <?php
    5151                        /* translators: tab heading for Site Health Status page */
    5252                        _ex( 'Status', 'Site Health' );
    5353                        ?>
    5454                </a>
    5555
    56                 <a href="<?php echo esc_url( admin_url( 'site-health.php?tab=debug' ) ); ?>" class="health-check-tab active" aria-current="true">
     56                <a href="<?php echo esc_url( network_admin_url( 'site-health.php?tab=debug' ) ); ?>" class="health-check-tab active" aria-current="true">
    5757                        <?php
    5858                        /* translators: tab heading for Site Health Info page */
    5959                        _ex( 'Info', 'Site Health' );
  • 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..15df297e3f 100644
    function wp_admin_bar_my_sites_menu( $wp_admin_bar ) { 
    543543                        );
    544544                }
    545545
     546                if ( current_user_can( 'view_site_health_checks' ) ) {
     547                        $wp_admin_bar->add_menu(
     548                                array(
     549                                        'parent' => 'network-admin',
     550                                        'id'     => 'network-admin-to',
     551                                        'title'  => __( 'Tools' ),
     552                                        'href'   => network_admin_url( 'site-health.php' ),
     553                                )
     554                        );
     555                }
     556
    546557                if ( current_user_can( 'manage_network_options' ) ) {
    547558                        $wp_admin_bar->add_menu(
    548559                                array(
    function wp_admin_bar_my_sites_menu( $wp_admin_bar ) { 
    553564                                )
    554565                        );
    555566                }
     567
    556568        }
    557569
    558570        // Add site links