mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-14 22:56:19 +01:00
36cc3aab1a
This backports several build and test tool improvements to the 5.2 branch. Most notably, this includes: - The changes required to allow each workflow to be triggered by the `workflow_dispatch` event so that tests can be run on a schedule [50590]. - The ability to run PHPUnit tests from `src` instead of `build` [50441-50443]. - Splitting single site and multisite tests into parallel jobs [50379]. - Split slow tests into separate, parallel jobs for PHP 5.6 [50444]. - Better branch and path scoping for GitHub Action workflows when running on `pull_request` [50432,50479]. - Several `devDependency` updates. Merges [50267,50299,50379,50387,50413,50416,50432,50435-50436,50441-50444,50446,50473-50474,50476,50479,50485-50487,50545,50579,50590,50598] to the 5.2 branch. See #50401, #51734, #51801, #51802, #52548, #52608, #52612, #52623, #52624, #52625, #52645, #52653, #52658, #52660, #52667. Built from https://develop.svn.wordpress.org/branches/5.2@50606 git-svn-id: http://core.svn.wordpress.org/branches/5.2@50219 1a063a9b-81f0-0310-95a4-ce76da25c4cd
1 line
4.6 KiB
JavaScript
1 line
4.6 KiB
JavaScript
jQuery(document).ready(function(n){var c=wp.i18n.__,h=wp.i18n._n,l=wp.i18n.sprintf,t=new ClipboardJS(".site-health-copy-buttons .copy-button"),o=n(".health-check-body.health-check-debug-tab").length,i=n("#health-check-accordion-block-wp-paths-sizes");function a(t){var e,s,a=wp.template("health-check-issue"),i=n("#health-check-issues-"+t.status);SiteHealth.site_status.issues[t.status]++,s=SiteHealth.site_status.issues[t.status],"critical"===t.status?e=l(h("%s Critical issue","%s Critical issues",s),'<span class="issue-count">'+s+"</span>"):"recommended"===t.status?e=l(h("%s Recommended improvement","%s Recommended improvements",s),'<span class="issue-count">'+s+"</span>"):"good"===t.status&&(e=l(h("%s Item with no issues detected","%s Items with no issues detected",s),'<span class="issue-count">'+s+"</span>")),e&&n(".site-health-issue-count-title",i).html(e),n(".issues","#health-check-issues-"+t.status).append(a(t))}function r(){var t=n(".site-health-progress"),e=t.find(".site-health-progress-count"),s=n(".site-health-progress svg #bar"),a=parseInt(SiteHealth.site_status.issues.good,0)+parseInt(SiteHealth.site_status.issues.recommended,0)+1.5*parseInt(SiteHealth.site_status.issues.critical,0),i=parseInt(SiteHealth.site_status.issues.recommended,0)+1.5*parseInt(SiteHealth.site_status.issues.critical,0),i=100-Math.ceil(i/a*100);0!==a?(t.removeClass("loading"),a=s.attr("r"),a=Math.PI*(2*a),s.css({strokeDashoffset:(100-(i=100<(i=i<0?0:i)?100:i))/100*a}),parseInt(SiteHealth.site_status.issues.critical,0)<1&&n("#health-check-issues-critical").addClass("hidden"),parseInt(SiteHealth.site_status.issues.recommended,0)<1&&n("#health-check-issues-recommended").addClass("hidden"),50<=i&&s.addClass("orange").removeClass("red"),90<=i&&s.addClass("green").removeClass("orange"),100===i&&(n(".site-status-all-clear").removeClass("hide"),n(".site-status-has-issues").addClass("hide")),e.text(i+"%"),o||(n.post(ajaxurl,{action:"health-check-site-status-result",_wpnonce:SiteHealth.nonce.site_status_result,counts:SiteHealth.site_status.issues}),wp.a11y.speak(l(c("All site health tests have finished running. Your site scored %s, and the results are now available on the page."),i+"%")))):t.addClass("hidden")}function e(){var t={action:"health-check-get-sizes",_wpnonce:SiteHealth.nonce.site_status_result},e=(new Date).getTime(),s=window.setTimeout(function(){wp.a11y.speak(c("Please wait..."))},3e3);n.post({type:"POST",url:ajaxurl,data:t,dataType:"json"}).done(function(t){var a,s;a=t.data||{},t=n("button.button.copy-button"),s=t.attr("data-clipboard-text"),n.each(a,function(t,e){e=e.debug||e.size;void 0!==e&&(s=s.replace(t+": loading...",t+": "+e))}),t.attr("data-clipboard-text",s),i.find("td[class]").each(function(t,e){var s=n(e),e=s.attr("class");a.hasOwnProperty(e)&&a[e].size&&s.text(a[e].size)})}).always(function(){var t=(new Date).getTime()-e;n(".health-check-wp-paths-sizes.spinner").css("visibility","hidden"),r(),3e3<t?(t=6e3<t?0:6500-t,window.setTimeout(function(){wp.a11y.speak(c("All site health tests have finished running."))},t)):window.clearTimeout(s),n(document).trigger("site-health-info-dirsizes-done")})}t.on("success",function(t){t=n(t.trigger).closest("div");n(".success",t).addClass("visible"),wp.a11y.speak(c("Site information has been added to your clipboard."))}),n(".health-check-accordion").on("click",".health-check-accordion-trigger",function(){"true"===n(this).attr("aria-expanded")?(n(this).attr("aria-expanded","false"),n("#"+n(this).attr("aria-controls")).attr("hidden",!0)):(n(this).attr("aria-expanded","true"),n("#"+n(this).attr("aria-controls")).attr("hidden",!1))}),n(".site-health-view-passed").on("click",function(){var t=n("#health-check-issues-good");t.toggleClass("hidden"),n(this).attr("aria-expanded",!t.hasClass("hidden"))}),"undefined"==typeof SiteHealth||o||(0===SiteHealth.site_status.direct.length&&0===SiteHealth.site_status.async.length?r():SiteHealth.site_status.issues={good:0,recommended:0,critical:0},0<SiteHealth.site_status.direct.length&&n.each(SiteHealth.site_status.direct,function(){a(this)}),0<SiteHealth.site_status.async.length?(t={action:"health-check-"+SiteHealth.site_status.async[0].test.replace("_","-"),_wpnonce:SiteHealth.nonce.site_status},SiteHealth.site_status.async[0].completed=!0,n.post(ajaxurl,t,function(t){a(t.data),function e(){var s=!0;1<=SiteHealth.site_status.async.length&&n.each(SiteHealth.site_status.async,function(){var t={action:"health-check-"+this.test.replace("_","-"),_wpnonce:SiteHealth.nonce.site_status};return!!this.completed||(s=!1,this.completed=!0,n.post(ajaxurl,t,function(t){a(t.data),e()}),!1)}),s&&r()}()})):r()),o&&(i.length?e:r)()}); |