Site Health info tab: Remove the "Directories and Sizes" section on Multisite installations. Most of the info shown there doesn't apply for multisite.

Props xkon, desrosj, azaozz.
Built from https://develop.svn.wordpress.org/trunk@45239


git-svn-id: http://core.svn.wordpress.org/trunk@45048 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2019-04-18 00:34:51 +00:00
parent 2d81c95f73
commit 9659676fca
5 changed files with 68 additions and 58 deletions

View File

@ -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();
}

View File

@ -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();

View File

@ -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();
}
}
} );

View File

@ -1 +1 @@
jQuery(document).ready(function(a){function b(b){var c,d,e=wp.template("health-check-issue"),f=a("#health-check-issues-"+b.status);SiteHealth.site_status.issues[b.status]++,d=SiteHealth.site_status.issues[b.status],"critical"===b.status?c=j(i("%s Critical issue","%s Critical issues",d),'<span class="issue-count">'+d+"</span>"):"recommended"===b.status?c=j(i("%s Recommended improvement","%s Recommended improvements",d),'<span class="issue-count">'+d+"</span>"):"good"===b.status&&(c=j(i("%s Item with no issues detected","%s Items with no issues detected",d),'<span class="issue-count">'+d+"</span>")),c&&a(".site-health-issue-count-title",f).html(c),a(".issues","#health-check-issues-"+b.status).append(e(b))}function c(){var b,c,d,e=a(".site-health-progress"),f=e.find(".site-health-progress-count"),g=a(".site-health-progress svg #bar"),i=parseInt(SiteHealth.site_status.issues.good,0)+parseInt(SiteHealth.site_status.issues.recommended,0)+1.5*parseInt(SiteHealth.site_status.issues.critical,0),k=parseInt(SiteHealth.site_status.issues.recommended,0)+1.5*parseInt(SiteHealth.site_status.issues.critical,0),m=100-Math.ceil(k/i*100);return 0===i?void e.addClass("hidden"):(e.removeClass("loading"),b=g.attr("r"),c=Math.PI*(2*b),0>m&&(m=0),100<m&&(m=100),d=(100-m)/100*c,g.css({strokeDashoffset:d}),1>parseInt(SiteHealth.site_status.issues.critical,0)&&a("#health-check-issues-critical").addClass("hidden"),1>parseInt(SiteHealth.site_status.issues.recommended,0)&&a("#health-check-issues-recommended").addClass("hidden"),50<=m&&g.addClass("orange").removeClass("red"),90<=m&&g.addClass("green").removeClass("orange"),100===m&&(a(".site-status-all-clear").removeClass("hide"),a(".site-status-has-issues").addClass("hide")),f.text(m+"%"),void(l||(a.post(ajaxurl,{action:"health-check-site-status-result",_wpnonce:SiteHealth.nonce.site_status_result,counts:SiteHealth.site_status.issues}),wp.a11y.speak(j(h("All site health tests have finished running. Your site scored %s, and the results are now available on the page."),m+"%")))))}function d(){var e=!0;1<=SiteHealth.site_status.async.length&&a.each(SiteHealth.site_status.async,function(){var c={action:"health-check-"+this.test.replace("_","-"),_wpnonce:SiteHealth.nonce.site_status};return!!this.completed||(e=!1,this.completed=!0,a.post(ajaxurl,c,function(a){b(a.data),d()}),!1)}),e&&c()}function e(){var b={action:"health-check-get-sizes",_wpnonce:SiteHealth.nonce.site_status_result},d=(new Date).getTime(),e=window.setTimeout(function(){wp.a11y.speak(h("Please wait..."))},3e3);a.post({type:"POST",url:ajaxurl,data:b,dataType:"json"}).done(function(a){f(a.data||{})}).always(function(){var b=(new Date).getTime()-d;a(".health-check-wp-paths-sizes.spinner").css("visibility","hidden"),c(),b>3e3?(b=b>6e3?0:6500-b,window.setTimeout(function(){wp.a11y.speak(h("All site health tests have finished running."))},b)):window.clearTimeout(e),a(document).trigger("site-health-info-dirsizes-done")})}function f(b){var c=a("button.button.copy-button"),d=c.attr("data-clipboard-text");a.each(b,function(a,b){var c=b.debug||b.size;"undefined"!=typeof c&&(d=d.replace(a+": not calculated",a+": "+c))}),c.attr("data-clipboard-text",d),a("#health-check-accordion-block-wp-paths-sizes").find("td[class]").each(function(c,d){var e=a(d),f=e.attr("class");b.hasOwnProperty(f)&&b[f].size&&e.text(b[f].size)})}var g,h=wp.i18n.__,i=wp.i18n._n,j=wp.i18n.sprintf,k=new ClipboardJS(".site-health-copy-buttons .copy-button"),l=a(".health-check-body.health-check-debug-tab").length;k.on("success",function(b){var c=a(b.trigger).closest("div");a(".success",c).addClass("visible"),wp.a11y.speak(h("Site information has been added to your clipboard."))}),a(".health-check-accordion").on("click",".health-check-accordion-trigger",function(){var b="true"===a(this).attr("aria-expanded");b?(a(this).attr("aria-expanded","false"),a("#"+a(this).attr("aria-controls")).attr("hidden",!0)):(a(this).attr("aria-expanded","true"),a("#"+a(this).attr("aria-controls")).attr("hidden",!1))}),a(".site-health-view-passed").on("click",function(){var b=a("#health-check-issues-good");b.toggleClass("hidden"),a(this).attr("aria-expanded",!b.hasClass("hidden"))}),"undefined"==typeof SiteHealth||l||(0===SiteHealth.site_status.direct.length&&0===SiteHealth.site_status.async.length?c():SiteHealth.site_status.issues={good:0,recommended:0,critical:0},0<SiteHealth.site_status.direct.length&&a.each(SiteHealth.site_status.direct,function(){b(this)}),0<SiteHealth.site_status.async.length?(g={action:"health-check-"+SiteHealth.site_status.async[0].test.replace("_","-"),_wpnonce:SiteHealth.nonce.site_status},SiteHealth.site_status.async[0].completed=!0,a.post(ajaxurl,g,function(a){b(a.data),d()})):c()),l&&e()});
jQuery(document).ready(function(a){function b(b){var c,d,e=wp.template("health-check-issue"),f=a("#health-check-issues-"+b.status);SiteHealth.site_status.issues[b.status]++,d=SiteHealth.site_status.issues[b.status],"critical"===b.status?c=j(i("%s Critical issue","%s Critical issues",d),'<span class="issue-count">'+d+"</span>"):"recommended"===b.status?c=j(i("%s Recommended improvement","%s Recommended improvements",d),'<span class="issue-count">'+d+"</span>"):"good"===b.status&&(c=j(i("%s Item with no issues detected","%s Items with no issues detected",d),'<span class="issue-count">'+d+"</span>")),c&&a(".site-health-issue-count-title",f).html(c),a(".issues","#health-check-issues-"+b.status).append(e(b))}function c(){var b,c,d,e=a(".site-health-progress"),f=e.find(".site-health-progress-count"),g=a(".site-health-progress svg #bar"),i=parseInt(SiteHealth.site_status.issues.good,0)+parseInt(SiteHealth.site_status.issues.recommended,0)+1.5*parseInt(SiteHealth.site_status.issues.critical,0),k=parseInt(SiteHealth.site_status.issues.recommended,0)+1.5*parseInt(SiteHealth.site_status.issues.critical,0),m=100-Math.ceil(k/i*100);return 0===i?void e.addClass("hidden"):(e.removeClass("loading"),b=g.attr("r"),c=Math.PI*(2*b),0>m&&(m=0),100<m&&(m=100),d=(100-m)/100*c,g.css({strokeDashoffset:d}),1>parseInt(SiteHealth.site_status.issues.critical,0)&&a("#health-check-issues-critical").addClass("hidden"),1>parseInt(SiteHealth.site_status.issues.recommended,0)&&a("#health-check-issues-recommended").addClass("hidden"),50<=m&&g.addClass("orange").removeClass("red"),90<=m&&g.addClass("green").removeClass("orange"),100===m&&(a(".site-status-all-clear").removeClass("hide"),a(".site-status-has-issues").addClass("hide")),f.text(m+"%"),void(l||(a.post(ajaxurl,{action:"health-check-site-status-result",_wpnonce:SiteHealth.nonce.site_status_result,counts:SiteHealth.site_status.issues}),wp.a11y.speak(j(h("All site health tests have finished running. Your site scored %s, and the results are now available on the page."),m+"%")))))}function d(){var e=!0;1<=SiteHealth.site_status.async.length&&a.each(SiteHealth.site_status.async,function(){var c={action:"health-check-"+this.test.replace("_","-"),_wpnonce:SiteHealth.nonce.site_status};return!!this.completed||(e=!1,this.completed=!0,a.post(ajaxurl,c,function(a){b(a.data),d()}),!1)}),e&&c()}function e(){var b={action:"health-check-get-sizes",_wpnonce:SiteHealth.nonce.site_status_result},d=(new Date).getTime(),e=window.setTimeout(function(){wp.a11y.speak(h("Please wait..."))},3e3);a.post({type:"POST",url:ajaxurl,data:b,dataType:"json"}).done(function(a){f(a.data||{})}).always(function(){var b=(new Date).getTime()-d;a(".health-check-wp-paths-sizes.spinner").css("visibility","hidden"),c(),b>3e3?(b=b>6e3?0:6500-b,window.setTimeout(function(){wp.a11y.speak(h("All site health tests have finished running."))},b)):window.clearTimeout(e),a(document).trigger("site-health-info-dirsizes-done")})}function f(b){var c=a("button.button.copy-button"),d=c.attr("data-clipboard-text");a.each(b,function(a,b){var c=b.debug||b.size;"undefined"!=typeof c&&(d=d.replace(a+": not calculated",a+": "+c))}),c.attr("data-clipboard-text",d),m.find("td[class]").each(function(c,d){var e=a(d),f=e.attr("class");b.hasOwnProperty(f)&&b[f].size&&e.text(b[f].size)})}var g,h=wp.i18n.__,i=wp.i18n._n,j=wp.i18n.sprintf,k=new ClipboardJS(".site-health-copy-buttons .copy-button"),l=a(".health-check-body.health-check-debug-tab").length,m=a("#health-check-accordion-block-wp-paths-sizes");k.on("success",function(b){var c=a(b.trigger).closest("div");a(".success",c).addClass("visible"),wp.a11y.speak(h("Site information has been added to your clipboard."))}),a(".health-check-accordion").on("click",".health-check-accordion-trigger",function(){var b="true"===a(this).attr("aria-expanded");b?(a(this).attr("aria-expanded","false"),a("#"+a(this).attr("aria-controls")).attr("hidden",!0)):(a(this).attr("aria-expanded","true"),a("#"+a(this).attr("aria-controls")).attr("hidden",!1))}),a(".site-health-view-passed").on("click",function(){var b=a("#health-check-issues-good");b.toggleClass("hidden"),a(this).attr("aria-expanded",!b.hasClass("hidden"))}),"undefined"==typeof SiteHealth||l||(0===SiteHealth.site_status.direct.length&&0===SiteHealth.site_status.async.length?c():SiteHealth.site_status.issues={good:0,recommended:0,critical:0},0<SiteHealth.site_status.direct.length&&a.each(SiteHealth.site_status.direct,function(){b(this)}),0<SiteHealth.site_status.async.length?(g={action:"health-check-"+SiteHealth.site_status.async[0].test.replace("_","-"),_wpnonce:SiteHealth.nonce.site_status},SiteHealth.site_status.async[0].completed=!0,a.post(ajaxurl,g,function(a){b(a.data),d()})):c()),l&&(m.length?e():c())});

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.2-beta3-45238';
$wp_version = '5.2-beta3-45239';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.