diff --git a/src/js/_enqueues/admin/site-health.js b/src/js/_enqueues/admin/site-health.js index 6211b1ea9f..d0e1b4cf89 100644 --- a/src/js/_enqueues/admin/site-health.js +++ b/src/js/_enqueues/admin/site-health.js @@ -15,6 +15,7 @@ jQuery( document ).ready( function( $ ) { var data; var clipboard = new ClipboardJS( '.site-health-copy-buttons .copy-button' ); var isDebugTab = $( '.health-check-body.health-check-debug-tab' ).length; + var pathsSizesSection = $( '#health-check-accordion-block-wp-paths-sizes' ); // Debug information copy section. clipboard.on( 'success', function( e ) { @@ -295,7 +296,7 @@ jQuery( document ).ready( function( $ ) { copyButton.attr( 'data-clipboard-text', clipdoardText ); - $( '#health-check-accordion-block-wp-paths-sizes' ).find( 'td[class]' ).each( function( i, element ) { + pathsSizesSection.find( 'td[class]' ).each( function( i, element ) { var td = $( element ); var name = td.attr( 'class' ); @@ -306,6 +307,10 @@ jQuery( document ).ready( function( $ ) { } if ( isDebugTab ) { - getDirectorySizes(); + if ( pathsSizesSection.length ) { + getDirectorySizes(); + } else { + RecalculateProgression(); + } } } ); diff --git a/src/wp-admin/includes/ajax-actions.php b/src/wp-admin/includes/ajax-actions.php index 3441945217..0f1f0f4e04 100644 --- a/src/wp-admin/includes/ajax-actions.php +++ b/src/wp-admin/includes/ajax-actions.php @@ -4967,7 +4967,7 @@ function wp_ajax_health_check_site_status_result() { function wp_ajax_health_check_get_sizes() { check_ajax_referer( 'health-check-site-status-result' ); - if ( ! current_user_can( 'install_plugins' ) ) { + if ( ! current_user_can( 'install_plugins' ) || is_multisite() ) { wp_send_json_error(); } diff --git a/src/wp-admin/includes/class-wp-debug-data.php b/src/wp-admin/includes/class-wp-debug-data.php index f5e477589e..fe7fe60fef 100644 --- a/src/wp-admin/includes/class-wp-debug-data.php +++ b/src/wp-admin/includes/class-wp-debug-data.php @@ -109,10 +109,12 @@ class WP_Debug_Data { ), ); - $info['wp-paths-sizes'] = array( - 'label' => __( 'Directories and Sizes' ), - 'fields' => array(), - ); + if ( ! $is_multisite ) { + $info['wp-paths-sizes'] = array( + 'label' => __( 'Directories and Sizes' ), + 'fields' => array(), + ); + } $info['wp-dropins'] = array( 'label' => __( 'Drop-ins' ), @@ -389,56 +391,59 @@ class WP_Debug_Data { ); } - $loading = __( 'Loading…' ); + // Remove accordion for Directories and Sizes if in Multisite. + if ( ! $is_multisite ) { + $loading = __( 'Loading…' ); - $info['wp-paths-sizes']['fields'] = array( - 'wordpress_path' => array( - 'label' => __( 'WordPress directory location' ), - 'value' => untrailingslashit( ABSPATH ), - ), - 'wordpress_size' => array( - 'label' => __( 'WordPress directory size' ), - 'value' => $loading, - 'debug' => 'loading...', - ), - 'uploads_path' => array( - 'label' => __( 'Uploads directory location' ), - 'value' => $upload_dir['basedir'], - ), - 'uploads_size' => array( - 'label' => __( 'Uploads directory size' ), - 'value' => $loading, - 'debug' => 'loading...', - ), - 'themes_path' => array( - 'label' => __( 'Themes directory location' ), - 'value' => get_theme_root(), - ), - 'themes_size' => array( - 'label' => __( 'Themes directory size' ), - 'value' => $loading, - 'debug' => 'loading...', - ), - 'plugins_path' => array( - 'label' => __( 'Plugins directory location' ), - 'value' => WP_PLUGIN_DIR, - ), - 'plugins_size' => array( - 'label' => __( 'Plugins directory size' ), - 'value' => $loading, - 'debug' => 'loading...', - ), - 'database_size' => array( - 'label' => __( 'Database size' ), - 'value' => $loading, - 'debug' => 'loading...', - ), - 'total_size' => array( - 'label' => __( 'Total installation size' ), - 'value' => $loading, - 'debug' => 'loading...', - ), - ); + $info['wp-paths-sizes']['fields'] = array( + 'wordpress_path' => array( + 'label' => __( 'WordPress directory location' ), + 'value' => untrailingslashit( ABSPATH ), + ), + 'wordpress_size' => array( + 'label' => __( 'WordPress directory size' ), + 'value' => $loading, + 'debug' => 'loading...', + ), + 'uploads_path' => array( + 'label' => __( 'Uploads directory location' ), + 'value' => $upload_dir['basedir'], + ), + 'uploads_size' => array( + 'label' => __( 'Uploads directory size' ), + 'value' => $loading, + 'debug' => 'loading...', + ), + 'themes_path' => array( + 'label' => __( 'Themes directory location' ), + 'value' => get_theme_root(), + ), + 'themes_size' => array( + 'label' => __( 'Themes directory size' ), + 'value' => $loading, + 'debug' => 'loading...', + ), + 'plugins_path' => array( + 'label' => __( 'Plugins directory location' ), + 'value' => WP_PLUGIN_DIR, + ), + 'plugins_size' => array( + 'label' => __( 'Plugins directory size' ), + 'value' => $loading, + 'debug' => 'loading...', + ), + 'database_size' => array( + 'label' => __( 'Database size' ), + 'value' => $loading, + 'debug' => 'loading...', + ), + 'total_size' => array( + 'label' => __( 'Total installation size' ), + 'value' => $loading, + 'debug' => 'loading...', + ), + ); + } // Get a list of all drop-in replacements. $dropins = get_dropins();