<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[44986] trunk: Admin: Introduce the Site Health screens.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/44986">44986</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/44986","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>pento</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2019-03-23 03:54:16 +0000 (Sat, 23 Mar 2019)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Admin: Introduce the Site Health screens.

The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.

By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.

Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See <a href="https://core.trac.wordpress.org/ticket/46573">#46573</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkGruntfilejs">trunk/Gruntfile.js</a></li>
<li><a href="#trunksrcwpadminadminajaxphp">trunk/src/wp-admin/admin-ajax.php</a></li>
<li><a href="#trunksrcwpadmincsswpadmincss">trunk/src/wp-admin/css/wp-admin.css</a></li>
<li><a href="#trunksrcwpadminincludesajaxactionsphp">trunk/src/wp-admin/includes/ajax-actions.php</a></li>
<li><a href="#trunksrcwpadminmenuphp">trunk/src/wp-admin/menu.php</a></li>
<li><a href="#trunksrcwpincludesscriptloaderphp">trunk/src/wp-includes/script-loader.php</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunksrcjs_enqueuesadminsitehealthjs">trunk/src/js/_enqueues/admin/site-health.js</a></li>
<li><a href="#trunksrcwpadmincsssitehealthcss">trunk/src/wp-admin/css/site-health.css</a></li>
<li><a href="#trunksrcwpadminincludesclasswpdebugdataphp">trunk/src/wp-admin/includes/class-wp-debug-data.php</a></li>
<li><a href="#trunksrcwpadminincludesclasswpsitehealthautoupdatesphp">trunk/src/wp-admin/includes/class-wp-site-health-auto-updates.php</a></li>
<li><a href="#trunksrcwpadminincludesclasswpsitehealthphp">trunk/src/wp-admin/includes/class-wp-site-health.php</a></li>
<li><a href="#trunksrcwpadminsitehealthinfophp">trunk/src/wp-admin/site-health-info.php</a></li>
<li><a href="#trunksrcwpadminsitehealthphp">trunk/src/wp-admin/site-health.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkGruntfilejs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/Gruntfile.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/Gruntfile.js        2019-03-23 03:36:10 UTC (rev 44985)
+++ trunk/Gruntfile.js  2019-03-23 03:54:16 UTC (rev 44986)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -263,6 +263,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        [ WORKING_DIR + 'wp-admin/js/tags-box.js' ]: [ './src/js/_enqueues/admin/tags-box.js' ],
</span><span class="cx" style="display: block; padding: 0 10px">                                        [ WORKING_DIR + 'wp-admin/js/tags-suggest.js' ]: [ './src/js/_enqueues/admin/tags-suggest.js' ],
</span><span class="cx" style="display: block; padding: 0 10px">                                        [ WORKING_DIR + 'wp-admin/js/tags.js' ]: [ './src/js/_enqueues/admin/tags.js' ],
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        [ WORKING_DIR + 'wp-admin/js/site-health.js' ]: [ './src/js/_enqueues/admin/site-health.js' ],
</ins><span class="cx" style="display: block; padding: 0 10px">                                         [ WORKING_DIR + 'wp-admin/js/theme-plugin-editor.js' ]: [ './src/js/_enqueues/wp/theme-plugin-editor.js' ],
</span><span class="cx" style="display: block; padding: 0 10px">                                        [ WORKING_DIR + 'wp-admin/js/theme.js' ]: [ './src/js/_enqueues/wp/theme.js' ],
</span><span class="cx" style="display: block; padding: 0 10px">                                        [ WORKING_DIR + 'wp-admin/js/updates.js' ]: [ './src/js/_enqueues/wp/updates.js' ],
</span></span></pre></div>
<a id="trunksrcjs_enqueuesadminsitehealthjs"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/src/js/_enqueues/admin/site-health.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/js/_enqueues/admin/site-health.js                               (rev 0)
+++ trunk/src/js/_enqueues/admin/site-health.js 2019-03-23 03:54:16 UTC (rev 44986)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,229 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/**
+ * Interactions used by the Site Health modules in WordPress.
+ *
+ * @output wp-admin/js/site-health.js
+ */
+
+/* global ajaxurl, SiteHealth, wp */
+
+jQuery( document ).ready( function( $ ) {
+
+       var data;
+
+       // Debug information copy section.
+       $( '.health-check-copy-field' ).click( function( e ) {
+               var $textarea = $( '#system-information-' + $( this ).data( 'copy-field' ) + '-copy-field' ),
+                       $wrapper = $( this ).closest( 'div' );
+
+               e.preventDefault();
+
+               $textarea.select();
+
+               if ( document.execCommand( 'copy' ) ) {
+                       $( '.copy-field-success', $wrapper ).addClass( 'visible' );
+                       $( this ).focus();
+
+                       wp.a11y.speak( SiteHealth.string.site_info_copied, 'polite' );
+               }
+       } );
+
+       // Accordion handling in various areas.
+       $( '.health-check-accordion' ).on( 'click', '.health-check-accordion-trigger', function() {
+               var isExpanded = ( 'true' === $( this ).attr( 'aria-expanded' ) );
+
+               if ( isExpanded ) {
+                       $( this ).attr( 'aria-expanded', 'false' );
+                       $( '#' + $( this ).attr( 'aria-controls' ) ).attr( 'hidden', true );
+               } else {
+                       $( this ).attr( 'aria-expanded', 'true' );
+                       $( '#' + $( this ).attr( 'aria-controls' ) ).attr( 'hidden', false );
+               }
+       } );
+
+       $( '.health-check-accordion' ).on( 'keyup', '.health-check-accordion-trigger', function( e ) {
+               if ( '38' === e.keyCode.toString() ) {
+                       $( '.health-check-accordion-trigger', $( this ).closest( 'dt' ).prevAll( 'dt' ) ).focus();
+               } else if ( '40' === e.keyCode.toString() ) {
+                       $( '.health-check-accordion-trigger', $( this ).closest( 'dt' ).nextAll( 'dt' ) ).focus();
+               }
+       } );
+
+       // Site Health test handling.
+
+       $( '.site-health-view-passed' ).on( 'click', function() {
+               var goodIssuesWrapper = $( '#health-check-issues-good' );
+
+               goodIssuesWrapper.toggleClass( 'hidden' );
+               $( this ).attr( 'aria-expanded', ! goodIssuesWrapper.hasClass( 'hidden' ) );
+       } );
+
+       /**
+        * Append a new issue to the issue list.
+        *
+        * @since 5.2.0
+        *
+        * @param {Object} issue The issue data.
+        */
+       function AppendIssue( issue ) {
+               var template = wp.template( 'health-check-issue' ),
+                       issueWrapper = $( '#health-check-issues-' + issue.status ),
+                       issueCounter = $( '.issue-count', issueWrapper );
+
+               SiteHealth.site_status.issues[ issue.status ]++;
+
+               issueCounter.text( SiteHealth.site_status.issues[ issue.status ] );
+               $( '.issues', '#health-check-issues-' + issue.status ).append( template( issue ) );
+       }
+
+       /**
+        * Update site health status indicator as asynchronous tests are run and returned.
+        *
+        * @since 5.2.0
+        */
+       function RecalculateProgression() {
+               var r, c, pct;
+               var $progressBar = $( '#progressbar' );
+               var $circle = $( '#progressbar svg #bar' );
+               var totalTests = parseInt( SiteHealth.site_status.issues.good, 0 ) + parseInt( SiteHealth.site_status.issues.recommended, 0 ) + ( parseInt( SiteHealth.site_status.issues.critical, 0 ) * 1.5 );
+               var failedTests = parseInt( SiteHealth.site_status.issues.recommended, 0 ) + ( parseInt( SiteHealth.site_status.issues.critical, 0 ) * 1.5 );
+               var val = 100 - Math.ceil( ( failedTests / totalTests ) * 100 );
+
+               if ( 0 === totalTests ) {
+                       $progressBar.addClass( 'hidden' );
+                       return;
+               }
+
+               $progressBar.removeClass( 'loading' );
+
+               r = $circle.attr( 'r' );
+               c = Math.PI * ( r * 2 );
+
+               if ( 0 > val ) {
+                       val = 0;
+               }
+               if ( 100 < val ) {
+                       val = 100;
+               }
+
+               pct = ( ( 100 - val ) / 100 ) * c;
+
+               $circle.css({ strokeDashoffset: pct } );
+
+               if ( 1 > parseInt( SiteHealth.site_status.issues.critical, 0 ) ) {
+                       $( '#health-check-issues-critical' ).addClass( 'hidden' );
+               }
+
+               if ( 1 > parseInt( SiteHealth.site_status.issues.recommended, 0 ) ) {
+                       $( '#health-check-issues-recommended' ).addClass( 'hidden' );
+               }
+
+               if ( 50 <= val ) {
+                       $circle.addClass( 'orange' ).removeClass( 'red' );
+               }
+
+               if ( 90 <= val ) {
+                       $circle.addClass( 'green' ).removeClass( 'orange' );
+               }
+
+               if ( 100 === val ) {
+                       $( '.site-status-all-clear' ).removeClass( 'hide' );
+                       $( '.site-status-has-issues' ).addClass( 'hide' );
+               }
+
+               $progressBar.attr( 'data-pct', val );
+               $progressBar.attr( 'aria-valuenow', val );
+
+               $( '.health-check-body' ).attr( 'aria-hidden', false );
+
+               $.post(
+                       ajaxurl,
+                       {
+                               'action': 'health-check-site-status-result',
+                               '_wpnonce': SiteHealth.nonce.site_status_result,
+                               'counts': SiteHealth.site_status.issues
+                       }
+               );
+
+               wp.a11y.speak( SiteHealth.string.site_health_complete_screen_reader.replace( '%s', val + '%' ), 'polite' );
+       }
+
+       /**
+        * Queue the next asynchronous test when we're ready to run it.
+        *
+        * @since 5.2.0
+        */
+       function maybeRunNextAsyncTest() {
+               var doCalculation = true;
+
+               if ( 1 <= SiteHealth.site_status.async.length ) {
+                       $.each( SiteHealth.site_status.async, function() {
+                               var data = {
+                                       'action': 'health-check-' + this.test.replace( '_', '-' ),
+                                       '_wpnonce': SiteHealth.nonce.site_status
+                               };
+
+                               if ( this.completed ) {
+                                       return true;
+                               }
+
+                               doCalculation = false;
+
+                               this.completed = true;
+
+                               $.post(
+                                       ajaxurl,
+                                       data,
+                                       function( response ) {
+                                               AppendIssue( response.data );
+                                               maybeRunNextAsyncTest();
+                                       }
+                               );
+
+                               return false;
+                       } );
+               }
+
+               if ( doCalculation ) {
+                       RecalculateProgression();
+               }
+       }
+
+       if ( 'undefined' !== typeof SiteHealth ) {
+               if ( 0 === SiteHealth.site_status.direct.length && 0 === SiteHealth.site_status.async.length ) {
+                       RecalculateProgression();
+               } else {
+                       SiteHealth.site_status.issues = {
+                               'good': 0,
+                               'recommended': 0,
+                               'critical': 0
+                       };
+               }
+
+               if ( 0 < SiteHealth.site_status.direct.length ) {
+                       $.each( SiteHealth.site_status.direct, function() {
+                               AppendIssue( this );
+                       } );
+               }
+
+               if ( 0 < SiteHealth.site_status.async.length ) {
+                       data = {
+                               'action': 'health-check-' + SiteHealth.site_status.async[0].test.replace( '_', '-' ),
+                               '_wpnonce': SiteHealth.nonce.site_status
+                       };
+
+                       SiteHealth.site_status.async[0].completed = true;
+
+                       $.post(
+                               ajaxurl,
+                               data,
+                               function( response ) {
+                                       AppendIssue( response.data );
+                                       maybeRunNextAsyncTest();
+                               }
+                       );
+               } else {
+                       RecalculateProgression();
+               }
+       }
+
+} );
</ins></span></pre></div>
<a id="trunksrcwpadminadminajaxphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/admin-ajax.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/admin-ajax.php 2019-03-23 03:36:10 UTC (rev 44985)
+++ trunk/src/wp-admin/admin-ajax.php   2019-03-23 03:54:16 UTC (rev 44986)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -131,6 +131,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">        'edit-theme-plugin-file',
</span><span class="cx" style="display: block; padding: 0 10px">        'wp-privacy-export-personal-data',
</span><span class="cx" style="display: block; padding: 0 10px">        'wp-privacy-erase-personal-data',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        'health-check-site-status-result',
+       'health-check-dotorg-communication',
+       'health-check-is-in-debug-mode',
+       'health-check-background-updates',
+       'health-check-loopback-requests',
</ins><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> // Deprecated
</span></span></pre></div>
<a id="trunksrcwpadmincsssitehealthcss"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/src/wp-admin/css/site-health.css</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/css/site-health.css                            (rev 0)
+++ trunk/src/wp-admin/css/site-health.css      2019-03-23 03:54:16 UTC (rev 44986)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,450 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+body.site-health #wpcontent {
+       padding-left: 0;
+}
+
+body.site-health .wrap {
+       margin-right: 0;
+       margin-left: 0;
+}
+
+body.site-health .wrap h2 {
+       padding: 1rem 0;
+       font-size: 1.3em;
+       line-height: 1.4;
+       font-weight: 600;
+}
+
+body.site-health ul li,
+body.site-health ol li {
+       line-height: 1.5;
+}
+
+body.site-health .health-check-header {
+       text-align: center;
+       margin-top: 0;
+       margin-bottom: 1rem;
+       background: #fff;
+       border-bottom: 1px solid #e2e4e7;
+}
+
+body.site-health .health-check-header .title-section {
+       display: flex;
+       align-items: center;
+       justify-content: center;
+}
+
+body.site-health .health-check-header .title-section h1 {
+       display: inline-block;
+       font-weight: 600;
+       margin: 1rem 0.8rem 1rem 0.8rem;
+}
+
+body.site-health .health-check-header .title-section #progressbar {
+       display: inline-block;
+       height: 40px;
+       width: 40px;
+       margin: 0;
+       border-radius: 100%;
+       position: relative;
+       font-weight: 600;
+       font-size: 0.4rem;
+}
+
+body.site-health .health-check-header .title-section #progressbar:after {
+       position: absolute;
+       display: block;
+       height: 80px;
+       width: 80px;
+       left: 50%;
+       top: 50%;
+       content: attr(data-pct) "%";
+       margin-top: -40px;
+       margin-left: -40px;
+       border-radius: 100%;
+       line-height: 80px;
+       font-size: 2em;
+}
+
+body.site-health .health-check-header .title-section #progressbar.hidden {
+       display: none;
+}
+
+body.site-health .health-check-header .title-section #progressbar.loading:after {
+       animation: loadingEllipsis 3s infinite ease-in-out;
+}
+
+body.site-health .health-check-header .title-section #progressbar.loading svg #bar {
+       stroke-dashoffset: 0;
+       stroke: #adc5d2;
+       animation: loadingPulse 3s infinite ease-in-out;
+}
+
+body.site-health .health-check-header .title-section #progressbar svg circle {
+       stroke-dashoffset: 0;
+       transition: stroke-dashoffset 1s linear;
+       stroke: #ccc;
+       stroke-width: 2em;
+}
+
+body.site-health .health-check-header .title-section #progressbar svg #bar {
+       stroke-dashoffset: 565;
+       stroke: #dc3232;
+}
+
+body.site-health .health-check-header .title-section #progressbar svg #bar.green {
+       stroke: #46b450;
+}
+
+body.site-health .health-check-header .title-section #progressbar svg #bar.orange {
+       stroke: #ffb900;
+}
+
+@keyframes loadingPulse {
+       0% {
+               stroke: #adc5d2;
+       }
+       50% {
+               stroke: #00a0d2;
+       }
+       100% {
+               stroke: #adc5d2;
+       }
+}
+
+@keyframes loadingEllipsis {
+       0% {
+               content: ".";
+       }
+       50% {
+               content: "..";
+       }
+       100% {
+               content: "...";
+       }
+}
+
+body.site-health .health-check-header .tabs-wrapper {
+       display: block;
+}
+
+body.site-health .health-check-header .tabs-wrapper .tab {
+       float: none;
+       display: inline-block;
+       text-decoration: none;
+       color: inherit;
+       padding: 0.5rem 1rem 1rem;
+       margin: 0 1rem;
+       transition: box-shadow 0.5s ease-in-out;
+}
+
+body.site-health .health-check-header .tabs-wrapper .tab:focus {
+       color: #191e23;
+       outline: 1px solid #6c7781;
+       box-shadow: none;
+}
+
+body.site-health .health-check-header .tabs-wrapper .tab.active {
+       box-shadow: inset 0 -3px #007cba;
+       font-weight: 600;
+}
+
+body.site-health .health-check-body {
+       max-width: 800px;
+       margin: 0 auto;
+}
+
+body.site-health .health-check-table thead th:first-child,
+body.site-health .health-check-table thead td:first-child {
+       width: 30%;
+}
+
+body.site-health .health-check-table tbody td {
+       width: 70%;
+}
+
+body.site-health .health-check-table tbody td:first-child {
+       width: 30%;
+}
+
+body.site-health .health-check-table tbody td ul,
+body.site-health .health-check-table tbody td ol {
+       margin: 0;
+}
+
+body.site-health .pass:before,
+body.site-health .good:before {
+       content: "\f147";
+       display: inline-block;
+       color: #46b450;
+       font-family: dashicons;
+       vertical-align: top;
+}
+
+body.site-health .warning:before {
+       content: "\f460";
+       display: inline-block;
+       color: #ffb900;
+       font-family: dashicons;
+}
+
+body.site-health .info:before {
+       content: "\f348";
+       display: inline-block;
+       color: #00a0d2;
+       font-family: dashicons;
+}
+
+body.site-health .fail:before,
+body.site-health .error:before {
+       content: "\f335";
+       display: inline-block;
+       color: #dc3232;
+       font-family: dashicons;
+}
+
+body.site-health .spinner {
+       float: none;
+}
+
+body.site-health .system-information-copy-wrapper {
+       display: block;
+       margin: 1rem 0;
+}
+
+body.site-health .system-information-copy-wrapper textarea {
+       border: 0;
+       padding: 0;
+       margin: 0;
+       position: absolute;
+       left: -9999px;
+       top: -9999px;
+}
+
+body.site-health .health-check-toggle-copy-section:hover {
+       background: none;
+}
+
+body.site-health .system-information-copy-wrapper .copy-button-wrapper {
+       margin: 0.5rem 0 1rem;
+}
+
+body.site-health .copy-field-success {
+       display: none;
+       color: #40860a;
+       line-height: 1.8;
+       margin-left: 0.5rem;
+}
+
+body.site-health .copy-field-success.visible {
+       display: inline-block;
+       height: 28px;
+    line-height: 28px;
+}
+
+body.site-health .site-status-has-issues {
+       display: block;
+}
+
+body.site-health .site-status-has-issues.hide {
+       display: none;
+}
+
+body.site-health h3 {
+       padding: 0;
+       font-weight: 400;
+}
+
+body.site-health .view-more {
+       text-align: center;
+}
+
+body.site-health .issues-wrapper:first-of-type {
+       margin-top: 3rem;
+}
+
+body.site-health .issues-wrapper {
+       margin-bottom: 3rem;
+       margin-top: 2rem;
+}
+
+body.site-health .site-status-all-clear {
+       display: flex;
+       flex-direction: column;
+       align-items: center;
+       justify-content: center;
+       text-align: center;
+       height: 100%;
+       width: 100%;
+       margin-top: 0;
+}
+
+@media all and (min-width: 784px) {
+       body.site-health .site-status-all-clear {
+               margin: 5rem 0;
+       }
+}
+
+body.site-health .site-status-all-clear.hide {
+       display: none;
+}
+
+body.site-health .site-status-all-clear .dashicons {
+       font-size: 150px;
+       height: 130px;
+       width: 150px;
+}
+
+body.site-health .site-status-all-clear .encouragement {
+       font-size: 1.5rem;
+       font-weight: 600;
+}
+
+body.site-health .site-status-all-clear p {
+       margin: 0;
+}
+
+body .health-check-accordion {
+       border: 1px solid #e2e4e7;
+}
+
+body .health-check-accordion dt {
+       font-weight: 600;
+       border-top: 1px solid #e2e4e7;
+}
+
+body .health-check-accordion dt:first-child {
+       border-radius: 0.3em 0.3em 0 0;
+       border-top: none;
+}
+
+body .health-check-accordion .health-check-accordion-trigger {
+       background: #fff;
+       border: 0;
+       color: #212121;
+       cursor: pointer;
+       display: block;
+       font-weight: 400;
+       margin: 0;
+       padding: 1em 1.5em;
+       position: relative;
+       text-align: left;
+       width: 100%;
+}
+
+body .health-check-accordion .health-check-accordion-trigger:hover,
+body .health-check-accordion .health-check-accordion-trigger:active {
+       background: #f8f9f9;
+}
+
+body .health-check-accordion .health-check-accordion-trigger:focus {
+       color: #191e23;
+       border: none;
+       box-shadow: none;
+       outline-offset: -2px;
+       outline: 1px dotted #555d66;
+}
+
+body .health-check-accordion .health-check-accordion-trigger .title {
+       display: inline-block;
+       pointer-events: none;
+       font-weight: 600;
+}
+
+body .health-check-accordion .health-check-accordion-trigger .icon {
+       border: solid #191e23;
+       border-width: 0 2px 2px 0;
+       height: 0.5rem;
+       pointer-events: none;
+       position: absolute;
+       right: 1.5em;
+       top: 50%;
+       transform: translateY(-70%) rotate(45deg);
+       width: 0.5rem;
+}
+
+body .health-check-accordion .health-check-accordion-trigger .badge {
+       display: inline-block;
+       padding: 0.1rem 0.5rem 0.15rem;
+       background-color: #d7dade;
+       border-radius: 3px;
+       color: #000;
+       font-weight: 600;
+       margin: 0 0.5rem;
+}
+
+body .health-check-accordion .health-check-accordion-trigger .badge.blue {
+       background-color: #0073af;
+       color: #fff;
+}
+
+body .health-check-accordion .health-check-accordion-trigger .badge.orange {
+       background-color: #ffb900;
+       color: #000;
+}
+
+body .health-check-accordion .health-check-accordion-trigger .badge.red {
+       background-color: #dc3232;
+       color: #fff;
+}
+
+body .health-check-accordion .health-check-accordion-trigger .badge.green {
+       background-color: #40860a;
+       color: #fff;
+}
+
+body .health-check-accordion .health-check-accordion-trigger .badge.pink {
+       background-color: #f4b0fc;
+       color: #000;
+}
+
+body .health-check-accordion .health-check-accordion-trigger .badge.gray {
+       background-color: #ccc;
+       color: #000;
+}
+
+body .health-check-accordion .health-check-accordion-trigger .badge.light-blue {
+       background-color: #10e9fb;
+       color: #000;
+}
+
+body .health-check-accordion .health-check-accordion-trigger .badge.light-green {
+       background-color: #60f999;
+       color: #000;
+}
+
+body .health-check-accordion .health-check-accordion-trigger[aria-expanded="true"] .icon {
+       transform: translateY(-30%) rotate(-135deg)
+}
+
+body .health-check-accordion .health-check-accordion-panel {
+       margin: 0;
+       padding: 1em 1.5em;
+       background: #fff;
+}
+
+body .health-check-accordion .health-check-accordion-panel > div {
+       display: block;
+}
+
+body .health-check-accordion .health-check-accordion-panel[hidden] {
+       display: none;
+}
+
+body .health-check-accordion dl dd {
+       margin: 0 0 0.5em 2em;
+}
+
+@media screen and (max-width: 782px) {
+       body.site-health .health-check-body {
+               margin: 0 12px;
+               width: initial;
+       }
+}
+
+/* The breakpoint is usually at 960px, the additional space is to allow for the margin. */
+@media only screen and (max-width: 1004px) {
+       body.site-health .health-check-body {
+               margin: 0 22px;
+               width: initial;
+       }
+}
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span></span></pre></div>
<a id="trunksrcwpadmincsswpadmincss"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/css/wp-admin.css</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/css/wp-admin.css       2019-03-23 03:36:10 UTC (rev 44985)
+++ trunk/src/wp-admin/css/wp-admin.css 2019-03-23 03:54:16 UTC (rev 44986)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -12,3 +12,4 @@
</span><span class="cx" style="display: block; padding: 0 10px"> @import url(widgets.css);
</span><span class="cx" style="display: block; padding: 0 10px"> @import url(site-icon.css);
</span><span class="cx" style="display: block; padding: 0 10px"> @import url(l10n.css);
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+@import url(site-health.css);
</ins></span></pre></div>
<a id="trunksrcwpadminincludesajaxactionsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/includes/ajax-actions.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/includes/ajax-actions.php      2019-03-23 03:36:10 UTC (rev 44985)
+++ trunk/src/wp-admin/includes/ajax-actions.php        2019-03-23 03:54:16 UTC (rev 44986)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4858,3 +4858,101 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        wp_send_json_success( $response );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+/**
+ * Ajax handler for site health checks on server communication.
+ *
+ * @since 5.2.0
+ */
+function wp_ajax_health_check_dotorg_communication() {
+       check_ajax_referer( 'health-check-site-status' );
+
+       if ( ! current_user_can( 'install_plugins' ) ) {
+               wp_send_json_error();
+       }
+
+       if ( ! class_exists( 'WP_Site_Health' ) ) {
+               require_once( ABSPATH . 'wp-admin/includes/class-wp-site-health.php' );
+       }
+
+       $site_health = new WP_Site_Health();
+       wp_send_json_success( $site_health->get_test_dotorg_communication() );
+}
+
+/**
+ * Ajax handler for site health checks on debug mode.
+ *
+ * @since 5.2.0
+ */
+function wp_ajax_health_check_is_in_debug_mode() {
+       wp_verify_nonce( 'health-check-site-status' );
+
+       if ( ! current_user_can( 'install_plugins' ) ) {
+               wp_send_json_error();
+       }
+
+       if ( ! class_exists( 'WP_Site_Health' ) ) {
+               require_once( ABSPATH . 'wp-admin/includes/class-wp-site-health.php' );
+       }
+
+       $site_health = new WP_Site_Health();
+       wp_send_json_success( $site_health->get_test_is_in_debug_mode() );
+}
+
+/**
+ * Ajax handler for site health checks on background updates.
+ *
+ * @since 5.2.0
+ */
+function wp_ajax_health_check_background_updates() {
+       check_ajax_referer( 'health-check-site-status' );
+
+       if ( ! current_user_can( 'install_plugins' ) ) {
+               wp_send_json_error();
+       }
+
+       if ( ! class_exists( 'WP_Site_Health' ) ) {
+               require_once( ABSPATH . 'wp-admin/includes/class-wp-site-health.php' );
+       }
+
+       $site_health = new WP_Site_Health();
+       wp_send_json_success( $site_health->get_test_background_updates() );
+}
+
+
+/**
+ * Ajax handler for site health checks on loopback requests.
+ *
+ * @since 5.2.0
+ */
+function wp_ajax_health_check_loopback_requests() {
+       check_ajax_referer( 'health-check-site-status' );
+
+       if ( ! current_user_can( 'install_plugins' ) ) {
+               wp_send_json_error();
+       }
+
+       if ( ! class_exists( 'WP_Site_Health' ) ) {
+               require_once( ABSPATH . 'wp-admin/includes/class-wp-site-health.php' );
+       }
+
+       $site_health = new WP_Site_Health();
+       wp_send_json_success( $site_health->get_test_loopback_requests() );
+}
+
+/**
+ * Ajax handler for site health check to update the result status.
+ *
+ * @since 5.2.0
+ */
+function wp_ajax_health_check_site_status_result() {
+       check_ajax_referer( 'health-check-site-status-result' );
+
+       if ( ! current_user_can( 'install_plugins' ) ) {
+               wp_send_json_error();
+       }
+
+       set_transient( 'health-check-site-status-result', wp_json_encode( $_POST['counts'] ) );
+
+       wp_send_json_success();
+}
</ins></span></pre></div>
<a id="trunksrcwpadminincludesclasswpdebugdataphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/src/wp-admin/includes/class-wp-debug-data.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/includes/class-wp-debug-data.php                               (rev 0)
+++ trunk/src/wp-admin/includes/class-wp-debug-data.php 2019-03-23 03:54:16 UTC (rev 44986)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,985 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/**
+ * Class for providing debug data based on a users WordPress environment.
+ *
+ * @package WordPress
+ * @subpackage Site_Health
+ * @since 5.2.0
+ */
+
+class WP_Debug_Data {
+       /**
+        * Calls all core functions to check for updates.
+        *
+        * @since 5.2.0
+        */
+       static function check_for_updates() {
+               wp_version_check();
+               wp_update_plugins();
+               wp_update_themes();
+       }
+
+       /**
+        * Static function for generating site debug data when required.
+        *
+        * @since 5.2.0
+        *
+        * @throws ImagickException
+        * @global wpdb $wpdb WordPress database abstraction object.
+        *
+        * @param string $locale Optional. An ISO formatted language code to provide debug translations in. Default null.
+        * @return array The debug data for the site.
+        */
+       static function debug_data( $locale = null ) {
+               global $wpdb;
+
+               if ( ! empty( $locale ) ) {
+                       // Change the language used for translations
+                       if ( function_exists( 'switch_to_locale' ) ) {
+                               $original_locale = get_locale();
+                               $switched_locale = switch_to_locale( $locale );
+                       }
+               }
+
+               $upload_dir = wp_upload_dir();
+               if ( file_exists( ABSPATH . 'wp-config.php' ) ) {
+                       $wp_config_path = ABSPATH . 'wp-config.php';
+                       // phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged
+               } elseif ( @file_exists( dirname( ABSPATH ) . '/wp-config.php' ) && ! @file_exists( dirname( ABSPATH ) . '/wp-settings.php' ) ) {
+                       $wp_config_path = dirname( ABSPATH ) . '/wp-config.php';
+               }
+
+               $core_current_version = get_bloginfo( 'version' );
+               $core_updates         = get_core_updates();
+               $core_update_needed   = '';
+
+               foreach ( $core_updates as $core => $update ) {
+                       if ( 'upgrade' === $update->response ) {
+                               // translators: %s: Latest WordPress version number.
+                               $core_update_needed = ' ' . sprintf( __( '( Latest version: %s )' ), $update->version );
+                       } else {
+                               $core_update_needed = '';
+                       }
+               }
+
+               // Set up the array that holds all debug information.
+               $info = array(
+                       'wp-core'             => array(
+                               'label'  => __( 'WordPress' ),
+                               'fields' => array(
+                                       'version'                => array(
+                                               'label' => __( 'Version' ),
+                                               'value' => $core_current_version . $core_update_needed,
+                                       ),
+                                       'language'               => array(
+                                               'label' => __( 'Language' ),
+                                               'value' => ( ! empty( $locale ) ? $original_locale : get_locale() ),
+                                       ),
+                                       'home_url'               => array(
+                                               'label'   => __( 'Home URL' ),
+                                               'value'   => get_bloginfo( 'url' ),
+                                               'private' => true,
+                                       ),
+                                       'site_url'               => array(
+                                               'label'   => __( 'Site URL' ),
+                                               'value'   => get_bloginfo( 'wpurl' ),
+                                               'private' => true,
+                                       ),
+                                       'permalink'              => array(
+                                               'label' => __( 'Permalink structure' ),
+                                               'value' => get_option( 'permalink_structure' ) ?: __( 'No permalink structure set' ),
+                                       ),
+                                       'https_status'           => array(
+                                               'label' => __( 'Is this site using HTTPS?' ),
+                                               'value' => ( is_ssl() ? __( 'Yes' ) : __( 'No' ) ),
+                                       ),
+                                       'user_registration'      => array(
+                                               'label' => __( 'Can anyone register on this site?' ),
+                                               'value' => ( get_option( 'users_can_register' ) ? __( 'Yes' ) : __( 'No' ) ),
+                                       ),
+                                       'default_comment_status' => array(
+                                               'label' => __( 'Default comment status' ),
+                                               'value' => get_option( 'default_comment_status' ),
+                                       ),
+                                       'multisite'              => array(
+                                               'label' => __( 'Is this a multisite?' ),
+                                               'value' => ( is_multisite() ? __( 'Yes' ) : __( 'No' ) ),
+                                       ),
+                               ),
+                       ),
+                       'wp-paths-sizes'      => array(
+                               'label'  => __( 'Directories and Sizes' ),
+                               'fields' => array(),
+                       ),
+                       'wp-dropins'          => array(
+                               'label'       => __( 'Drop-ins' ),
+                               'show_count'  => true,
+                               'description' => __( 'Drop-ins are single files that replace or enhance WordPress features in ways that are not possible for traditional plugins.' ),
+                               'fields'      => array(),
+                       ),
+                       'wp-active-theme'     => array(
+                               'label'  => __( 'Active Theme' ),
+                               'fields' => array(),
+                       ),
+                       'wp-themes'           => array(
+                               'label'      => __( 'Other Themes' ),
+                               'show_count' => true,
+                               'fields'     => array(),
+                       ),
+                       'wp-mu-plugins'       => array(
+                               'label'      => __( 'Must Use Plugins' ),
+                               'show_count' => true,
+                               'fields'     => array(),
+                       ),
+                       'wp-plugins-active'   => array(
+                               'label'      => __( 'Active Plugins' ),
+                               'show_count' => true,
+                               'fields'     => array(),
+                       ),
+                       'wp-plugins-inactive' => array(
+                               'label'      => __( 'Inactive Plugins' ),
+                               'show_count' => true,
+                               'fields'     => array(),
+                       ),
+                       'wp-media'            => array(
+                               'label'  => __( 'Media Handling' ),
+                               'fields' => array(),
+                       ),
+                       'wp-server'           => array(
+                               'label'       => __( 'Server' ),
+                               'description' => __( 'The options shown below relate to your server setup. If changes are required, you may need your web host&#8217;s assistance.' ),
+                               'fields'      => array(),
+                       ),
+                       'wp-database'         => array(
+                               'label'  => __( 'Database' ),
+                               'fields' => array(),
+                       ),
+                       'wp-constants'        => array(
+                               'label'       => __( 'WordPress Constants' ),
+                               'description' => __( 'These settings are defined in your wp-config.php file, and alter where and how parts of WordPress are loaded.' ),
+                               'fields'      => array(
+                                       'ABSPATH'             => array(
+                                               'label'   => 'ABSPATH',
+                                               'value'   => ( ! defined( 'ABSPATH' ) ? __( 'Undefined' ) : ABSPATH ),
+                                               'private' => true,
+                                       ),
+                                       'WP_HOME'             => array(
+                                               'label' => 'WP_HOME',
+                                               'value' => ( ! defined( 'WP_HOME' ) ? __( 'Undefined' ) : WP_HOME ),
+                                       ),
+                                       'WP_SITEURL'          => array(
+                                               'label' => 'WP_SITEURL',
+                                               'value' => ( ! defined( 'WP_SITEURL' ) ? __( 'Undefined' ) : WP_SITEURL ),
+                                       ),
+                                       'WP_CONTENT_DIR'      => array(
+                                               'label' => 'WP_CONTENT_DIR',
+                                               'value' => ( ! defined( 'WP_CONTENT_DIR' ) ? __( 'Undefined' ) : WP_CONTENT_DIR ),
+                                       ),
+                                       'WP_PLUGIN_DIR'       => array(
+                                               'label' => 'WP_PLUGIN_DIR',
+                                               'value' => ( ! defined( 'WP_PLUGIN_DIR' ) ? __( 'Undefined' ) : WP_PLUGIN_DIR ),
+                                       ),
+                                       'WP_DEBUG'            => array(
+                                               'label' => 'WP_DEBUG',
+                                               'value' => ( ! defined( 'WP_DEBUG' ) ? __( 'Undefined' ) : ( WP_DEBUG ? __( 'Enabled' ) : __( 'Disabled' ) ) ),
+                                       ),
+                                       'WP_MAX_MEMORY_LIMIT' => array(
+                                               'label' => 'WP_MAX_MEMORY_LIMIT',
+                                               'value' => ( ! defined( 'WP_MAX_MEMORY_LIMIT' ) ? __( 'Undefined' ) : WP_MAX_MEMORY_LIMIT ),
+                                       ),
+                                       'WP_DEBUG_DISPLAY'    => array(
+                                               'label' => 'WP_DEBUG_DISPLAY',
+                                               'value' => ( ! defined( 'WP_DEBUG_DISPLAY' ) ? __( 'Undefined' ) : ( WP_DEBUG_DISPLAY ? __( 'Enabled' ) : __( 'Disabled' ) ) ),
+                                       ),
+                                       'WP_DEBUG_LOG'        => array(
+                                               'label' => 'WP_DEBUG_LOG',
+                                               'value' => ( ! defined( 'WP_DEBUG_LOG' ) ? __( 'Undefined' ) : ( WP_DEBUG_LOG ? __( 'Enabled' ) : __( 'Disabled' ) ) ),
+                                       ),
+                                       'SCRIPT_DEBUG'        => array(
+                                               'label' => 'SCRIPT_DEBUG',
+                                               'value' => ( ! defined( 'SCRIPT_DEBUG' ) ? __( 'Undefined' ) : ( SCRIPT_DEBUG ? __( 'Enabled' ) : __( 'Disabled' ) ) ),
+                                       ),
+                                       'WP_CACHE'            => array(
+                                               'label' => 'WP_CACHE',
+                                               'value' => ( ! defined( 'WP_CACHE' ) ? __( 'Undefined' ) : ( WP_CACHE ? __( 'Enabled' ) : __( 'Disabled' ) ) ),
+                                       ),
+                                       'CONCATENATE_SCRIPTS' => array(
+                                               'label' => 'CONCATENATE_SCRIPTS',
+                                               'value' => ( ! defined( 'CONCATENATE_SCRIPTS' ) ? __( 'Undefined' ) : ( CONCATENATE_SCRIPTS ? __( 'Enabled' ) : __( 'Disabled' ) ) ),
+                                       ),
+                                       'COMPRESS_SCRIPTS'    => array(
+                                               'label' => 'COMPRESS_SCRIPTS',
+                                               'value' => ( ! defined( 'COMPRESS_SCRIPTS' ) ? __( 'Undefined' ) : ( COMPRESS_SCRIPTS ? __( 'Enabled' ) : __( 'Disabled' ) ) ),
+                                       ),
+                                       'COMPRESS_CSS'        => array(
+                                               'label' => 'COMPRESS_CSS',
+                                               'value' => ( ! defined( 'COMPRESS_CSS' ) ? __( 'Undefined' ) : ( COMPRESS_CSS ? __( 'Enabled' ) : __( 'Disabled' ) ) ),
+                                       ),
+                                       'WP_LOCAL_DEV'        => array(
+                                               'label' => 'WP_LOCAL_DEV',
+                                               'value' => ( ! defined( 'WP_LOCAL_DEV' ) ? __( 'Undefined' ) : ( WP_LOCAL_DEV ? __( 'Enabled' ) : __( 'Disabled' ) ) ),
+                                       ),
+                               ),
+                       ),
+                       'wp-filesystem'       => array(
+                               'label'       => __( 'Filesystem Permissions' ),
+                               'description' => __( 'Shows whether WordPress is able to write to the directories it needs access to.' ),
+                               'fields'      => array(
+                                       'all'        => array(
+                                               'label' => __( 'The main WordPress directory' ),
+                                               'value' => ( wp_is_writable( ABSPATH ) ? __( 'Writable' ) : __( 'Not writable' ) ),
+                                       ),
+                                       'wp-content' => array(
+                                               'label' => __( 'The wp-content directory' ),
+                                               'value' => ( wp_is_writable( WP_CONTENT_DIR ) ? __( 'Writable' ) : __( 'Not writable' ) ),
+                                       ),
+                                       'uploads'    => array(
+                                               'label' => __( 'The uploads directory' ),
+                                               'value' => ( wp_is_writable( $upload_dir['basedir'] ) ? __( 'Writable' ) : __( 'Not writable' ) ),
+                                       ),
+                                       'plugins'    => array(
+                                               'label' => __( 'The plugins directory' ),
+                                               'value' => ( wp_is_writable( WP_PLUGIN_DIR ) ? __( 'Writable' ) : __( 'Not writable' ) ),
+                                       ),
+                                       'themes'     => array(
+                                               'label' => __( 'The themes directory' ),
+                                               'value' => ( wp_is_writable( get_template_directory() . '/..' ) ? __( 'Writable' ) : __( 'Not writable' ) ),
+                                       ),
+                               ),
+                       ),
+               );
+
+               // Conditionally add debug information for multisite setups.
+               if ( is_multisite() ) {
+                       $network_query = new WP_Network_Query();
+                       $network_ids   = $network_query->query(
+                               array(
+                                       'fields'        => 'ids',
+                                       'number'        => 100,
+                                       'no_found_rows' => false,
+                               )
+                       );
+
+                       $site_count = 0;
+                       foreach ( $network_ids as $network_id ) {
+                               $site_count += get_blog_count( $network_id );
+                       }
+
+                       $info['wp-core']['fields']['user_count']    = array(
+                               'label' => __( 'User count' ),
+                               'value' => get_user_count(),
+                       );
+                       $info['wp-core']['fields']['site_count']    = array(
+                               'label' => __( 'Site count' ),
+                               'value' => $site_count,
+                       );
+                       $info['wp-core']['fields']['network_count'] = array(
+                               'label' => __( 'Network count' ),
+                               'value' => $network_query->found_networks,
+                       );
+               } else {
+                       $user_count = count_users();
+
+                       $info['wp-core']['fields']['user_count'] = array(
+                               'label' => __( 'User count' ),
+                               'value' => $user_count['total_users'],
+                       );
+               }
+
+               // WordPress features requiring processing.
+               $wp_dotorg = wp_remote_get(
+                       'https://wordpress.org',
+                       array(
+                               'timeout' => 10,
+                       )
+               );
+               if ( ! is_wp_error( $wp_dotorg ) ) {
+                       $info['wp-core']['fields']['dotorg_communication'] = array(
+                               'label' => __( 'Communication with WordPress.org' ),
+                               'value' => sprintf(
+                                       __( 'WordPress.org is reachable' )
+                               ),
+                       );
+               } else {
+                       $info['wp-core']['fields']['dotorg_communication'] = array(
+                               'label' => __( 'Communication with WordPress.org' ),
+                               'value' => sprintf(
+                                       // translators: %1$s: The IP address WordPress.org resolves to. %2$s: The error returned by the lookup.
+                                       __( 'Unable to reach WordPress.org at %1$s: %2$s' ),
+                                       gethostbyname( 'wordpress.org' ),
+                                       $wp_dotorg->get_error_message()
+                               ),
+                       );
+               }
+
+               // Go through the various installation directories and calculate their sizes.
+               $uploads_dir = wp_upload_dir();
+               $inaccurate  = false;
+
+               /*
+                * We will be using the PHP max execution time to prevent the size calculations
+                * from causing a timeout. We provide a default value of 30 seconds, as some
+                * hosts do not allow you to read configuration values.
+                */
+               $max_execution_time   = 30;
+               $start_execution_time = microtime( true );
+               if ( function_exists( 'ini_get' ) ) {
+                       $max_execution_time = ini_get( 'max_execution_time' );
+               }
+
+               $size_directories = array(
+                       'wordpress' => array(
+                               'path' => ABSPATH,
+                               'size' => 0,
+                       ),
+                       'themes'    => array(
+                               'path' => trailingslashit( get_theme_root() ),
+                               'size' => 0,
+                       ),
+                       'plugins'   => array(
+                               'path' => trailingslashit( WP_PLUGIN_DIR ),
+                               'size' => 0,
+                       ),
+                       'uploads'   => array(
+                               'path' => $uploads_dir['basedir'],
+                               'size' => 0,
+                       ),
+               );
+
+               // Loop over all the directories we want to gather the sizes for.
+               foreach ( $size_directories as $size => $attributes ) {
+                       /*
+                        * We run a helper function with a RecursiveIterator, which
+                        * may throw an exception if it can't access directories.
+                        *
+                        * If a failure is detected we mark the result as inaccurate.
+                        */
+                       try {
+                               $calculated_size = WP_Debug_data::get_directory_size( $attributes['path'], $max_execution_time, $start_execution_time );
+
+                               $size_directories[ $size ]['size'] = $calculated_size;
+
+                               /*
+                                * If the size returned is -1, this means execution has
+                                * exceeded the maximum execution time, also denoting an
+                                * inaccurate value in the end.
+                                */
+                               if ( -1 === $calculated_size ) {
+                                       $inaccurate = true;
+                               }
+                       } catch ( Exception $e ) {
+                               $inaccurate = true;
+                       }
+               }
+
+               $size_db = WP_Debug_Data::get_database_size();
+
+               $size_total = $size_directories['wordpress']['size'] + $size_db;
+
+               $info['wp-paths-sizes']['fields'] = array(
+                       array(
+                               'label' => __( 'Uploads Directory Location' ),
+                               'value' => $size_directories['uploads']['path'],
+                       ),
+                       array(
+                               'label' => __( 'Uploads Directory Size' ),
+                               'value' => ( -1 === $size_directories['uploads']['size'] ? __( 'Unable to determine the size of this directory' ) : size_format( $size_directories['uploads']['size'], 2 ) ),
+                       ),
+                       array(
+                               'label' => __( 'Themes Directory Location' ),
+                               'value' => $size_directories['themes']['path'],
+                       ),
+                       array(
+                               'label' => __( 'Current Theme Directory' ),
+                               'value' => get_template_directory(),
+                       ),
+                       array(
+                               'label' => __( 'Themes Directory Size' ),
+                               'value' => ( -1 === $size_directories['themes']['size'] ? __( 'Unable to determine the size of this directory' ) : size_format( $size_directories['themes']['size'], 2 ) ),
+                       ),
+                       array(
+                               'label' => __( 'Plugins Directory Location' ),
+                               'value' => $size_directories['plugins']['path'],
+                       ),
+                       array(
+                               'label' => __( 'Plugins Directory Size' ),
+                               'value' => ( -1 === $size_directories['plugins']['size'] ? __( 'Unable to determine the size of this directory' ) : size_format( $size_directories['plugins']['size'], 2 ) ),
+                       ),
+                       array(
+                               'label' => __( 'WordPress Directory Location' ),
+                               'value' => $size_directories['wordpress']['path'],
+                       ),
+                       array(
+                               'label' => __( 'WordPress Directory Size' ),
+                               'value' => size_format( $size_directories['wordpress']['size'], 2 ),
+                       ),
+                       array(
+                               'label' => __( 'Database size' ),
+                               'value' => size_format( $size_db, 2 ),
+                       ),
+                       array(
+                               'label' => __( 'Total installation size' ),
+                               'value' => sprintf(
+                                       '%s%s',
+                                       size_format( $size_total, 2 ),
+                                       ( false === $inaccurate ? '' : __( '- Some errors, likely caused by invalid permissions, were encountered when determining the size of your installation. This means the values represented may be inaccurate.' ) )
+                               ),
+                       ),
+               );
+
+               // Get a list of all drop-in replacements.
+               $dropins            = get_dropins();
+               $dropin_description = _get_dropins();
+               foreach ( $dropins as $dropin_key => $dropin ) {
+                       $info['wp-dropins']['fields'][ sanitize_key( $dropin_key ) ] = array(
+                               'label' => $dropin_key,
+                               'value' => $dropin_description[ $dropin_key ][0],
+                       );
+               }
+
+               // Populate the media fields.
+               $info['wp-media']['fields']['image_editor'] = array(
+                       'label' => __( 'Active editor' ),
+                       'value' => _wp_image_editor_choose(),
+               );
+
+               // Get ImageMagic information, if available.
+               if ( class_exists( 'Imagick' ) ) {
+                       // Save the Imagick instance for later use.
+                       $imagick         = new Imagick();
+                       $imagick_version = $imagick->getVersion();
+               } else {
+                       $imagick_version = __( 'Not available' );
+               }
+               $info['wp-media']['fields']['imagick_module_version'] = array(
+                       'label' => __( 'ImageMagick version number' ),
+                       'value' => ( is_array( $imagick_version ) ? $imagick_version['versionNumber'] : $imagick_version ),
+               );
+               $info['wp-media']['fields']['imagemagick_version']    = array(
+                       'label' => __( 'ImageMagick version string' ),
+                       'value' => ( is_array( $imagick_version ) ? $imagick_version['versionString'] : $imagick_version ),
+               );
+
+               // If Imagick is used as our editor, provide some more information about its limitations.
+               if ( 'WP_Image_Editor_Imagick' === _wp_image_editor_choose() && isset( $imagick ) && $imagick instanceof Imagick ) {
+                       $limits = array(
+                               'area'   => ( defined( 'imagick::RESOURCETYPE_AREA' ) ? size_format( $imagick->getResourceLimit( imagick::RESOURCETYPE_AREA ) ) : __( 'Not available' ) ),
+                               'disk'   => ( defined( 'imagick::RESOURCETYPE_DISK' ) ? $imagick->getResourceLimit( imagick::RESOURCETYPE_DISK ) : __( 'Not available' ) ),
+                               'file'   => ( defined( 'imagick::RESOURCETYPE_FILE' ) ? $imagick->getResourceLimit( imagick::RESOURCETYPE_FILE ) : __( 'Not available' ) ),
+                               'map'    => ( defined( 'imagick::RESOURCETYPE_MAP' ) ? size_format( $imagick->getResourceLimit( imagick::RESOURCETYPE_MAP ) ) : __( 'Not available' ) ),
+                               'memory' => ( defined( 'imagick::RESOURCETYPE_MEMORY' ) ? size_format( $imagick->getResourceLimit( imagick::RESOURCETYPE_MEMORY ) ) : __( 'Not available' ) ),
+                               'thread' => ( defined( 'imagick::RESOURCETYPE_THREAD' ) ? $imagick->getResourceLimit( imagick::RESOURCETYPE_THREAD ) : __( 'Not available' ) ),
+                       );
+
+                       $info['wp-media']['fields']['imagick_limits'] = array(
+                               'label' => __( 'Imagick Resource Limits' ),
+                               'value' => $limits,
+                       );
+               }
+
+               // Get GD information, if available.
+               if ( function_exists( 'gd_info' ) ) {
+                       $gd = gd_info();
+               } else {
+                       $gd = false;
+               }
+               $info['wp-media']['fields']['gd_version'] = array(
+                       'label' => __( 'GD version' ),
+                       'value' => ( is_array( $gd ) ? $gd['GD Version'] : __( 'Not available' ) ),
+               );
+
+               // Get Ghostscript information, if available.
+               if ( function_exists( 'exec' ) ) {
+                       $gs = exec( 'gs --version' );
+                       $gs = ( ! empty( $gs ) ? $gs : __( 'Not available' ) );
+               } else {
+                       $gs = __( 'Unable to determine if Ghostscript is installed' );
+               }
+               $info['wp-media']['fields']['ghostscript_version'] = array(
+                       'label' => __( 'Ghostscript version' ),
+                       'value' => $gs,
+               );
+
+               // Populate the server debug fields.
+               $info['wp-server']['fields']['server_architecture'] = array(
+                       'label' => __( 'Server architecture' ),
+                       'value' => ( ! function_exists( 'php_uname' ) ? __( 'Unable to determine server architecture' ) : sprintf( '%s %s %s', php_uname( 's' ), php_uname( 'r' ), php_uname( 'm' ) ) ),
+               );
+               $info['wp-server']['fields']['httpd_software']      = array(
+                       'label' => __( 'Web server' ),
+                       'value' => ( isset( $_SERVER['SERVER_SOFTWARE'] ) ? $_SERVER['SERVER_SOFTWARE'] : __( 'Unable to determine what web server software is used' ) ),
+               );
+               $info['wp-server']['fields']['php_version']         = array(
+                       'label' => __( 'PHP version' ),
+                       'value' => ( ! function_exists( 'phpversion' ) ? __( 'Unable to determine PHP version' ) : sprintf(
+                               '%s %s',
+                               phpversion(),
+                               ( 64 === PHP_INT_SIZE * 8 ? __( '(Supports 64bit values)' ) : __( '(Does not support 64bit values)' ) )
+                       )
+                       ),
+               );
+               $info['wp-server']['fields']['php_sapi']            = array(
+                       'label' => __( 'PHP SAPI' ),
+                       'value' => ( ! function_exists( 'php_sapi_name' ) ? __( 'Unable to determine PHP SAPI' ) : php_sapi_name() ),
+               );
+
+               // Some servers disable `ini_set()` and `ini_get()`, we check this before trying to get configuration values.
+               if ( ! function_exists( 'ini_get' ) ) {
+                       $info['wp-server']['fields']['ini_get'] = array(
+                               'label' => __( 'Server settings' ),
+                               'value' => __( 'Unable to determine some settings, as the ini_get() function has been disabled.' ),
+                       );
+               } else {
+                       $info['wp-server']['fields']['max_input_variables'] = array(
+                               'label' => __( 'PHP max input variables' ),
+                               'value' => ini_get( 'max_input_vars' ),
+                       );
+                       $info['wp-server']['fields']['time_limit']          = array(
+                               'label' => __( 'PHP time limit' ),
+                               'value' => ini_get( 'max_execution_time' ),
+                       );
+                       $info['wp-server']['fields']['memory_limit']        = array(
+                               'label' => __( 'PHP memory limit' ),
+                               'value' => ini_get( 'memory_limit' ),
+                       );
+                       $info['wp-server']['fields']['max_input_time']      = array(
+                               'label' => __( 'Max input time' ),
+                               'value' => ini_get( 'max_input_time' ),
+                       );
+                       $info['wp-server']['fields']['upload_max_size']     = array(
+                               'label' => __( 'Upload max filesize' ),
+                               'value' => ini_get( 'upload_max_filesize' ),
+                       );
+                       $info['wp-server']['fields']['php_post_max_size']   = array(
+                               'label' => __( 'PHP post max size' ),
+                               'value' => ini_get( 'post_max_size' ),
+                       );
+               }
+
+               if ( function_exists( 'curl_version' ) ) {
+                       $curl = curl_version();
+
+                       $info['wp-server']['fields']['curl_version'] = array(
+                               'label' => __( 'cURL version' ),
+                               'value' => sprintf( '%s %s', $curl['version'], $curl['ssl_version'] ),
+                       );
+               } else {
+                       $info['wp-server']['fields']['curl_version'] = array(
+                               'label' => __( 'cURL version' ),
+                               'value' => __( 'Not available' ),
+                       );
+               }
+
+               $info['wp-server']['fields']['suhosin'] = array(
+                       'label' => __( 'Is SUHOSIN installed?' ),
+                       'value' => ( ( extension_loaded( 'suhosin' ) || ( defined( 'SUHOSIN_PATCH' ) && constant( 'SUHOSIN_PATCH' ) ) ) ? __( 'Yes' ) : __( 'No' ) ),
+               );
+
+               $info['wp-server']['fields']['imagick_availability'] = array(
+                       'label' => __( 'Is the Imagick library available?' ),
+                       'value' => ( extension_loaded( 'imagick' ) ? __( 'Yes' ) : __( 'No' ) ),
+               );
+
+               // Check if a .htaccess file exists.
+               if ( is_file( ABSPATH . '/.htaccess' ) ) {
+                       // If the file exists, grab the content of it.
+                       $htaccess_content = file_get_contents( ABSPATH . '/.htaccess' );
+
+                       // Filter away the core WordPress rules.
+                       $filtered_htaccess_content = trim( preg_replace( '/\# BEGIN WordPress[\s\S]+?# END WordPress/si', '', $htaccess_content ) );
+
+                       $info['wp-server']['fields']['htaccess_extra_rules'] = array(
+                               'label' => __( 'htaccess rules' ),
+                               'value' => ( ! empty( $filtered_htaccess_content ) ? __( 'Custom rules have been added to your htaccess file.' ) : __( 'Your htaccess file contains only core WordPress features.' ) ),
+                       );
+               }
+
+               // Populate the database debug fields.
+               if ( is_resource( $wpdb->dbh ) ) {
+                       // Old mysql extension.
+                       $extension = 'mysql';
+               } elseif ( is_object( $wpdb->dbh ) ) {
+                       // mysqli or PDO.
+                       $extension = get_class( $wpdb->dbh );
+               } else {
+                       // Unknown sql extension.
+                       $extension = null;
+               }
+
+               /*
+                * Check what database engine is used, this will throw compatibility
+                * warnings from PHP compatibility testers, but `mysql_*` is
+                * still valid in PHP 5.6, so we need to account for that.
+                */
+               if ( method_exists( $wpdb, 'db_version' ) ) {
+                       if ( $wpdb->use_mysqli ) {
+                               // phpcs:ignore WordPress.DB.RestrictedFunctions.mysql_mysqli_get_server_info
+                               $server = mysqli_get_server_info( $wpdb->dbh );
+                       } else {
+                               // phpcs:ignore WordPress.DB.RestrictedFunctions.mysql_mysql_get_server_info
+                               $server = mysql_get_server_info( $wpdb->dbh );
+                       }
+               } else {
+                       $server = null;
+               }
+
+               if ( isset( $wpdb->use_mysqli ) && $wpdb->use_mysqli ) {
+                       $client_version = $wpdb->dbh->client_info;
+               } else {
+                       // phpcs:ignore WordPress.DB.RestrictedFunctions.mysql_mysql_get_client_info
+                       if ( preg_match( '|[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}|', mysql_get_client_info(), $matches ) ) {
+                               $client_version = $matches[0];
+                       } else {
+                               $client_version = null;
+                       }
+               }
+
+               $info['wp-database']['fields']['extension']       = array(
+                       'label' => __( 'Extension' ),
+                       'value' => $extension,
+               );
+               $info['wp-database']['fields']['server_version']  = array(
+                       'label' => __( 'Server version' ),
+                       'value' => $server,
+               );
+               $info['wp-database']['fields']['client_version']  = array(
+                       'label' => __( 'Client version' ),
+                       'value' => $client_version,
+               );
+               $info['wp-database']['fields']['database_user']   = array(
+                       'label'   => __( 'Database user' ),
+                       'value'   => $wpdb->dbuser,
+                       'private' => true,
+               );
+               $info['wp-database']['fields']['database_host']   = array(
+                       'label'   => __( 'Database host' ),
+                       'value'   => $wpdb->dbhost,
+                       'private' => true,
+               );
+               $info['wp-database']['fields']['database_name']   = array(
+                       'label'   => __( 'Database name' ),
+                       'value'   => $wpdb->dbname,
+                       'private' => true,
+               );
+               $info['wp-database']['fields']['database_prefix'] = array(
+                       'label'   => __( 'Database prefix' ),
+                       'value'   => $wpdb->prefix,
+                       'private' => true,
+               );
+
+               // List must use plugins if there are any.
+               $mu_plugins = get_mu_plugins();
+
+               foreach ( $mu_plugins as $plugin_path => $plugin ) {
+                       $plugin_version = $plugin['Version'];
+                       $plugin_author  = $plugin['Author'];
+
+                       $plugin_version_string = __( 'No version or author information is available.' );
+
+                       if ( ! empty( $plugin_version ) && ! empty( $plugin_author ) ) {
+                               // translators: %1$s: Plugin version number. %2$s: Plugin author name.
+                               $plugin_version_string = sprintf( __( 'Version %1$s by %2$s' ), $plugin_version, $plugin_author );
+                       }
+                       if ( empty( $plugin_version ) && ! empty( $plugin_author ) ) {
+                               // translators: %s: Plugin author name.
+                               $plugin_version_string = sprintf( __( 'By %s' ), $plugin_author );
+                       }
+                       if ( ! empty( $plugin_version ) && empty( $plugin_author ) ) {
+                               // translators: %s: Plugin version number.
+                               $plugin_version_string = sprintf( __( 'Version %s' ), $plugin_version );
+                       }
+
+                       $info['wp-mu-plugins']['fields'][ sanitize_key( $plugin['Name'] ) ] = array(
+                               'label' => $plugin['Name'],
+                               'value' => $plugin_version_string,
+                       );
+               }
+
+               // List all available plugins.
+               $plugins        = get_plugins();
+               $plugin_updates = get_plugin_updates();
+
+               foreach ( $plugins as $plugin_path => $plugin ) {
+                       $plugin_part = ( is_plugin_active( $plugin_path ) ) ? 'wp-plugins-active' : 'wp-plugins-inactive';
+
+                       $plugin_version = $plugin['Version'];
+                       $plugin_author  = $plugin['Author'];
+
+                       $plugin_version_string = __( 'No version or author information is available.' );
+
+                       if ( ! empty( $plugin_version ) && ! empty( $plugin_author ) ) {
+                               // translators: %1$s: Plugin version number. %2$s: Plugin author name.
+                               $plugin_version_string = sprintf( __( 'Version %1$s by %2$s' ), $plugin_version, $plugin_author );
+                       }
+                       if ( empty( $plugin_version ) && ! empty( $plugin_author ) ) {
+                               // translators: %s: Plugin author name.
+                               $plugin_version_string = sprintf( __( 'By %s' ), $plugin_author );
+                       }
+                       if ( ! empty( $plugin_version ) && empty( $plugin_author ) ) {
+                               // translators: %s: Plugin version number.
+                               $plugin_version_string = sprintf( __( 'Version %s' ), $plugin_version );
+                       }
+
+                       if ( array_key_exists( $plugin_path, $plugin_updates ) ) {
+                               // translators: %s: Latest plugin version number.
+                               $plugin_update_needed = ' ' . sprintf( __( '(Latest version: %s)' ), $plugin_updates[ $plugin_path ]->update->new_version );
+                       } else {
+                               $plugin_update_needed = '';
+                       }
+
+                       $info[ $plugin_part ]['fields'][ sanitize_key( $plugin['Name'] ) ] = array(
+                               'label' => $plugin['Name'],
+                               'value' => $plugin_version_string . $plugin_update_needed,
+                       );
+               }
+
+               // Populate the section for the currently active theme.
+               global $_wp_theme_features;
+               $theme_features = array();
+               if ( ! empty( $_wp_theme_features ) ) {
+                       foreach ( $_wp_theme_features as $feature => $options ) {
+                               $theme_features[] = $feature;
+                       }
+               }
+
+               $active_theme  = wp_get_theme();
+               $theme_updates = get_theme_updates();
+
+               if ( array_key_exists( $active_theme->stylesheet, $theme_updates ) ) {
+                       // translators: %s: Latest theme version number.
+                       $theme_update_needed_active = ' ' . sprintf( __( '(Latest version: %s)' ), $theme_updates[ $active_theme->stylesheet ]->update['new_version'] );
+               } else {
+                       $theme_update_needed_active = '';
+               }
+
+               $info['wp-active-theme']['fields'] = array(
+                       'name'           => array(
+                               'label' => __( 'Name' ),
+                               // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
+                               'value' => $active_theme->Name,
+                       ),
+                       'version'        => array(
+                               'label' => __( 'Version' ),
+                               // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
+                               'value' => $active_theme->Version . $theme_update_needed_active,
+                       ),
+                       'author'         => array(
+                               'label' => __( 'Author' ),
+                               // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
+                               'value' => wp_kses( $active_theme->Author, array() ),
+                       ),
+                       'author_website' => array(
+                               'label' => __( 'Author website' ),
+                               'value' => ( $active_theme->offsetGet( 'Author URI' ) ? $active_theme->offsetGet( 'Author URI' ) : __( 'Undefined' ) ),
+                       ),
+                       'parent_theme'   => array(
+                               'label' => __( 'Parent theme' ),
+                               'value' => ( $active_theme->parent_theme ? $active_theme->parent_theme : __( 'None' ) ),
+                       ),
+                       'theme_features' => array(
+                               'label' => __( 'Theme features' ),
+                               'value' => implode( ', ', $theme_features ),
+                       ),
+               );
+
+               // Populate a list of all themes available in the install.
+               $all_themes = wp_get_themes();
+
+               foreach ( $all_themes as $theme_slug => $theme ) {
+                       // Ignore the currently active theme from the list of all themes.
+                       if ( $active_theme->stylesheet == $theme_slug ) {
+                               continue;
+                       }
+                       // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
+                       $theme_version = $theme->Version;
+                       // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
+                       $theme_author = $theme->Author;
+
+                       $theme_version_string = __( 'No version or author information is available.' );
+
+                       if ( ! empty( $theme_version ) && ! empty( $theme_author ) ) {
+                               // translators: %1$s: Theme version number. %2$s: Theme author name.
+                               $theme_version_string = sprintf( __( 'Version %1$s by %2$s' ), $theme_version, wp_kses( $theme_author, array() ) );
+                       }
+                       if ( empty( $theme_version ) && ! empty( $theme_author ) ) {
+                               // translators: %s: Theme author name.
+                               $theme_version_string = sprintf( __( 'By %s' ), wp_kses( $theme_author, array() ) );
+                       }
+                       if ( ! empty( $theme_version ) && empty( $theme_author ) ) {
+                               // translators: %s: Theme version number.
+                               $theme_version_string = sprintf( __( 'Version %s' ), $theme_version );
+                       }
+
+                       if ( array_key_exists( $theme_slug, $theme_updates ) ) {
+                               // translators: %s: Latest theme version number.
+                               $theme_update_needed = ' ' . sprintf( __( '(Latest version: %s)' ), $theme_updates[ $theme_slug ]->update['new_version'] );
+                       } else {
+                               $theme_update_needed = '';
+                       }
+
+                       $info['wp-themes']['fields'][ sanitize_key( $theme->Name ) ] = array(
+                               'label' => sprintf(
+                                       // translators: %1$s: Theme name. %2$s: Theme slug.
+                                       __( '%1$s (%2$s)' ),
+                                       // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
+                                       $theme->Name,
+                                       $theme_slug
+                               ),
+                               'value' => $theme_version_string . $theme_update_needed,
+                       );
+               }
+
+               // Add more filesystem checks
+               if ( defined( 'WPMU_PLUGIN_DIR' ) && is_dir( WPMU_PLUGIN_DIR ) ) {
+                       $info['wp-filesystem']['fields']['mu_plugin_directory'] = array(
+                               'label' => __( 'The must use plugins directory' ),
+                               'value' => ( wp_is_writable( WPMU_PLUGIN_DIR ) ? __( 'Writable' ) : __( 'Not writable' ) ),
+                       );
+               }
+
+               /**
+                * Add or modify new debug sections.
+                *
+                * Plugin or themes may wish to introduce their own debug information without creating additional admin pages for this
+                * kind of information as it is rarely needed, they can then utilize this filter to introduce their own sections.
+                *
+                * Array keys added by core are all prefixed with `wp-`, plugins and themes are encouraged to use their own slug as
+                * a prefix, both for consistency as well as avoiding key collisions.
+                *
+                * @since 5.2.0
+                *
+                * @param array $args {
+                *     The debug information to be added to the core information page.
+                *
+                *     @type string  $label        The title for this section of the debug output.
+                *     @type string  $description  Optional. A description for your information section which may contain basic HTML
+                *                                 markup: `em`, `strong` and `a` for linking to documentation or putting emphasis.
+                *     @type boolean $show_count   Optional. If set to `true` the amount of fields will be included in the title for
+                *                                 this section.
+                *     @type boolean $private      Optional. If set to `true` the section and all associated fields will be excluded
+                *                                 from the copy-paste text area.
+                *     @type array   $fields {
+                *         An associative array containing the data to be displayed.
+                *
+                *         @type string  $label    The label for this piece of information.
+                *         @type string  $value    The output that is of interest for this field.
+                *         @type boolean $private  Optional. If set to `true` the field will not be included in the copy-paste text area
+                *                                 on top of the page, allowing you to show, for example, API keys here.
+                *     }
+                * }
+                */
+               $info = apply_filters( 'debug_information', $info );
+
+               if ( ! empty( $locale ) ) {
+                       // Change the language used for translations
+                       if ( function_exists( 'restore_previous_locale' ) && $switched_locale ) {
+                               restore_previous_locale();
+                       }
+               }
+
+               return $info;
+       }
+
+       /**
+        * Print the formatted variation of the information gathered for debugging, in a manner
+        * suitable for a text area that can be instantly copied to a forum or support ticket.
+        *
+        * @since 5.2.0
+        *
+        * @param array $info_array Information gathered from the `WP_Debug_Data::debug_data` function.
+        */
+       public static function textarea_format( $info_array ) {
+               echo "`\n";
+
+               foreach ( $info_array as $section => $details ) {
+                       // Skip this section if there are no fields, or the section has been declared as private.
+                       if ( empty( $details['fields'] ) || ( isset( $details['private'] ) && $details['private'] ) ) {
+                               continue;
+                       }
+
+                       printf(
+                               "### %s%s ###\n\n",
+                               $details['label'],
+                               ( isset( $details['show_count'] ) && $details['show_count'] ? sprintf( ' (%d)', count( $details['fields'] ) ) : '' )
+                       );
+
+                       foreach ( $details['fields'] as $field ) {
+                               if ( isset( $field['private'] ) && true === $field['private'] ) {
+                                       continue;
+                               }
+
+                               $values = $field['value'];
+                               if ( is_array( $field['value'] ) ) {
+                                       $values = '';
+
+                                       foreach ( $field['value'] as $name => $value ) {
+                                               $values .= sprintf(
+                                                       "\n\t%s: %s",
+                                                       $name,
+                                                       $value
+                                               );
+                                       }
+                               }
+
+                               printf(
+                                       "%s: %s\n",
+                                       $field['label'],
+                                       $values
+                               );
+                       }
+                       echo "\n";
+               }
+               echo '`';
+       }
+
+       /**
+        * Return the size of a directory, including all subdirectories.
+        *
+        * @since 5.2.0
+        *
+        * @param string     $path                 The directory to check.
+        * @param string|int $max_execution_time   How long a PHP script can run on this host.
+        * @param float      $start_execution_time When we started executing this section of the script.
+        *
+        * @return int The directory size, in bytes.
+        */
+       public static function get_directory_size( $path, $max_execution_time, $start_execution_time ) {
+               $size = 0;
+
+               foreach ( new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $path ) ) as $file ) {
+                       // Check if the maximum execution time is a value considered "infinite".
+                       if ( 0 !== $max_execution_time && -1 !== $max_execution_time ) {
+                               $runtime = ( microtime( true ) - $start_execution_time );
+
+                               // If the script has been running as long, or longer, as it is allowed, return a failure message.
+                               if ( $runtime >= $max_execution_time ) {
+                                       return -1;
+                               }
+                       }
+                       $size += $file->getSize();
+               }
+
+               return $size;
+       }
+
+       /**
+        * Fetch the total size of all the database tables for the active database user.
+        *
+        * @since 5.2.0
+        *
+        * @return int The size of the database, in bytes.
+        */
+       public static function get_database_size() {
+               global $wpdb;
+               $size = 0;
+               $rows = $wpdb->get_results( 'SHOW TABLE STATUS', ARRAY_A );
+
+               if ( $wpdb->num_rows > 0 ) {
+                       foreach ( $rows as $row ) {
+                               $size += $row['Data_length'] + $row['Index_length'];
+                       }
+               }
+
+               return $size;
+       }
+}
</ins></span></pre></div>
<a id="trunksrcwpadminincludesclasswpsitehealthautoupdatesphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/src/wp-admin/includes/class-wp-site-health-auto-updates.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/includes/class-wp-site-health-auto-updates.php                         (rev 0)
+++ trunk/src/wp-admin/includes/class-wp-site-health-auto-updates.php   2019-03-23 03:54:16 UTC (rev 44986)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,434 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/**
+ * Class for testing automatic updates in the WordPress code.
+ *
+ * @package WordPress
+ * @subpackage Site_Health
+ * @since 5.2.0
+ */
+
+class WP_Site_Health_Auto_Updates {
+       /**
+        * WP_Site_Health_Auto_Updates constructor.
+        * @since 5.2.0
+        */
+       public function __construct() {
+               include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
+       }
+
+
+       /**
+        * Run tests to determine if auto-updates can run.
+        *
+        * @since 5.2.0
+        *
+        * @return array The test results.
+        */
+       public function run_tests() {
+               $tests = array(
+                       $this->test_constants( 'DISALLOW_FILE_MODS', false ),
+                       $this->test_constants( 'AUTOMATIC_UPDATER_DISABLED', false ),
+                       $this->test_constants( 'WP_AUTO_UPDATE_CORE', true ),
+                       $this->test_wp_version_check_attached(),
+                       $this->test_filters_automatic_updater_disabled(),
+                       $this->test_if_failed_update(),
+                       $this->test_vcs_abspath(),
+                       $this->test_check_wp_filesystem_method(),
+                       $this->test_all_files_writable(),
+                       $this->test_accepts_dev_updates(),
+                       $this->test_accepts_minor_updates(),
+               );
+
+               $tests = array_filter( $tests );
+               $tests = array_map(
+                       function( $test ) {
+                               $test = (object) $test;
+
+                               if ( empty( $test->severity ) ) {
+                                       $test->severity = 'warning';
+                               }
+
+                               return $test;
+                       },
+                       $tests
+               );
+
+               return $tests;
+       }
+
+       /**
+        * Test if auto-updated related constants are set correctly.
+        *
+        * @since 5.2.0
+        *
+        * @param string $constant The name of the constant to check.
+        * @param bool   $value    The value that the constant should be, if set.
+        * @return array The test results.
+        */
+       public function test_constants( $constant, $value ) {
+               if ( defined( $constant ) && constant( $constant ) != $allowed_constants[ $constant ] ) {
+                       return array(
+                               'description' => sprintf(
+                                       /* translators: %s: Name of the constant used. */
+                                       __( 'The %s constant is defined and enabled.' ),
+                                       "<code>$constant</code>"
+                               ),
+                               'severity'    => 'fail',
+                       );
+               }
+       }
+
+       /**
+        * Check if updates are intercepted by a filter.
+        *
+        * @since 5.2.0
+        *
+        * @return array The test results.
+        */
+       public function test_wp_version_check_attached() {
+               $cookies = wp_unslash( $_COOKIE );
+               $timeout = 10;
+               $headers = array(
+                       'Cache-Control' => 'no-cache',
+               );
+
+               // Include Basic auth in loopback requests.
+               if ( isset( $_SERVER['PHP_AUTH_USER'] ) && isset( $_SERVER['PHP_AUTH_PW'] ) ) {
+                       $headers['Authorization'] = 'Basic ' . base64_encode( wp_unslash( $_SERVER['PHP_AUTH_USER'] ) . ':' . wp_unslash( $_SERVER['PHP_AUTH_PW'] ) );
+               }
+
+               $url = add_query_arg(
+                       array(
+                               'health-check-test-wp_version_check' => true,
+                       ),
+                       admin_url()
+               );
+
+               $test = wp_remote_get( $url, compact( 'cookies', 'headers', 'timeout' ) );
+
+               $response = wp_remote_retrieve_body( $test );
+
+               if ( 'yes' !== $response ) {
+                       return array(
+                               'description' => sprintf(
+                                       /* translators: %s: Name of the filter used. */
+                                       __( 'A plugin has prevented updates by disabling %s.' ),
+                                       '<code>wp_version_check()</code>'
+                               ),
+                               'severity'    => 'fail',
+                       );
+               }
+       }
+
+       /**
+        * Check if automatic updates are disabled by a filter.
+        *
+        * @since 5.2.0
+        *
+        * @return array The test results.
+        */
+       public function test_filters_automatic_updater_disabled() {
+               if ( apply_filters( 'automatic_updater_disabled', false ) ) {
+                       return array(
+                               'description' => sprintf(
+                                       /* translators: %s: Name of the filter used. */
+                                       __( 'The %s filter is enabled.' ),
+                                       '<code>automatic_updater_disabled</code>'
+                               ),
+                               'severity'    => 'fail',
+                       );
+               }
+       }
+
+       /**
+        * Check if automatic updates have tried to run, but failed, previously.
+        *
+        * @since 5.2.0
+        *
+        * @return array|bool The test results. false if the auto updates failed.
+        */
+       function test_if_failed_update() {
+               $failed = get_site_option( 'auto_core_update_failed' );
+
+               if ( ! $failed ) {
+                       return false;
+               }
+
+               if ( ! empty( $failed['critical'] ) ) {
+                       $description  = __( 'A previous automatic background update ended with a critical failure, so updates are now disabled.' );
+                       $description .= ' ' . __( 'You would have received an email because of this.' );
+                       $description .= ' ' . __( "When you've been able to update using the \"Update Now\" button on Dashboard > Updates, we'll clear this error for future update attempts." );
+                       $description .= ' ' . sprintf(
+                               /* translators: %s: Code of error shown. */
+                               __( 'The error code was %s.' ),
+                               '<code>' . $failed['error_code'] . '</code>'
+                       );
+                       return array(
+                               'description' => $description,
+                               'severity'    => 'warning',
+                       );
+               }
+
+               $description = __( 'A previous automatic background update could not occur.' );
+               if ( empty( $failed['retry'] ) ) {
+                       $description .= ' ' . __( 'You would have received an email because of this.' );
+               }
+
+               $description .= ' ' . __( "We'll try again with the next release." );
+               $description .= ' ' . sprintf(
+                       /* translators: %s: Code of error shown. */
+                       __( 'The error code was %s.' ),
+                       '<code>' . $failed['error_code'] . '</code>'
+               );
+               return array(
+                       'description' => $description,
+                       'severity'    => 'warning',
+               );
+       }
+
+       /**
+        * Check if WordPress is controlled by a VCS (Git, Subversion etc).
+        *
+        * @since 5.2.0
+        *
+        * @return array The test results.
+        */
+       public function test_vcs_abspath() {
+               $context_dirs = array( ABSPATH );
+               $vcs_dirs     = array( '.svn', '.git', '.hg', '.bzr' );
+               $check_dirs   = array();
+
+               foreach ( $context_dirs as $context_dir ) {
+                       // Walk up from $context_dir to the root.
+                       do {
+                               $check_dirs[] = $context_dir;
+
+                               // Once we've hit '/' or 'C:\', we need to stop. dirname will keep returning the input here.
+                               if ( dirname( $context_dir ) == $context_dir ) {
+                                       break;
+                               }
+
+                               // Continue one level at a time.
+                       } while ( $context_dir = dirname( $context_dir ) );
+               }
+
+               $check_dirs = array_unique( $check_dirs );
+
+               // Search all directories we've found for evidence of version control.
+               foreach ( $vcs_dirs as $vcs_dir ) {
+                       foreach ( $check_dirs as $check_dir ) {
+                               // phpcs:ignore
+                               if ( $checkout = @is_dir( rtrim( $check_dir, '\\/' ) . "/$vcs_dir" ) ) {
+                                       break 2;
+                               }
+                       }
+               }
+
+               if ( $checkout && ! apply_filters( 'automatic_updates_is_vcs_checkout', true, ABSPATH ) ) {
+                       return array(
+                               'description' => sprintf(
+                                       // translators: %1$s: Folder name. %2$s: Version control directory. %3$s: Filter name.
+                                       __( 'The folder %1$s was detected as being under version control (%2$s), but the %3$s filter is allowing updates.' ),
+                                       '<code>' . $check_dir . '</code>',
+                                       "<code>$vcs_dir</code>",
+                                       '<code>automatic_updates_is_vcs_checkout</code>'
+                               ),
+                               'severity'    => 'info',
+                       );
+               }
+
+               if ( $checkout ) {
+                       return array(
+                               'description' => sprintf(
+                                       // translators: %1$s: Folder name. %2$s: Version control directory.
+                                       __( 'The folder %1$s was detected as being under version control (%2$s).' ),
+                                       '<code>' . $check_dir . '</code>',
+                                       "<code>$vcs_dir</code>"
+                               ),
+                               'severity'    => 'fail',
+                       );
+               }
+
+               return array(
+                       'description' => __( 'No version control systems were detected.' ),
+                       'severity'    => 'pass',
+               );
+       }
+
+       /**
+        * Check if we can access files without providing credentials.
+        *
+        * @since 5.2.0
+        *
+        * @return array The test results.
+        */
+       function test_check_wp_filesystem_method() {
+               $skin    = new Automatic_Upgrader_Skin;
+               $success = $skin->request_filesystem_credentials( false, ABSPATH );
+
+               if ( ! $success ) {
+                       $description  = __( 'Your installation of WordPress prompts for FTP credentials to perform updates.' );
+                       $description .= ' ' . __( '(Your site is performing updates over FTP due to file ownership. Talk to your hosting company.)' );
+
+                       return array(
+                               'description' => $description,
+                               'severity'    => 'fail',
+                       );
+               }
+
+               return array(
+                       'description' => __( "Your installation of WordPress doesn't require FTP credentials to perform updates." ),
+                       'severity'    => 'pass',
+               );
+       }
+
+       /**
+        * Check if core files are writable by the web user/group.
+        *
+        * @since 5.2.0
+        *
+        * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass.
+        *
+        * @return array|bool The test results. false if they're not writeable.
+        */
+       function test_all_files_writable() {
+               global $wp_filesystem;
+
+               include ABSPATH . WPINC . '/version.php'; // $wp_version; // x.y.z
+
+               $skin    = new Automatic_Upgrader_Skin;
+               $success = $skin->request_filesystem_credentials( false, ABSPATH );
+
+               if ( ! $success ) {
+                       return false;
+               }
+
+               WP_Filesystem();
+
+               if ( 'direct' != $wp_filesystem->method ) {
+                       return false;
+               }
+
+               $checksums = get_core_checksums( $wp_version, 'en_US' );
+               $dev       = ( false !== strpos( $wp_version, '-' ) );
+               // Get the last stable version's files and test against that
+               if ( ! $checksums && $dev ) {
+                       $checksums = get_core_checksums( (float) $wp_version - 0.1, 'en_US' );
+               }
+
+               // There aren't always checksums for development releases, so just skip the test if we still can't find any
+               if ( ! $checksums && $dev ) {
+                       return false;
+               }
+
+               if ( ! $checksums ) {
+                       $description = sprintf(
+                               // translators: %s: WordPress version
+                               __( "Couldn't retrieve a list of the checksums for WordPress %s." ),
+                               $wp_version
+                       );
+                       $description .= ' ' . __( 'This could mean that connections are failing to WordPress.org.' );
+                       return array(
+                               'description' => $description,
+                               'severity'    => 'warning',
+                       );
+               }
+
+               $unwritable_files = array();
+               foreach ( array_keys( $checksums ) as $file ) {
+                       if ( 'wp-content' == substr( $file, 0, 10 ) ) {
+                               continue;
+                       }
+                       if ( ! file_exists( ABSPATH . '/' . $file ) ) {
+                               continue;
+                       }
+                       if ( ! is_writable( ABSPATH . '/' . $file ) ) {
+                               $unwritable_files[] = $file;
+                       }
+               }
+
+               if ( $unwritable_files ) {
+                       if ( count( $unwritable_files ) > 20 ) {
+                               $unwritable_files   = array_slice( $unwritable_files, 0, 20 );
+                               $unwritable_files[] = '...';
+                       }
+                       return array(
+                               'description' => __( 'Some files are not writable by WordPress:' ) . ' <ul><li>' . implode( '</li><li>', $unwritable_files ) . '</li></ul>',
+                               'severity'    => 'fail',
+                       );
+               } else {
+                       return array(
+                               'description' => __( 'All of your WordPress files are writable.' ),
+                               'severity'    => 'pass',
+                       );
+               }
+       }
+
+       /**
+        * Check if the install is using a development branch and can use nightly packages.
+        *
+        * @since 5.2.0
+        *
+        * @return array|bool The test results. false if it isn't a development version.
+        */
+       function test_accepts_dev_updates() {
+               include ABSPATH . WPINC . '/version.php'; // $wp_version; // x.y.z
+               // Only for dev versions
+               if ( false === strpos( $wp_version, '-' ) ) {
+                       return false;
+               }
+
+               if ( defined( 'WP_AUTO_UPDATE_CORE' ) && ( 'minor' === WP_AUTO_UPDATE_CORE || false === WP_AUTO_UPDATE_CORE ) ) {
+                       return array(
+                               'description' => sprintf(
+                                       /* translators: %s: Name of the constant used. */
+                                       __( 'WordPress development updates are blocked by the %s constant.' ),
+                                       '<code>WP_AUTO_UPDATE_CORE</code>'
+                               ),
+                               'severity'    => 'fail',
+                       );
+               }
+
+               if ( ! apply_filters( 'allow_dev_auto_core_updates', $wp_version ) ) {
+                       return array(
+                               'description' => sprintf(
+                                       /* translators: %s: Name of the filter used. */
+                                       __( 'WordPress development updates are blocked by the %s filter.' ),
+                                       '<code>allow_dev_auto_core_updates</code>'
+                               ),
+                               'severity'    => 'fail',
+                       );
+               }
+       }
+
+       /**
+        * Check if the site supports automatic minor updates.
+        *
+        * @since 5.2.0
+        *
+        * @return array The test results.
+        */
+       function test_accepts_minor_updates() {
+               if ( defined( 'WP_AUTO_UPDATE_CORE' ) && false === WP_AUTO_UPDATE_CORE ) {
+                       return array(
+                               'description' => sprintf(
+                                       /* translators: %s: Name of the constant used. */
+                                       __( 'WordPress security and maintenance releases are blocked by %s.' ),
+                                       "<code>define( 'WP_AUTO_UPDATE_CORE', false );</code>"
+                               ),
+                               'severity'    => 'fail',
+                       );
+               }
+
+               if ( ! apply_filters( 'allow_minor_auto_core_updates', true ) ) {
+                       return array(
+                               'description' => sprintf(
+                                       /* translators: %s: Name of the filter used. */
+                                       __( 'WordPress security and maintenance releases are blocked by the %s filter.' ),
+                                       '<code>allow_minor_auto_core_updates</code>'
+                               ),
+                               'severity'    => 'fail',
+                       );
+               }
+       }
+}
</ins></span></pre></div>
<a id="trunksrcwpadminincludesclasswpsitehealthphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/src/wp-admin/includes/class-wp-site-health.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/includes/class-wp-site-health.php                              (rev 0)
+++ trunk/src/wp-admin/includes/class-wp-site-health.php        2019-03-23 03:54:16 UTC (rev 44986)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,1924 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/**
+ * Class for looking up a sites health based on a users WordPress environment.
+ *
+ * @package WordPress
+ * @subpackage Site_Health
+ * @since 5.2.0
+ */
+
+class WP_Site_Health {
+       private $mysql_min_version_check;
+       private $mysql_rec_version_check;
+
+       public  $is_mariadb                          = false;
+       private $mysql_server_version                = '';
+       private $health_check_mysql_required_version = '5.5';
+       private $health_check_mysql_rec_version      = '';
+
+       public $schedules;
+       public $crons;
+       public $last_missed_cron = null;
+
+       /**
+        * WP_Site_Health constructor.
+        *
+        * @since 5.2.0
+        */
+       public function __construct() {
+               $this->prepare_sql_data();
+
+               add_action( 'wp_loaded', array( $this, 'check_wp_version_check_exists' ) );
+
+               add_filter( 'admin_body_class', array( $this, 'admin_body_class' ) );
+
+               add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
+       }
+
+       /**
+        * Enqueues the site health scripts.
+        *
+        * @since 5.2.0
+        */
+       public function enqueue_scripts() {
+               $screen = get_current_screen();
+               if ( 'site-health' !== $screen->id ) {
+                       return;
+               }
+
+               $health_check_js_variables = array(
+                       'screen'      => $screen->id,
+                       'string'      => array(
+                               'please_wait'                        => __( 'Please wait...' ),
+                               'copied'                             => __( 'Copied' ),
+                               'running_tests'                      => __( 'Currently being tested...' ),
+                               'site_health_complete'               => __( 'All site health tests have finished running.' ),
+                               'site_info_show_copy'                => __( 'Show options for copying this information' ),
+                               'site_info_hide_copy'                => __( 'Hide options for copying this information' ),
+                               // translators: %s: The percentage score for the tests.
+                               'site_health_complete_screen_reader' => __( 'All site health tests have finished running. Your site scored %s, and the results are now available on the page.' ),
+                               'site_info_copied'                   => __( 'Site information has been added to your clipboard.' ),
+                       ),
+                       'nonce'       => array(
+                               'site_status'        => wp_create_nonce( 'health-check-site-status' ),
+                               'site_status_result' => wp_create_nonce( 'health-check-site-status-result' ),
+                       ),
+                       'site_status' => array(
+                               'direct' => array(),
+                               'async'  => array(),
+                               'issues' => array(
+                                       'good'        => 0,
+                                       'recommended' => 0,
+                                       'critical'    => 0,
+                               ),
+                       ),
+               );
+
+               $issue_counts = get_transient( 'health-check-site-status-result' );
+
+               if ( false !== $issue_counts ) {
+                       $issue_counts = json_decode( $issue_counts );
+
+                       $health_check_js_variables['site_status']['issues'] = $issue_counts;
+               }
+
+               if ( 'site-health' === $screen->id && ! isset( $_GET['tab'] ) ) {
+                       $tests = WP_Site_Health::get_tests();
+                       // Don't run https test on localhost
+                       if ( 'localhost' === preg_replace( '|https?://|', '', get_site_url() ) ) {
+                               unset( $tests['direct']['https_status'] );
+                       }
+                       foreach ( $tests['direct'] as $test ) {
+                               $test_function = sprintf(
+                                       'get_test_%s',
+                                       $test['test']
+                               );
+
+                               if ( method_exists( $this, $test_function ) && is_callable( array( $this, $test_function ) ) ) {
+                                       $health_check_js_variables['site_status']['direct'][] = call_user_func( array( $this, $test_function ) );
+                               } else {
+                                       $health_check_js_variables['site_status']['direct'][] = call_user_func( $test['test'] );
+                               }
+                       }
+
+                       foreach ( $tests['async'] as $test ) {
+                               $health_check_js_variables['site_status']['async'][] = array(
+                                       'test'      => $test['test'],
+                                       'completed' => false,
+                               );
+                       }
+               }
+
+               wp_localize_script( 'site-health', 'SiteHealth', $health_check_js_variables );
+       }
+
+       /**
+        * Run the SQL version checks.
+        *
+        * These values are used in later tests, but the part of preparing them is more easily managed early
+        * in the class for ease of access and discovery.
+        *
+        * @since 5.2.0
+        *
+        * @global wpdb $wpdb WordPress database abstraction object.
+        */
+       private function prepare_sql_data() {
+               global $wpdb;
+
+               if ( method_exists( $wpdb, 'db_version' ) ) {
+                       if ( $wpdb->use_mysqli ) {
+                               // phpcs:ignore WordPress.DB.RestrictedFunctions.mysql_mysqli_get_server_info
+                               $mysql_server_type = mysqli_get_server_info( $wpdb->dbh );
+                       } else {
+                               // phpcs:ignore WordPress.DB.RestrictedFunctions.mysql_mysql_get_server_info
+                               $mysql_server_type = mysql_get_server_info( $wpdb->dbh );
+                       }
+
+                       $this->mysql_server_version = $wpdb->get_var( 'SELECT VERSION()' );
+               }
+
+               $this->health_check_mysql_rec_version = '5.6';
+
+               if ( stristr( $mysql_server_type, 'mariadb' ) ) {
+                       $this->is_mariadb                     = true;
+                       $this->health_check_mysql_rec_version = '10.0';
+               }
+
+               $this->mysql_min_version_check = version_compare( '5.5', $this->mysql_server_version, '<=' );
+               $this->mysql_rec_version_check = version_compare( $this->health_check_mysql_rec_version, $this->mysql_server_version, '<=' );
+       }
+
+       /**
+        * Test if `wp_version_check` is blocked.
+        *
+        * It's possible to block updates with the `wp_version_check` filter, but this can't be checked during an
+        * AJAX call, as the filter is never introduced then.
+        *
+        * This filter overrides a normal page request if it's made by an admin through the AJAX call with the
+        * right query argument to check for this.
+        *
+        * @since 5.2.0
+        */
+       public function check_wp_version_check_exists() {
+               if ( ! is_admin() || ! is_user_logged_in() || ! current_user_can( 'update_core' ) || ! isset( $_GET['health-check-test-wp_version_check'] ) ) {
+                       return;
+               }
+
+               echo ( has_filter( 'wp_version_check', 'wp_version_check' ) ? 'yes' : 'no' );
+
+               die();
+       }
+
+       /**
+        * Tests for WordPress version and outputs it.
+        *
+        * Gives various results depending on what kind of updates are available, if any, to encourage the
+        * user to install security updates as a priority.
+        *
+        * @since 5.2.0
+        *
+        * @return array The test result.
+        */
+       public function get_test_wordpress_version() {
+               $result = array(
+                       'label'       => '',
+                       'status'      => '',
+                       'badge'       => array(
+                               'label' => 'Security',
+                               'color' => 'red',
+                       ),
+                       'description' => '',
+                       'actions'     => '',
+                       'test'        => 'wordpress_version',
+               );
+
+               $core_current_version = get_bloginfo( 'version' );
+               $core_updates         = get_core_updates();
+
+               if ( ! is_array( $core_updates ) ) {
+                       $result['status'] = 'recommended';
+
+                       $result['label'] = sprintf(
+                               // translators: %s: Your current version of WordPress.
+                               __( 'WordPress version %s' ),
+                               $core_current_version
+                       );
+
+                       $result['description'] = sprintf(
+                               '<p>%s</p>',
+                               __( 'We were unable to check if any new versions of WordPress are available.' )
+                       );
+
+                       $result['actions'] = sprintf(
+                               '<a href="%s">%s</a>',
+                               esc_url( admin_url( 'update-core.php?force-check=1' ) ),
+                               __( 'Check for updates manually' )
+                       );
+               } else {
+                       foreach ( $core_updates as $core => $update ) {
+                               if ( 'upgrade' === $update->response ) {
+                                       $current_version = explode( '.', $core_current_version );
+                                       $new_version     = explode( '.', $update->version );
+
+                                       $current_major = $current_version[0] . '.' . $current_version[1];
+                                       $new_major     = $new_version[0] . '.' . $new_version[1];
+
+                                       $result['label'] = sprintf(
+                                               // translators: %s: The latest version of WordPress available.
+                                               __( 'WordPress update available (%s)' ),
+                                               $update->version
+                                       );
+
+                                       $result['actions'] = sprintf(
+                                               '<a href="%s">%s</a>',
+                                               esc_url( admin_url( 'update-core.php' ) ),
+                                               __( 'Install the latest version of WordPress' )
+                                       );
+
+                                       if ( $current_major !== $new_major ) {
+                                               // This is a major version mismatch.
+                                               $result['status']      = 'recommended';
+                                               $result['description'] = sprintf(
+                                                       '<p>%s</p>',
+                                                       __( 'A new version of WordPress is available.' )
+                                               );
+                                       } else {
+                                               // This is a minor version, sometimes considered more critical.
+                                               $result['status']      = 'critical';
+                                               $result['description'] = sprintf(
+                                                       '<p>%s</p>',
+                                                       __( 'A new minor update is available for your site. Because minor updates often address security, it&#8217;s important to install them.' )
+                                               );
+                                       }
+                               } else {
+                                       $result['status'] = 'good';
+                                       $result['label']  = sprintf(
+                                               // translators: %s: The current version of WordPress installed on this site.
+                                               __( 'Your WordPress version is up to date (%s)' ),
+                                               $core_current_version
+                                       );
+
+                                       $result['description'] = sprintf(
+                                               '<p>%s</p>',
+                                               __( 'You are currently running the latest version of WordPress available, keep it up!' )
+                                       );
+                               }
+                       }
+               }
+
+               return $result;
+       }
+
+       /**
+        * Test if plugins are outdated, or unnecessary.
+        *
+        * The tests checks if your plugins are up to date, and encourages you to remove any that are not in use.
+        *
+        * @since 5.2.0
+        *
+        * @return array The test result.
+        */
+       public function get_test_plugin_version() {
+               $result = array(
+                       'label'       => __( 'Your plugins are up to date' ),
+                       'status'      => 'good',
+                       'badge'       => array(
+                               'label' => 'Security',
+                               'color' => 'red',
+                       ),
+                       'description' => sprintf(
+                               '<p>%s</p>',
+                               __( 'Plugins extend your site&#8217;s functionality with things like contact forms, ecommerce and much more. That means they have deep access to your site, so it&#8217;s vital to keep them up to date.' )
+                       ),
+                       'actions'     => '',
+                       'test'        => 'plugin_version',
+               );
+
+               $plugins        = get_plugins();
+               $plugin_updates = get_plugin_updates();
+
+               $plugins_have_updates = false;
+               $plugins_active       = 0;
+               $plugins_total        = 0;
+               $plugins_needs_update = 0;
+
+               // Loop over the available plugins and check their versions and active state.
+               foreach ( $plugins as $plugin_path => $plugin ) {
+                       $plugins_total++;
+
+                       if ( is_plugin_active( $plugin_path ) ) {
+                               $plugins_active++;
+                       }
+
+                       $plugin_version = $plugin['Version'];
+
+                       if ( array_key_exists( $plugin_path, $plugin_updates ) ) {
+                               $plugins_needs_update++;
+                               $plugins_have_updates = true;
+                       }
+               }
+
+               // Add a notice if there are outdated plugins.
+               if ( $plugins_needs_update > 0 ) {
+                       $result['status'] = 'critical';
+
+                       $result['label'] = __( 'You have plugins waiting to be updated' );
+
+                       $result['description'] .= sprintf(
+                               '<p>%s</p>',
+                               sprintf(
+                                       esc_html(
+                                               /* translators: %d: The number of outdated plugins. */
+                                               _n(
+                                                       'Your site has %d plugin waiting to be updated.',
+                                                       'Your site has %d plugins waiting for updates.',
+                                                       $plugins_needs_update
+                                               )
+                                       ),
+                                       $plugins_needs_update
+                               )
+                       );
+               } else {
+                       $result['description'] .= sprintf(
+                               '<p>%s</p>',
+                               sprintf(
+                                       esc_html(
+                                               /* translators: %d: The number of active plugins. */
+                                               _n(
+                                                       'Your site has %d active plugin, and it is up to date.',
+                                                       'Your site has %d active plugins, and they are all up to date.',
+                                                       $plugins_active
+                                               )
+                                       ),
+                                       $plugins_active
+                               )
+                       );
+               }
+
+               // Check if there are inactive plugins.
+               if ( $plugins_total > $plugins_active ) {
+                       $unused_plugins = $plugins_total - $plugins_active;
+
+                       $result['status'] = 'recommended';
+
+                       $result['label'] = __( 'Inactive plugins should be removed' );
+
+                       $result['description'] .= sprintf(
+                               '<p>%s</p>',
+                               sprintf(
+                                       esc_html(
+                                               /* translators: %d: The number of inactive plugins. */
+                                               _n(
+                                                       'Your site has %d inactive plugin. Inactive plugins are tempting targets for attackers. if you&#8217;re not going to use a plugin, we recommend you remove it.',
+                                                       'Your site has %d inactive plugins. Inactive plugins are tempting targets for attackers. if you&#8217;re not going to use a plugin, we recommend you remove it.',
+                                                       $unused_plugins
+                                               )
+                                       ),
+                                       $unused_plugins
+                               )
+                       );
+               }
+
+               return $result;
+       }
+
+       /**
+        * Test if themes are outdated, or unnecessary.
+        *
+        * The tests checks if your site has a default theme (to fall back on if there is a need), if your themes
+        * are up to date and, finally, encourages you to remove any themes that are not needed.
+        *
+        * @since 5.2.0
+        *
+        * @return array The test results.
+        */
+       public function get_test_theme_version() {
+               $result = array(
+                       'label'       => __( 'Your themes are up to date' ),
+                       'status'      => 'good',
+                       'badge'       => array(
+                               'label' => 'Security',
+                               'color' => 'red',
+                       ),
+                       'description' => sprintf(
+                               '<p>%s</p>',
+                               __( 'Themes add your site&#8217;s look and feel. It&#8217;s important to keep them up to date, to stay consistent with your brand and keep your site secure.' )
+                       ),
+                       'actions'     => '',
+                       'test'        => 'theme_version',
+               );
+
+               $theme_updates = get_theme_updates();
+
+               $themes_total        = 0;
+               $themes_need_updates = 0;
+               $themes_inactive     = 0;
+
+               // This value is changed during processing to determine how many themes are considered a reasonable amount.
+               $allowed_theme_count = 1;
+
+               $has_default_theme   = false;
+               $has_unused_themes   = false;
+               $show_unused_themes  = true;
+               $using_default_theme = false;
+
+               // Populate a list of all themes available in the install.
+               $all_themes   = wp_get_themes();
+               $active_theme = wp_get_theme();
+
+               foreach ( $all_themes as $theme_slug => $theme ) {
+                       $themes_total++;
+
+                       if ( WP_DEFAULT_THEME === $theme_slug ) {
+                               $has_default_theme = true;
+
+                               if ( get_stylesheet() === $theme_slug ) {
+                                       $using_default_theme = true;
+                               }
+                       }
+
+                       if ( array_key_exists( $theme_slug, $theme_updates ) ) {
+                               $themes_need_updates++;
+                       }
+               }
+
+               // If this is a child theme, increase the allowed theme count by one, to account for the parent.
+               if ( $active_theme->parent() ) {
+                       $allowed_theme_count++;
+               }
+
+               // If there's a default theme installed, we count that as allowed as well.
+               if ( $has_default_theme ) {
+                       $allowed_theme_count++;
+               }
+
+               if ( $themes_total > $allowed_theme_count ) {
+                       $has_unused_themes = true;
+                       $themes_inactive   = ( $themes_total - $allowed_theme_count );
+               }
+
+               // Check if any themes need to be updated.
+               if ( $themes_need_updates > 0 ) {
+                       $result['status'] = 'critical';
+
+                       $result['label'] = __( 'You have themes waiting to be updated' );
+
+                       $result['description'] .= sprintf(
+                               '<p>%s</p>',
+                               sprintf(
+                                       esc_html(
+                                               /* translators: %d: The number of outdated themes. */
+                                               _n(
+                                                       'Your site has %d theme waiting to be updated.',
+                                                       'Your site has %d themes waiting to be updated.',
+                                                       $themes_need_updates
+                                               )
+                                       ),
+                                       $themes_need_updates
+                               )
+                       );
+               } else {
+                       // Give positive feedback about the site being good about keeping things up to date.
+                       $result['description'] .= sprintf(
+                               '<p>%s</p>',
+                               sprintf(
+                                       esc_html(
+                                               /* translators: %d: The number of themes. */
+                                               _n(
+                                                       'Your site has %d installed theme, and it is up to date.',
+                                                       'Your site has %d installed themes, and they are all up to date.',
+                                                       $themes_total
+                                               )
+                                       ),
+                                       $themes_total
+                               )
+                       );
+               }
+
+               if ( $has_unused_themes && $show_unused_themes ) {
+
+                       // This is a child theme, so we want to be a bit more explicit in our messages.
+                       if ( $active_theme->parent() ) {
+                               // Recommend removing inactive themes, except a default theme, your current one, and the parent theme.
+                               $result['status'] = 'recommended';
+
+                               $result['label'] = __( 'You should remove inactive themes' );
+
+                               if ( $using_default_theme ) {
+                                       $result['description'] .= sprintf(
+                                               '<p>%s</p>',
+                                               sprintf(
+                                                       esc_html(
+                                                               /* translators: %d: The number of inactive themes. */
+                                                               _n(
+                                                                       'Your site has %1$d inactive theme. To enhance your site&#8217;s security, we recommend you remove any themes you&#8217;re not using. You should keep your current theme, %2$s, and %3$s, its parent theme.',
+                                                                       'Your site has %1$d inactive themes. To enhance your site&#8217;s security, we recommend you remove any themes you&#8217;re not using. You should keep your current theme, %2$s, and %3$s, its parent theme.',
+                                                                       $themes_inactive
+                                                               )
+                                                       ),
+                                                       $themes_inactive,
+                                                       $active_theme->name,
+                                                       $active_theme->parent()->name
+                                               )
+                                       );
+                               } else {
+                                       $result['description'] .= sprintf(
+                                               '<p>%s</p>',
+                                               sprintf(
+                                                       esc_html(
+                                                               /* translators: %1$d: The number of inactive themes. %2$s: The default theme for WordPress. %3$s: The currently active theme. %4$s: The active themes parent theme. */
+                                                               _n(
+                                                                       'Your site has %1$d inactive theme. To enhance your site&#8217;s security, we recommend you remove any themes you&#8217;re not using. You should keep %2$s, the default WordPress theme, %3$s, your current theme and %4$s, its parent theme.',
+                                                                       'Your site has %1$d inactive themes. To enhance your site&#8217;s security, we recommend you remove any themes you&#8217;re not using. You should keep %2$s, the default WordPress theme, %3$s, your current theme and %4$s, its parent theme.',
+                                                                       $themes_inactive
+                                                               )
+                                                       ),
+                                                       $themes_inactive,
+                                                       WP_DEFAULT_THEME,
+                                                       $active_theme->name,
+                                                       $active_theme->parent()->name
+                                               )
+                                       );
+                               }
+                       } else {
+                               // Recommend removing all inactive themes.
+                               $result['status'] = 'recommended';
+
+                               $result['label'] = __( 'You should remove inactive themes' );
+
+                               if ( $using_default_theme ) {
+                                       $result['description'] .= sprintf(
+                                               '<p>%s</p>',
+                                               sprintf(
+                                                       esc_html(
+                                                               /* translators: %1$d: The amount of inactive themes. %2$s: The currently active theme. */
+                                                               _n(
+                                                                       'Your site has %1$d inactive theme, other than %2$s, your active theme. We recommend removing any unused themes to enhance your sites security.',
+                                                                       'Your site has %1$d inactive themes, other than %2$s, your active theme. We recommend removing any unused themes to enhance your sites security.',
+                                                                       $themes_inactive
+                                                               )
+                                                       ),
+                                                       $themes_inactive,
+                                                       $active_theme->name
+                                               )
+                                       );
+                               } else {
+                                       $result['description'] .= sprintf(
+                                               '<p>%s</p>',
+                                               sprintf(
+                                                       esc_html(
+                                                               /* translators: %1$d: The amount of inactive themes. %2$s: The default theme for WordPress. %3$s: The currently active theme. */
+                                                               _n(
+                                                                       'Your site has %1$d inactive theme, other than %2$s, the default WordPress theme, and %3$s, your active theme. We recommend removing any unused themes to enhance your sites security.',
+                                                                       'Your site has %1$d inactive themes, other than %2$s, the default WordPress theme, and %3$s, your active theme. We recommend removing any unused themes to enhance your sites security.',
+                                                                       $themes_inactive
+                                                               )
+                                                       ),
+                                                       $themes_inactive,
+                                                       WP_DEFAULT_THEME,
+                                                       $active_theme->name
+                                               )
+                                       );
+                               }
+                       }
+               }
+
+               // If not default Twenty* theme exists.
+               if ( ! $has_default_theme ) {
+                       $result['status'] = 'recommended';
+
+                       $result['label'] = __( 'Have a default theme available' );
+
+                       $result['description'] .= sprintf(
+                               '<p>%s</p>',
+                               __( 'Your site does not have any default theme. Default themes are used by WordPress automatically if anything is wrong with your normal theme.' )
+                       );
+               }
+
+               return $result;
+       }
+
+       /**
+        * Test if the supplied PHP version is supported.
+        *
+        * @since 5.2.0
+        *
+        * @return array The test results.
+        */
+       public function get_test_php_version() {
+               $response = wp_check_php_version();
+
+               $result = array(
+                       'label'       => sprintf(
+                               // translators: %s: The current PHP version.
+                               __( 'PHP is up to date (%s)' ),
+                               PHP_VERSION
+                       ),
+                       'status'      => 'good',
+                       'badge'       => array(
+                               'label' => 'Security',
+                               'color' => 'red',
+                       ),
+                       'description' => sprintf(
+                               '<p>%s</p>',
+                               __( 'PHP is the programming language we use to build and maintain WordPress. Newer versions of PHP are both faster and more secure, so updating will have a positive effect on your site’s performance.' )
+                       ),
+                       'actions'     => sprintf(
+                               '<a class="button button-primary" href="%1$s" target="_blank" rel="noopener noreferrer">%2$s <span class="screen-reader-text">%3$s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a>',
+                               esc_url( wp_get_update_php_url() ),
+                               __( 'Learn more about updating PHP' ),
+                               /* translators: accessibility text */
+                               __( '(opens in a new tab)' )
+                       ),
+                       'test'        => 'php_version',
+               );
+
+               // PHP is up to date.
+               if ( ! $response || version_compare( PHP_VERSION, $response['recommended_version'], '>=' ) ) {
+                       return $result;
+               }
+
+               // The PHP version is older than the recommended version, but still acceptable.
+               if ( $response['is_supported'] ) {
+                       $result['label']  = __( 'We recommend that you update PHP' );
+                       $result['status'] = 'recommended';
+
+                       return $result;
+               }
+
+               // The PHP version is only recieving security fixes.
+               if ( $response['is_secure'] ) {
+                       $result['label']  = __( 'Your PHP version should be updated' );
+                       $result['status'] = 'recommended';
+
+                       return $result;
+               }
+
+               // Anything no longer secure must be updated.
+               $result['label']  = __( 'Your PHP version requires an update' );
+               $result['status'] = 'critical';
+
+               return $result;
+       }
+
+       /**
+        * Check if the passed extension or function are available.
+        *
+        * Make the check for available PHP modules into a simple boolean operator for a cleaner test runner.
+        *
+        * @since 5.2.0
+        *
+        * @param string $extension Optional. The extension name to test. Default null.
+        * @param string $function  Optional. The function name to test. Default null.
+        *
+        * @return bool Whether or not the extension and function are available.
+        */
+       private function test_php_extension_availability( $extension = null, $function = null ) {
+               // If no extension or function is passed, claim to fail testing, as we have nothing to test against.
+               if ( ! $extension && ! $function ) {
+                       return false;
+               }
+
+               if ( $extension && ! extension_loaded( $extension ) ) {
+                       return false;
+               }
+               if ( $function && ! function_exists( $function ) ) {
+                       return false;
+               }
+
+               return true;
+       }
+
+       /**
+        * Test if required PHP modules are installed on the host.
+        *
+        * This test builds on the recommendations made by the WordPress Hosting Team
+        * as seen at https://make.wordpress.org/hosting/handbook/handbook/server-environment/#php-extensions
+        *
+        * @return array
+        */
+       public function get_test_php_extensions() {
+               $result = array(
+                       'label'       => __( 'Required and recommended modules are installed' ),
+                       'status'      => 'good',
+                       'badge'       => array(
+                               'label' => 'Performance',
+                               'color' => 'orange',
+                       ),
+                       'description' => sprintf(
+                               '<p>%s</p><p>%s</p>',
+                               __( 'PHP modules perform most of the tasks on the server that make your site run.' ),
+                               sprintf(
+                                       /* translators: %s: Link to the hosting group page about recommended PHP modules. */
+                                       __( 'The Hosting team maintains a list of those modules, both recommended and required, in %s.' ),
+                                       sprintf(
+                                               '<a href="%s">%s</a>',
+                                               esc_url( _x( 'https://make.wordpress.org/hosting/handbook/handbook/server-environment/#php-extensions', 'The address to describe PHP modules and their use.' ) ),
+                                               __( 'the team handbook' )
+                                       )
+                               )
+                       ),
+                       'actions'     => '',
+                       'test'        => 'php_extensions',
+               );
+
+               $modules = array(
+                       'bcmath'    => array(
+                               'function' => 'bcadd',
+                               'required' => false,
+                       ),
+                       'curl'      => array(
+                               'function' => 'curl_version',
+                               'required' => false,
+                       ),
+                       'exif'      => array(
+                               'function' => 'exif_read_data',
+                               'required' => false,
+                       ),
+                       'filter'    => array(
+                               'function' => 'filter_list',
+                               'required' => false,
+                       ),
+                       'fileinfo'  => array(
+                               'function' => 'finfo_file',
+                               'required' => false,
+                       ),
+                       'mod_xml'   => array(
+                               'extension' => 'libxml',
+                               'required'  => false,
+                       ),
+                       'mysqli'    => array(
+                               'function' => 'mysqli_connect',
+                               'required' => false,
+                       ),
+                       'libsodium' => array(
+                               'function'            => 'sodium_compare',
+                               'required'            => false,
+                               'php_bundled_version' => '7.2.0',
+                       ),
+                       'openssl'   => array(
+                               'function' => 'openssl_encrypt',
+                               'required' => false,
+                       ),
+                       'pcre'      => array(
+                               'function' => 'preg_match',
+                               'required' => false,
+                       ),
+                       'imagick'   => array(
+                               'extension' => 'imagick',
+                               'required'  => false,
+                       ),
+                       'gd'        => array(
+                               'extension'    => 'gd',
+                               'required'     => false,
+                               'fallback_for' => 'imagick',
+                       ),
+                       'mcrypt'    => array(
+                               'extension'    => 'mcrypt',
+                               'required'     => false,
+                               'fallback_for' => 'libsodium',
+                       ),
+                       'xmlreader' => array(
+                               'extension'    => 'xmlreader',
+                               'required'     => false,
+                               'fallback_for' => 'xml',
+                       ),
+                       'zlib'      => array(
+                               'extension'    => 'zlib',
+                               'required'     => false,
+                               'fallback_for' => 'zip',
+                       ),
+               );
+
+               /**
+                * An array representing all the modules we wish to test for.
+                *
+                * @since 5.2.0
+                *
+                * @param array $modules {
+                *     An associated array of modules to test for.
+                *
+                *     array $module {
+                *         An associated array of module properties used during testing.
+                *         One of either `$function` or `$extension` must be provided, or they will fail by default.
+                *
+                *         string $function     Optional. A function name to test for the existence of.
+                *         string $extension    Optional. An extension to check if is loaded in PHP.
+                *         bool   $required     Is this a required feature or not.
+                *         string $fallback_for Optional. The module this module replaces as a fallback.
+                *     }
+                * }
+                */
+               $modules = apply_filters( 'site_status_test_php_modules', $modules );
+
+               $failures = array();
+
+               foreach ( $modules as $library => $module ) {
+                       $extension = ( isset( $module['extension'] ) ? $module['extension'] : null );
+                       $function  = ( isset( $module['function'] ) ? $module['function'] : null );
+
+                       // If this module is a fallback for another function, check if that other function passed.
+                       if ( isset( $module['fallback_for'] ) ) {
+                               /*
+                                * If that other function has a failure, mark this module as required for normal operations.
+                                * If that other function hasn't failed, skip this test as it's only a fallback.
+                                */
+                               if ( isset( $failures[ $module['fallback_for'] ] ) ) {
+                                       $module['required'] = true;
+                               } else {
+                                       continue;
+                               }
+                       }
+
+                       if ( ! $this->test_php_extension_availability( $extension, $function ) && ( ! isset( $module['php_bundled_version'] ) || version_compare( PHP_VERSION, $module['php_bundled_version'], '<' ) ) ) {
+                               if ( $module['required'] ) {
+                                       $result['status'] = 'critical';
+
+                                       $class         = 'error';
+                                       $screen_reader = __( 'Error' );
+                                       $message       = sprintf(
+                                               /* translators: %s: The module name. */
+                                               __( 'The required module, %s, is not installed, or has been disabled.' ),
+                                               $library
+                                       );
+                               } else {
+                                       $class         = 'warning';
+                                       $screen_reader = __( 'Warning' );
+                                       $message       = sprintf(
+                                               /* translators: %s: The module name. */
+                                               __( 'The optional module, %s, is not installed, or has been disabled.' ),
+                                               $library
+                                       );
+                               }
+
+                               if ( ! $module['required'] && 'good' === $result['status'] ) {
+                                       $result['status'] = 'recommended';
+                               }
+
+                               $failures[ $library ] = "<span class='$class'><span class='screen-reader-text'>$screen_reader</span></span> $message";
+                       }
+               }
+
+               if ( ! empty( $failures ) ) {
+                       $output = '<ul>';
+
+                       foreach ( $failures as $failure ) {
+                               $output .= sprintf(
+                                       '<li>%s</li>',
+                                       $failure
+                               );
+                       }
+
+                       $output .= '</ul>';
+               }
+
+               if ( 'good' !== $result['status'] ) {
+                       if ( 'recommended' === $result['status'] ) {
+                               $result['label'] = __( 'One or more recommended modules are missing' );
+                       }
+                       if ( 'critical' === $result['status'] ) {
+                               $result['label'] = __( 'One or more required modules are missing' );
+                       }
+
+                       $result['description'] .= sprintf(
+                               '<p>%s</p>',
+                               $output
+                       );
+               }
+
+               return $result;
+       }
+
+       /**
+        * Test if the SQL server is up to date.
+        *
+        * @since 5.2.0
+        *
+        * @return array The test results.
+        */
+       public function get_test_sql_server() {
+               $result = array(
+                       'label'       => __( 'SQL server is up to date' ),
+                       'status'      => 'good',
+                       'badge'       => array(
+                               'label' => 'Security',
+                               'color' => 'red',
+                       ),
+                       'description' => sprintf(
+                               '<p>%s</p>',
+                               __( 'The SQL server is the database where WordPress stores all your site’s content and settings' )
+                       ),
+                       'actions'     => '',
+                       'test'        => 'sql_server',
+               );
+
+               $db_dropin = file_exists( WP_CONTENT_DIR . '/db.php' );
+
+               if ( ! $this->mysql_rec_version_check ) {
+                       $result['status'] = 'recommended';
+
+                       $result['label'] = __( 'Outdated SQL server' );
+
+                       $result['description'] .= sprintf(
+                               '<p>%s</p>',
+                               sprintf(
+                                       /* translators: %1$s: The database engine in use (MySQL or MariaDB). %2$s: Database server recommended version number. */
+                                       __( 'For optimal performance and security reasons, we recommend running %1$s version %2$s or higher. Contact your web hosting company to correct this.' ),
+                                       ( $this->mariadb ? 'MariaDB' : 'MySQL' ),
+                                       $this->health_check_mysql_rec_version
+                               )
+                       );
+               }
+
+               if ( ! $this->mysql_min_version_check ) {
+                       $result['status'] = 'critical';
+
+                       $result['label'] = __( 'Severely outdated SQL server' );
+
+                       $result['description'] .= sprintf(
+                               '<p>%s</p>',
+                               sprintf(
+                                       /* translators: %1$s: The database engine in use (MySQL or MariaDB). %2$s: Database server minimum version number. */
+                                       __( 'WordPress requires %1$s version %2$s or higher. Contact your web hosting company to correct this.' ),
+                                       ( $this->mariadb ? 'MariaDB' : 'MySQL' ),
+                                       $this->health_check_mysql_required_version
+                               )
+                       );
+               }
+
+               if ( $db_dropin ) {
+                       $result['description'] .= sprintf(
+                               '<p>%s</p>',
+                               wp_kses(
+                                       sprintf(
+                                               /* translators: %s: The name of the database engine being used. */
+                                               __( 'You are using a <code>wp-content/db.php</code> drop-in which might mean that a %s database is not being used.' ),
+                                               ( $this->is_mariadb ? 'MariaDB' : 'MySQL' )
+                                       ),
+                                       array(
+                                               'code' => true,
+                                       )
+                               )
+                       );
+               }
+
+               return $result;
+       }
+
+       /**
+        * Test if the database server is capable of using utf8mb4.
+        *
+        * @since 5.2.0
+        *
+        * @return array The test results.
+        */
+       public function get_test_utf8mb4_support() {
+               global $wpdb;
+
+               $result = array(
+                       'label'       => __( 'UTF8MB4 is supported' ),
+                       'status'      => 'good',
+                       'badge'       => array(
+                               'label' => 'Performance',
+                               'color' => 'orange',
+                       ),
+                       'description' => sprintf(
+                               '<p>%s</p>',
+                               __( 'UTF8MB4 is a database storage attribute that makes sure your site can store non-English text and other strings (for instance emoticons) without unexpected problems.' )
+                       ),
+                       'actions'     => '',
+                       'test'        => 'utf8mb4_support',
+               );
+
+               if ( ! $this->is_mariadb ) {
+                       if ( version_compare( $this->mysql_server_version, '5.5.3', '<' ) ) {
+                               $result['status'] = 'recommended';
+
+                               $result['label'] = __( 'utf8mb4 requires a MySQL update' );
+
+                               $result['description'] .= sprintf(
+                                       '<p>%s</p>',
+                                       sprintf(
+                                               /* translators: %s: Version number. */
+                                               __( 'WordPress&#8217; utf8mb4 support requires MySQL version %s or greater.' ),
+                                               '5.5.3'
+                                       )
+                               );
+                       } else {
+                               $result['description'] .= sprintf(
+                                       '<p>%s</p>',
+                                       __( 'Your MySQL version supports utf8mb4.' )
+                               );
+                       }
+               } else { // MariaDB introduced utf8mb4 support in 5.5.0
+                       if ( version_compare( $this->mysql_server_version, '5.5.0', '<' ) ) {
+                               $result['status'] = 'recommended';
+
+                               $result['label'] = __( 'utf8mb4 requires a MariaDB update' );
+
+                               $result['description'] .= sprintf(
+                                       '<p>%s</p>',
+                                       sprintf(
+                                               /* translators: %s: Version number. */
+                                               __( 'WordPress&#8217; utf8mb4 support requires MariaDB version %s or greater.' ),
+                                               '5.5.0'
+                                       )
+                               );
+                       } else {
+                               $result['description'] .= sprintf(
+                                       '<p>%s</p>',
+                                       __( 'Your MariaDB version supports utf8mb4.' )
+                               );
+                       }
+               }
+
+               if ( $wpdb->use_mysqli ) {
+                       // phpcs:ignore WordPress.DB.RestrictedFunctions.mysql_mysqli_get_client_info
+                       $mysql_client_version = mysqli_get_client_info();
+               } else {
+                       // phpcs:ignore WordPress.DB.RestrictedFunctions.mysql_mysql_get_client_info
+                       $mysql_client_version = mysql_get_client_info();
+               }
+
+               /*
+                * libmysql has supported utf8mb4 since 5.5.3, same as the MySQL server.
+                * mysqlnd has supported utf8mb4 since 5.0.9.
+                */
+               if ( false !== strpos( $mysql_client_version, 'mysqlnd' ) ) {
+                       $mysql_client_version = preg_replace( '/^\D+([\d.]+).*/', '$1', $mysql_client_version );
+                       if ( version_compare( $mysql_client_version, '5.0.9', '<' ) ) {
+                               $result['status'] = 'recommended';
+
+                               $result['label'] = __( 'utf8mb4 requires a newer client library' );
+
+                               $result['description'] .= sprintf(
+                                       '<p>%s</p>',
+                                       sprintf(
+                                               /* translators: %1$s: Name of the library, %2$s: Number of version. */
+                                               __( 'WordPress&#8217; utf8mb4 support requires MySQL client library (%1$s) version %2$s or newer.' ),
+                                               'mysqlnd',
+                                               '5.0.9'
+                                       )
+                               );
+                       }
+               } else {
+                       if ( version_compare( $mysql_client_version, '5.5.3', '<' ) ) {
+                               $result['status'] = 'recommended';
+
+                               $result['label'] = __( 'UTF8MB4 requires a newer client library' );
+
+                               $result['description'] .= sprintf(
+                                       '<p>%s</p>',
+                                       sprintf(
+                                               /* translators: %1$s: Name of the library, %2$s: Number of version. */
+                                               __( 'WordPress&#8217; utf8mb4 support requires MySQL client library (%1$s) version %2$s or newer.' ),
+                                               'libmysql',
+                                               '5.5.3'
+                                       )
+                               );
+                       }
+               }
+
+               return $result;
+       }
+
+       /**
+        * Test if the site can communicate with WordPress.org.
+        *
+        * @since 5.2.0
+        *
+        * @return array The test results.
+        */
+       public function get_test_dotorg_communication() {
+               $result = array(
+                       'label'       => __( 'Can communicate with WordPress.org' ),
+                       'status'      => '',
+                       'badge'       => array(
+                               'label' => 'Security',
+                               'color' => 'red',
+                       ),
+                       'description' => sprintf(
+                               '<p>%s</p>',
+                               __( 'Communicating with the WordPress servers is used to check for new versions, and to both install and update WordPress core, themes or plugins.' )
+                       ),
+                       'actions'     => '',
+                       'test'        => 'dotorg_communication',
+               );
+
+               $wp_dotorg = wp_remote_get(
+                       'https://api.wordpress.org',
+                       array(
+                               'timeout' => 10,
+                       )
+               );
+               if ( ! is_wp_error( $wp_dotorg ) ) {
+                       $result['status'] = 'good';
+               } else {
+                       $result['status'] = 'critical';
+
+                       $result['label'] = __( 'Could not reach WordPress.org' );
+
+                       $result['description'] .= sprintf(
+                               '<p>%s</p>',
+                               sprintf(
+                                       '<span class="error"><span class="screen-reader-text">%s</span></span> %s',
+                                       __( 'Error' ),
+                                       sprintf(
+                                               /* translators: %1$s: The IP address WordPress.org resolves to. %2$s: The error returned by the lookup. */
+                                               __( 'Your site is unable to reach WordPress.org at %1$s, and returned the error: %2$s' ),
+                                               gethostbyname( 'wordpress.org' ),
+                                               $wp_dotorg->get_error_message()
+                                       )
+                               )
+                       );
+               }
+
+               return $result;
+       }
+
+       /**
+        * Test if debug information is enabled.
+        *
+        * When WP_DEBUG is enabled, errors and information may be disclosed to site visitors, or it may be
+        * logged to a publicly accessible file.
+        *
+        * Debugging is also frequently left enabled after looking for errors on a site, as site owners do
+        * not understand the implications of this.
+        *
+        * @since 5.2.0
+        *
+        * @return array The test results.
+        */
+       public function get_test_is_in_debug_mode() {
+               $result = array(
+                       'label'       => __( 'Your site is not set to output debug information' ),
+                       'status'      => 'good',
+                       'badge'       => array(
+                               'label' => 'Security',
+                               'color' => 'red',
+                       ),
+                       'description' => sprintf(
+                               '<p>%s</p>',
+                               __( 'Debug mode is often enabled to gather more details about an error or site failure, but may contain sensitive information which should not be available on a publicly available website.' )
+                       ),
+                       'actions'     => '',
+                       'test'        => 'is_in_debug_mode',
+               );
+
+               if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
+                       if ( defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG ) {
+                               $result['label'] = __( 'Your site is set to log errors to a potentially public file.' );
+
+                               $result['status'] = 'critical';
+
+                               $result['description'] .= sprintf(
+                                       '<p>%s</p>',
+                                       __( 'The value, WP_DEBUG_LOG, has been added to this websites configuration file. This means any errors on the site will be written to a file which is potentially available to normal users.' )
+                               );
+                       }
+
+                       if ( defined( 'WP_DEBUG_DISPLAY' ) && WP_DEBUG_DISPLAY ) {
+                               $result['label'] = __( 'Your site is set to display errors to site visitors' );
+
+                               $result['status'] = 'critical';
+
+                               $result['description'] .= sprintf(
+                                       '<p>%s</p>',
+                                       __( 'The value, WP_DEBUG_DISPLAY, has either been added to your configuration file, or left with its default value. This will make errors display on the front end of your site.' )
+                               );
+                       }
+               }
+
+               return $result;
+       }
+
+       /**
+        * Test if your site is serving content over HTTPS.
+        *
+        * Many sites have varying degrees of HTTPS suppoort, the most common of which is sites that have it
+        * enabled, but only if you visit the right site address.
+        *
+        * @since 5.2.0
+        *
+        * @return array The test results.
+        */
+       public function get_test_https_status() {
+               $result = array(
+                       'label'       => '',
+                       'status'      => '',
+                       'badge'       => array(
+                               'label' => 'Security',
+                               'color' => 'red',
+                       ),
+                       'description' => '',
+                       'actions'     => '',
+                       'test'        => 'https_status',
+               );
+
+               if ( is_ssl() ) {
+                       $wp_url   = get_bloginfo( 'wpurl' );
+                       $site_url = get_bloginfo( 'url' );
+
+                       if ( 'https' !== substr( $wp_url, 0, 5 ) || 'https' !== substr( $site_url, 0, 5 ) ) {
+                               $result['status'] = 'recommended';
+
+                               $result['label'] = __( 'Only parts of your site are using HTTPS' );
+
+                               $result['description'] = sprintf(
+                                       '<p>%s</p>',
+                                       sprintf(
+                                               /* translators: %s: URL to Settings > General to change options. */
+                                               __( 'You are accessing this website using HTTPS, but your <a href="%s">WordPress Address</a> is not set up to use HTTPS by default.' ),
+                                               esc_url( admin_url( 'options-general.php' ) )
+                                       )
+                               );
+
+                               $result['actions'] = sprintf(
+                                       '<a href="%s">%s</a>',
+                                       esc_url( admin_url( 'options-general.php' ) ),
+                                       __( 'Update your site addresses' )
+                               );
+                       } else {
+                               $result['status'] = 'good';
+
+                               $result['label'] = __( 'Your website is using an active HTTPS connection.' );
+                       }
+               } else {
+                       $result['status'] = 'recommended';
+
+                       $result['label'] = __( 'Your site does not use HTTPS' );
+
+                       $result['description'] = sprintf(
+                               '<p>%s</p>',
+                               __( 'An HTTPS connection is needed for many features on the web today, it also gains the trust of your visitors by helping to protecting their online privacy.' )
+                       );
+
+                       $result['actions'] = sprintf(
+                               '<a href="%s">%s</a>',
+                               esc_url(
+                                       /* translators: Website for explaining HTTPS and why it should be used. */
+                                       __( 'https://wordpress.org/support/article/why-should-i-use-https/' )
+                               ),
+                               __( 'Read more about why you should use HTTPS.' )
+                       );
+               }
+
+               return $result;
+       }
+
+       /**
+        * Check if the HTTP API can handle SSL/TLS requests.
+        *
+        * @since 5.2.0
+        *
+        * @return array The test results.
+        */
+       public function get_test_ssl_support() {
+               $result = array(
+                       'label'       => '',
+                       'status'      => '',
+                       'badge'       => array(
+                               'label' => 'Security',
+                               'color' => 'red',
+                       ),
+                       'description' => sprintf(
+                               '<p>%s</p>',
+                               __( 'Securely communicating between servers are needed for transactions such as fetching files, conducting sales on store sites, and much more.' )
+                       ),
+                       'actions'     => '',
+                       'test'        => 'ssl_support',
+               );
+
+               $supports_https = wp_http_supports( array( 'ssl' ) );
+
+               if ( $supports_https ) {
+                       $result['status'] = 'good';
+
+                       $result['label'] = __( 'Your site can communicate securely with other services' );
+               } else {
+                       $result['status'] = 'critical';
+
+                       $result['label'] = __( 'Your site is unable to communicate securely with other services' );
+
+                       $result['description'] .= sprintf(
+                               '<p>%s</p>',
+                               __( 'Talk to your web host about OpenSSL support for PHP.' )
+                       );
+               }
+
+               return $result;
+       }
+
+       /**
+        * Test if scheduled events run as intended.
+        *
+        * If scheduled events are not running, this may indicate something with WP_Cron is not working as intended,
+        * or that there are orphaned events hanging around from older code.
+        *
+        * @since 5.2.0
+        *
+        * @return array The test results.
+        */
+       public function get_test_scheduled_events() {
+               $result = array(
+                       'label'       => __( 'Scheduled events are running' ),
+                       'status'      => 'good',
+                       'badge'       => array(
+                               'label' => 'Performance',
+                               'color' => 'orange',
+                       ),
+                       'description' => sprintf(
+                               '<p>%s</p>',
+                               __( 'Scheduled events are what periodically looks for updates to plugins, themes and WordPress it self. It is also what makes sure scheduled posts are published on time. It may also be used by various plugins to make sure that planned actions are executed.' )
+                       ),
+                       'actions'     => '',
+                       'test'        => 'scheduled_events',
+               );
+
+               $this->wp_schedule_test_init();
+
+               if ( is_wp_error( $this->has_missed_cron() ) ) {
+                       $result['status'] = 'critical';
+
+                       $result['label'] = __( 'It was not possible to check your scheduled events' );
+
+                       $result['description'] = sprintf(
+                               '<p>%s</p>',
+                               sprintf(
+                                       /* translators: %s: The error message returned while from the cron scheduler. */
+                                       __( 'While trying to test your sites scheduled events, the following error was returned: %s' ),
+                                       $this->has_missed_cron()->get_error_message()
+                               )
+                       );
+               } else {
+                       if ( $this->has_missed_cron() ) {
+                               $result['status'] = 'recommended';
+
+                               $result['label'] = __( 'A scheduled event has failed' );
+
+                               $result['description'] = sprintf(
+                                       '<p>%s</p>',
+                                       sprintf(
+                                               /* translators: %s: The name of the failed cron event. */
+                                               __( 'The scheduled event, %s, failed to run. Your site still works, but this may indicate that scheduling posts or automated updates may not work as intended.' ),
+                                               $this->last_missed_cron
+                                       )
+                               );
+                       }
+               }
+
+               return $result;
+       }
+
+       /**
+        * Test if WordPress can run automated background updates.
+        *
+        * Background updates in WordPress are primarely used for minor releases and security updates. It's important
+        * to either have these working, or be aware that they are intentionally disabled for whatever reason.
+        *
+        * @since 5.2.0
+        *
+        * @return array The test results.
+        */
+       public function get_test_background_updates() {
+               $result = array(
+                       'label'       => __( 'Background updates are working' ),
+                       'status'      => 'good',
+                       'badge'       => array(
+                               'label' => 'Security',
+                               'color' => 'red',
+                       ),
+                       'description' => sprintf(
+                               '<p>%s</p>',
+                               __( 'Background updates ensure that WordPress can auto-update if a security update is released for the version you are currently using.' )
+                       ),
+                       'actions'     => '',
+                       'test'        => 'background_updates',
+               );
+
+               if ( ! class_exists( 'WP_Site_Health_Auto_Updates' ) ) {
+                       require_once( ABSPATH . 'wp-admin/includes/class-wp-site-health-auto-updates.php' );
+               }
+
+               // Run the auto-update tests in a separate class,
+               // as there are many considerations to be made.
+               $automatic_updates = new WP_Site_Health_Auto_Updates();
+               $tests             = $automatic_updates->run_tests();
+
+               $output = '<ul>';
+
+               foreach ( $tests as $test ) {
+                       $severity_string = __( 'Passed' );
+
+                       if ( 'fail' === $test->severity ) {
+                               $result['label'] = __( 'Background updates are not working as expected' );
+
+                               $result['status'] = 'critical';
+
+                               $severity_string = __( 'Error' );
+                       }
+
+                       if ( 'warning' === $test->severity && 'good' === $result['status'] ) {
+                               $result['label'] = __( 'Background updates may not be working properly' );
+
+                               $result['status'] = 'recommended';
+
+                               $severity_string = __( 'Warning' );
+                       }
+
+                       $output .= sprintf(
+                               '<li><span class="%s"><span class="screen-reader-text">%s</span></span> %s</li>',
+                               esc_attr( $test->severity ),
+                               $severity_string,
+                               $test->description
+                       );
+               }
+
+               $output .= '</ul>';
+
+               if ( 'good' !== $result['status'] ) {
+                       $result['description'] .= sprintf(
+                               '<p>%s</p>',
+                               $output
+                       );
+               }
+
+               return $result;
+       }
+
+       /**
+        * Test if loopbacks work as expected.
+        *
+        * A loopback is when WordPress queries it self, for example to start a new WP_Cron instance, or when editing a
+        * plugin or theme. This has shown it self to be a recurring issue as code can very easily break this interaction.
+        *
+        * @since 5.2.0
+        *
+        * @return array The test results.
+        */
+       public function get_test_loopback_requests() {
+               $result = array(
+                       'label'       => __( 'Your site can perform loopback requests' ),
+                       'status'      => 'good',
+                       'badge'       => array(
+                               'label' => 'Performance',
+                               'color' => 'orange',
+                       ),
+                       'description' => sprintf(
+                               '<p>%s</p>',
+                               __( 'Loopback requests are used to run scheduled events, and are also used by the built-in editors for themes and plugins to verify code stability.' )
+                       ),
+                       'actions'     => '',
+                       'test'        => 'loopback_requests',
+               );
+
+               $check_loopback = $this->can_perform_loopback();
+
+               $result['status'] = $check_loopback->status;
+
+               if ( 'good' !== $check_loopback->status ) {
+                       $result['label'] = __( 'Your site could not complete a loopback request' );
+
+                       $result['description'] .= sprintf(
+                               '<p>%s</p>',
+                               $check_loopback->message
+                       );
+               }
+
+               return $result;
+       }
+
+       /**
+        * Test if HTTP requests are blocked.
+        *
+        * It's possible to block all outgoing communication (with the possibility of whitelisting hosts) via the
+        * HTTP API. This may create problems for users as many features are running as services these days.
+        *
+        * @since 5.2.0
+        *
+        * @return array The test results.
+        */
+       public function get_test_http_requests() {
+               $result = array(
+                       'label'       => __( 'HTTP requests seem to be working as expected' ),
+                       'status'      => 'good',
+                       'badge'       => array(
+                               'label' => 'Performance',
+                               'color' => 'orange',
+                       ),
+                       'description' => sprintf(
+                               '<p>%s</p>',
+                               __( 'It is possible for site maintainers to block all, or some, communication to other sites and services. If set up incorrectly, this may prevent plugins and themes from working as intended.' )
+                       ),
+                       'actions'     => '',
+                       'test'        => 'http_requests',
+               );
+
+               $blocked = false;
+               $hosts   = array();
+
+               if ( defined( 'WP_HTTP_BLOCK_EXTERNAL' ) ) {
+                       $blocked = true;
+               }
+
+               if ( defined( 'WP_ACCESSIBLE_HOSTS' ) ) {
+                       $hosts = explode( ',', WP_ACCESSIBLE_HOSTS );
+               }
+
+               if ( $blocked && 0 === sizeof( $hosts ) ) {
+                       $result['status'] = 'critical';
+
+                       $result['label'] = __( 'HTTP requests are blocked' );
+
+                       $result['description'] .= sprintf(
+                               '<p>%s</p>',
+                               __( 'HTTP requests have been blocked by the WP_HTTP_BLOCK_EXTERNAL constant, with no allowed hosts.' )
+                       );
+               }
+
+               if ( $blocked && 0 < sizeof( $hosts ) ) {
+                       $result['status'] = 'recommended';
+
+                       $result['label'] = __( 'HTTP requests are partially blocked' );
+
+                       $result['description'] .= sprintf(
+                               '<p>%s</p>',
+                               sprintf(
+                                       /* translators: %s: List of hostnames whitelisted. */
+                                       __( 'HTTP requests have been blocked by the WP_HTTP_BLOCK_EXTERNAL constant, with some hosts whitelisted: %s.' ),
+                                       implode( ',', $hosts )
+                               )
+                       );
+               }
+
+               return $result;
+       }
+
+       /**
+        * Test if the REST API is accessible.
+        *
+        * Various security measures may block the REST API from working, or it may have been disabled in general.
+        * This is required for the new block editor to work, so we explicitly test for this.
+        *
+        * @since 5.2.0
+        *
+        * @return array The test results.
+        */
+       public function get_test_rest_availability() {
+               $result = array(
+                       'label'       => __( 'The REST API is available' ),
+                       'status'      => 'good',
+                       'badge'       => array(
+                               'label' => 'Performance',
+                               'color' => 'orange',
+                       ),
+                       'description' => sprintf(
+                               '<p>%s</p>',
+                               __( 'The REST API is one way WordPress, and other applications, communicate with the server. One example is the block editor screen, which relies on this to display, and save, your posts and pages.' )
+                       ),
+                       'actions'     => '',
+                       'test'        => 'rest_availability',
+               );
+
+               $cookies = wp_unslash( $_COOKIE );
+               $timeout = 10;
+               $headers = array(
+                       'Cache-Control' => 'no-cache',
+                       'X-WP-Nonce'    => wp_create_nonce( 'wp_rest' ),
+               );
+
+               // Include Basic auth in loopback requests.
+               if ( isset( $_SERVER['PHP_AUTH_USER'] ) && isset( $_SERVER['PHP_AUTH_PW'] ) ) {
+                       $headers['Authorization'] = 'Basic ' . base64_encode( wp_unslash( $_SERVER['PHP_AUTH_USER'] ) . ':' . wp_unslash( $_SERVER['PHP_AUTH_PW'] ) );
+               }
+
+               $url = rest_url( 'wp/v2/types/post' );
+
+               // The context for this is editing with the new block editor.
+               $url = add_query_arg(
+                       array(
+                               'context' => 'edit',
+                       ),
+                       $url
+               );
+
+               $r = wp_remote_get( $url, compact( 'cookies', 'headers', 'timeout' ) );
+
+               if ( is_wp_error( $r ) ) {
+                       $result['status'] = 'critical';
+
+                       $result['label'] = __( 'The REST API encountered an error' );
+
+                       $result['description'] .= sprintf(
+                               '<p>%s</p>',
+                               sprintf(
+                                       '%s<br>%s',
+                                       __( 'The REST API request failed due to an error.' ),
+                                       sprintf(
+                                               /* translators: %1$d: The HTTP response code. %2$s: The error message returned. */
+                                               __( 'Error encountered: (%1$d) %2$s' ),
+                                               wp_remote_retrieve_response_code( $r ),
+                                               $r->get_error_message()
+                                       )
+                               )
+                       );
+               } elseif ( 200 !== wp_remote_retrieve_response_code( $r ) ) {
+                       $result['status'] = 'recommended';
+
+                       $result['label'] = __( 'The REST API encountered an unexpected result' );
+
+                       $result['description'] .= sprintf(
+                               '<p>%s</p>',
+                               sprintf(
+                                       /* translators: %1$d: The HTTP response code returned. %2$s: The error message returned. */
+                                       __( 'The REST API call gave the following unexpected result: (%1$d) %2$s.' ),
+                                       wp_remote_retrieve_response_code( $r ),
+                                       wp_remote_retrieve_body( $r )
+                               )
+                       );
+               } else {
+                       $json = json_decode( wp_remote_retrieve_body( $r ), true );
+
+                       if ( false !== $json && ! isset( $json['capabilities'] ) ) {
+                               $result['status'] = 'recommended';
+
+                               $result['label'] = __( 'The REST API did not behave correctly' );
+
+                               $result['description'] .= sprintf(
+                                       '<p>%s</p>',
+                                       sprintf(
+                                               /* translators: %s: the name of the query parameter being tested. */
+                                               __( 'The REST API did not process the %s query parameter correctly.' ),
+                                               '<code>context</code>'
+                                       )
+                               );
+                       }
+               }
+
+               return $result;
+       }
+
+       /**
+        * Return a set of tests that belong to the site status page.
+        *
+        * Each site status test is defined here, they may be `direct` tests, that run on page load, or `async` tests
+        * which will run later down the line via JavaScript calls to improve page performance and hopefully also user
+        * experiences.
+        *
+        * @since 5.2.0
+        *
+        * @return array The list of tests to run.
+        */
+       public static function get_tests() {
+               $tests = array(
+                       'direct' => array(
+                               'wordpress_version' => array(
+                                       'label' => __( 'WordPress Version' ),
+                                       'test'  => 'wordpress_version',
+                               ),
+                               'plugin_version'    => array(
+                                       'label' => __( 'Plugin Versions' ),
+                                       'test'  => 'plugin_version',
+                               ),
+                               'theme_version'     => array(
+                                       'label' => __( 'Theme Versions' ),
+                                       'test'  => 'theme_version',
+                               ),
+                               'php_version'       => array(
+                                       'label' => __( 'PHP Version' ),
+                                       'test'  => 'php_version',
+                               ),
+                               'sql_server'        => array(
+                                       'label' => __( 'Database Server version' ),
+                                       'test'  => 'sql_server',
+                               ),
+                               'php_extensions'    => array(
+                                       'label' => __( 'PHP Extensions' ),
+                                       'test'  => 'php_extensions',
+                               ),
+                               'utf8mb4_support'   => array(
+                                       'label' => __( 'MySQL utf8mb4 support' ),
+                                       'test'  => 'utf8mb4_support',
+                               ),
+                               'https_status'      => array(
+                                       'label' => __( 'HTTPS status' ),
+                                       'test'  => 'https_status',
+                               ),
+                               'ssl_support'       => array(
+                                       'label' => __( 'Secure communication' ),
+                                       'test'  => 'ssl_support',
+                               ),
+                               'scheduled_events'  => array(
+                                       'label' => __( 'Scheduled events' ),
+                                       'test'  => 'scheduled_events',
+                               ),
+                               'http_requests'     => array(
+                                       'label' => __( 'HTTP Requests' ),
+                                       'test'  => 'http_requests',
+                               ),
+                               'debug_enabled'     => array(
+                                       'label' => __( 'Debugging enabled' ),
+                                       'test'  => 'is_in_debug_mode',
+                               ),
+                       ),
+                       'async'  => array(
+                               'dotorg_communication' => array(
+                                       'label' => __( 'Communication with WordPress.org' ),
+                                       'test'  => 'dotorg_communication',
+                               ),
+                               'background_updates'   => array(
+                                       'label' => __( 'Background updates' ),
+                                       'test'  => 'background_updates',
+                               ),
+                               'loopback_requests'    => array(
+                                       'label' => __( 'Loopback request' ),
+                                       'test'  => 'loopback_requests',
+                               ),
+                       ),
+               );
+
+               // Conditionally include REST rules if the function for it exists.
+               if ( function_exists( 'rest_url' ) ) {
+                       $tests['direct']['rest_availability'] = array(
+                               'label' => __( 'REST API availability' ),
+                               'test'  => 'rest_availability',
+                       );
+               }
+
+               /**
+                * Add or modify which site status tests are ran on a site.
+                *
+                * The site health is determined by a set of tests based on best practices from
+                * both the WordPress Hosting Team, but also web standards in general.
+                *
+                * Some sites may not have the same requirements, for example the automatic update
+                * checks may be handled by a host, and are therefore disabled in core.
+                * Or maybe you want to introduce a new test, is caching enabled/disabled/stale for example.
+                *
+                * Test may be added either as direct, or asynchronous ones. Any test that may require some time
+                * to complete should run asynchronously, to avoid extended loading periods within wp-admin.
+                *
+                * @since 5.2.0
+                *
+                * @param array $test_type {
+                *     An associative arraay, where the `$test_type` is either `direct` or
+                *     `async`, to declare if the test should run via AJAX calls after page load.
+                *
+                *     @type array $identifier {
+                *         `$identifier` should be a unque identifier for the test that should run.
+                *         Plugins and themes are encouraged to prefix test identifiers with their slug
+                *         to avoid any collisions between tests.
+                *
+                *         @type string $label A friendly label for your test to identify it by.
+                *         @type string $test  The ajax action to be called to perform the tests.
+                *     }
+                * }
+                */
+               $tests = apply_filters( 'site_status_tests', $tests );
+
+               return $tests;
+       }
+
+       /**
+        * Add a class to the body HTML tag.
+        *
+        * Filters the body class string for admin pages and adds our own class for easier styling.
+        *
+        * @since 5.2.0
+        *
+        * @param string $body_class The body class string.
+        * @return string The modified body class string.
+        */
+       public function admin_body_class( $body_class ) {
+               $body_class .= ' site-health';
+
+               return $body_class;
+       }
+
+       /**
+        * Initiate the WP_Cron schedule test cases.
+        *
+        * @since 5.2.0
+        */
+       private function wp_schedule_test_init() {
+               $this->schedules = wp_get_schedules();
+               $this->get_cron_tasks();
+       }
+
+       /**
+        * Populate our list of cron events and store them to a class-wide variable.
+        *
+        * @since 5.2.0
+        */
+       private function get_cron_tasks() {
+               $cron_tasks = _get_cron_array();
+
+               if ( empty( $cron_tasks ) ) {
+                       $this->crons = new WP_Error( 'no_tasks', __( 'No scheduled events exist on this site.' ) );
+                       return;
+               }
+
+               $this->crons = array();
+
+               foreach ( $cron_tasks as $time => $cron ) {
+                       foreach ( $cron as $hook => $dings ) {
+                               foreach ( $dings as $sig => $data ) {
+
+                                       $this->crons[ "$hook-$sig-$time" ] = (object) array(
+                                               'hook'     => $hook,
+                                               'time'     => $time,
+                                               'sig'      => $sig,
+                                               'args'     => $data['args'],
+                                               'schedule' => $data['schedule'],
+                                               'interval' => isset( $data['interval'] ) ? $data['interval'] : null,
+                                       );
+
+                               }
+                       }
+               }
+       }
+
+       /**
+        * Check if any scheduled tasks have been missed.
+        *
+        * Returns a boolean value of `true` if a scheduled task has been missed and ends processing. If the list of
+        * crons is an instance of WP_Error, return the instance instead of a boolean value.
+        *
+        * @since 5.2.0
+        *
+        * @return bool|WP_Error true if a cron was missed, false if it wasn't. WP_Error if the cron is set to that.
+        */
+       public function has_missed_cron() {
+               if ( is_wp_error( $this->crons ) ) {
+                       return $this->crons;
+               }
+
+               foreach ( $this->crons as $id => $cron ) {
+                       if ( ( $cron->time - time() ) < 0 ) {
+                               $this->last_missed_cron = $cron->hook;
+                               return true;
+                       }
+               }
+
+               return false;
+       }
+
+       /**
+        * Run a loopback test on our site.
+        *
+        * Loopbacks are what WordPress uses to communicate with it self to start up WP_Cron, scheduled posts, make
+        * sure plugin or theme edits dont cause site failures and similar.
+        *
+        * @since 5.2.0
+        *
+        * @return object The test results.
+        */
+       function can_perform_loopback() {
+               $cookies = wp_unslash( $_COOKIE );
+               $timeout = 10;
+               $headers = array(
+                       'Cache-Control' => 'no-cache',
+               );
+
+               // Include Basic auth in loopback requests.
+               if ( isset( $_SERVER['PHP_AUTH_USER'] ) && isset( $_SERVER['PHP_AUTH_PW'] ) ) {
+                       $headers['Authorization'] = 'Basic ' . base64_encode( wp_unslash( $_SERVER['PHP_AUTH_USER'] ) . ':' . wp_unslash( $_SERVER['PHP_AUTH_PW'] ) );
+               }
+
+               $url = admin_url();
+
+               $r = wp_remote_get( $url, compact( 'cookies', 'headers', 'timeout' ) );
+
+               if ( is_wp_error( $r ) ) {
+                       return (object) array(
+                               'status'  => 'critical',
+                               'message' => sprintf(
+                                       '%s<br>%s',
+                                       __( 'The loopback request to your site failed, this means features relying on them are not currently working as expected.' ),
+                                       sprintf(
+                                               // translators: %1$d: The HTTP response code. %2$s: The error message returned.
+                                               __( 'Error encountered: (%1$d) %2$s' ),
+                                               wp_remote_retrieve_response_code( $r ),
+                                               $r->get_error_message()
+                                       )
+                               ),
+                       );
+               }
+
+               if ( 200 !== wp_remote_retrieve_response_code( $r ) ) {
+                       return (object) array(
+                               'status'  => 'recommended',
+                               'message' => sprintf(
+                                       // translators: %d: The HTTP response code returned.
+                                       __( 'The loopback request returned an unexpected http status code, %d, it was not possible to determine if this will prevent features from working as expected.' ),
+                                       wp_remote_retrieve_response_code( $r )
+                               ),
+                       );
+               }
+
+               return (object) array(
+                       'status'  => 'good',
+                       'message' => __( 'The loopback request to your site completed successfully.' ),
+               );
+       }
+}
</ins></span></pre></div>
<a id="trunksrcwpadminmenuphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/menu.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/menu.php       2019-03-23 03:36:10 UTC (rev 44985)
+++ trunk/src/wp-admin/menu.php 2019-03-23 03:54:16 UTC (rev 44986)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -263,6 +263,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">        $submenu['tools.php'][5]  = array( __( 'Available Tools' ), 'edit_posts', 'tools.php' );
</span><span class="cx" style="display: block; padding: 0 10px">        $submenu['tools.php'][10] = array( __( 'Import' ), 'import', 'import.php' );
</span><span class="cx" style="display: block; padding: 0 10px">        $submenu['tools.php'][15] = array( __( 'Export' ), 'export', 'export.php' );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        $submenu['tools.php'][20] = array( __( 'Site Health' ), 'install_plugins', 'site-health.php' );
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( is_multisite() && ! is_main_site() ) {
</span><span class="cx" style="display: block; padding: 0 10px">        $submenu['tools.php'][25] = array( __( 'Delete Site' ), 'delete_site', 'ms-delete-site.php' );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunksrcwpadminsitehealthinfophp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/src/wp-admin/site-health-info.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/site-health-info.php                           (rev 0)
+++ trunk/src/wp-admin/site-health-info.php     2019-03-23 03:54:16 UTC (rev 44986)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,168 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/**
+ * Tools Administration Screen.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+if ( ! current_user_can( 'install_plugins' ) ) {
+       wp_die( __( 'Sorry, you do not have permission to access the debug data.' ), '', array( 'reponse' => 401 ) );
+}
+
+wp_enqueue_style( 'site-health' );
+wp_enqueue_script( 'site-health' );
+
+if ( ! class_exists( 'WP_Debug_Data' ) ) {
+       require_once( ABSPATH . 'wp-admin/includes/class-wp-debug-data.php' );
+}
+if ( ! class_exists( 'WP_Site_Health' ) ) {
+       require_once( ABSPATH . 'wp-admin/includes/class-wp-site-health.php' );
+}
+
+$health_check_site_status = new WP_Site_Health();
+
+require_once( ABSPATH . 'wp-admin/admin-header.php' );
+?>
+
+       <div class="wrap health-check-header">
+               <div class="title-section">
+                       <h1>
+                               <?php _ex( 'Site Health', 'Menu, Section and Page Title' ); ?>
+                       </h1>
+
+                       <div id="progressbar" class="loading" data-pct="0" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" aria-valuetext="<?php esc_attr_e( 'Site tests are running, please wait a moment.' ); ?>">
+                               <svg width="100%" height="100%" viewBox="0 0 200 200" version="1.1" xmlns="http://www.w3.org/2000/svg">
+                                       <circle r="90" cx="100" cy="100" fill="transparent" stroke-dasharray="565.48" stroke-dashoffset="0"></circle>
+                                       <circle id="bar" r="90" cx="100" cy="100" fill="transparent" stroke-dasharray="565.48" stroke-dashoffset="0"></circle>
+                               </svg>
+                       </div>
+               </div>
+
+               <nav class="tabs-wrapper" aria-label="<?php esc_attr_e( 'Secondary menu' ); ?>">
+                       <a href="<?php echo esc_url( admin_url( 'site-health.php' ) ); ?>" class="tab">
+                               <?php _e( 'Status' ); ?>
+                       </a>
+
+                       <a href="<?php echo esc_url( admin_url( 'site-health.php?tab=debug' ) ); ?>" class="tab active" aria-current="true">
+                               <?php _e( 'Info' ); ?>
+                       </a>
+               </nav>
+
+               <div class="wp-clearfix"></div>
+       </div>
+
+       <div class="wrap health-check-body">
+               <?php
+               WP_Debug_Data::check_for_updates();
+
+               $info = WP_Debug_Data::debug_data();
+               ?>
+
+               <h2>
+                       <?php _e( 'Site Info' ); ?>
+               </h2>
+
+               <p>
+                       <?php _e( 'You can export the information on this page so it can be easily copied and pasted in support requests such as on the WordPress.org forums, or shared with your website / theme / plugin developers.' ); ?>
+               </p>
+
+               <div class="system-information-copy-wrapper">
+                       <textarea id="system-information-default-copy-field" readonly><?php WP_Debug_Data::textarea_format( $info ); ?></textarea>
+
+                       <?php
+                       if ( 0 !== strpos( get_locale(), 'en' ) ) :
+
+                               $english_info = WP_Debug_Data::debug_data( 'en_US' );
+                               ?>
+                               <textarea id="system-information-english-copy-field" readonly><?php WP_Debug_Data::textarea_format( $english_info ); ?></textarea>
+
+                       <?php endif; ?>
+
+                       <div class="copy-button-wrapper">
+                               <button type="button" class="button button-primary health-check-copy-field" data-copy-field="default"><?php _e( 'Copy to clipboard' ); ?></button>
+                               <span class="copy-field-success" aria-hidden="true">Copied!</span>
+                       </div>
+                       <?php if ( 0 !== strpos( get_locale(), 'en' ) ) : ?>
+                               <div class="copy-button-wrapper">
+                                       <button type="button" class="button health-check-copy-field" data-copy-field="english"><?php _e( 'Copy to clipboard (English)' ); ?></button>
+                                       <span class="copy-field-success" aria-hidden="true">Copied!</span>
+                               </div>
+                       <?php endif; ?>
+               </div>
+
+               <dl id="health-check-debug" role="presentation" class="health-check-accordion">
+
+                       <?php
+                       foreach ( $info as $section => $details ) {
+                               if ( ! isset( $details['fields'] ) || empty( $details['fields'] ) ) {
+                                       continue;
+                               }
+                               ?>
+                               <dt role="heading" aria-level="3">
+                                       <button aria-expanded="false" class="health-check-accordion-trigger" aria-controls="health-check-accordion-block-<?php echo esc_attr( $section ); ?>" id="health-check-accordion-heading-<?php echo esc_attr( $section ); ?>" type="button">
+                       <span class="title">
+                               <?php echo esc_html( $details['label'] ); ?>
+
+                               <?php if ( isset( $details['show_count'] ) && $details['show_count'] ) : ?>
+                                       <?php printf( '(%d)', count( $details['fields'] ) ); ?>
+                               <?php endif; ?>
+                       </span>
+                                               <span class="icon"></span>
+                                       </button>
+                               </dt>
+
+                               <dd id="health-check-accordion-block-<?php echo esc_attr( $section ); ?>" role="region" aria-labelledby="health-check-accordion-heading-<?php echo esc_attr( $section ); ?>" class="health-check-accordion-panel" hidden="hidden">
+                                       <?php
+                                       if ( isset( $details['description'] ) && ! empty( $details['description'] ) ) {
+                                               printf(
+                                                       '<p>%s</p>',
+                                                       wp_kses(
+                                                               $details['description'],
+                                                               array(
+                                                                       'a'      => array(
+                                                                               'href' => true,
+                                                                       ),
+                                                                       'strong' => true,
+                                                                       'em'     => true,
+                                                               )
+                                                       )
+                                               );
+                                       }
+                                       ?>
+                                       <table class="widefat striped health-check-table">
+                                               <tbody>
+                                               <?php
+                                               foreach ( $details['fields'] as $field ) {
+                                                       if ( is_array( $field['value'] ) ) {
+                                                               $values = '';
+                                                               foreach ( $field['value'] as $name => $value ) {
+                                                                       $values .= sprintf(
+                                                                               '<li>%s: %s</li>',
+                                                                               esc_html( $name ),
+                                                                               esc_html( $value )
+                                                                       );
+                                                               }
+                                                       } else {
+                                                               $values = esc_html( $field['value'] );
+                                                       }
+
+                                                       printf(
+                                                               '<tr><td>%s</td><td>%s</td></tr>',
+                                                               esc_html( $field['label'] ),
+                                                               $values
+                                                       );
+                                               }
+                                               ?>
+                                               </tbody>
+                                       </table>
+                               </dd>
+                       <?php } ?>
+               </dl>
+       </div>
+
+<?php
+include( ABSPATH . 'wp-admin/admin-footer.php' );
</ins></span></pre></div>
<a id="trunksrcwpadminsitehealthphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/src/wp-admin/site-health.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/site-health.php                                (rev 0)
+++ trunk/src/wp-admin/site-health.php  2019-03-23 03:54:16 UTC (rev 44986)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,131 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/**
+ * Tools Administration Screen.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+if ( isset( $_GET['tab'] ) && 'debug' === $_GET['tab'] ) {
+       require_once( dirname( __FILE__ ) . '/site-health-info.php' );
+       return;
+}
+
+/** WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+if ( ! current_user_can( 'install_plugins' ) ) {
+       wp_die( __( 'Sorry, you do not have permission to access site health information.' ), '', array( 'reponse' => 401 ) );
+}
+
+wp_enqueue_style( 'site-health' );
+wp_enqueue_script( 'site-health' );
+
+if ( ! class_exists( 'WP_Site_Health' ) ) {
+       require_once( ABSPATH . 'wp-admin/includes/class-wp-site-health.php' );
+}
+
+$health_check_site_status = new WP_Site_Health();
+
+require_once( ABSPATH . 'wp-admin/admin-header.php' );
+?>
+
+<div class="wrap health-check-header">
+       <div class="title-section">
+               <h1>
+                       <?php _ex( 'Site Health', 'Menu, Section and Page Title' ); ?>
+               </h1>
+
+               <div id="progressbar" class="loading" data-pct="0" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" aria-valuetext="<?php esc_attr_e( 'Site tests are running, please wait a moment.' ); ?>">
+                       <svg width="100%" height="100%" viewBox="0 0 200 200" version="1.1" xmlns="http://www.w3.org/2000/svg">
+                               <circle r="90" cx="100" cy="100" fill="transparent" stroke-dasharray="565.48" stroke-dashoffset="0"></circle>
+                               <circle id="bar" r="90" cx="100" cy="100" fill="transparent" stroke-dasharray="565.48" stroke-dashoffset="0"></circle>
+                       </svg>
+               </div>
+       </div>
+
+       <nav class="tabs-wrapper" aria-label="<?php esc_attr_e( 'Secondary menu' ); ?>">
+               <a href="<?php echo esc_url( admin_url( 'site-health.php' ) ); ?>" class="tab active" aria-current="true">
+                       <?php _e( 'Status' ); ?>
+               </a>
+
+               <a href="<?php echo esc_url( admin_url( 'site-health.php?tab=debug' ) ); ?>" class="tab">
+                       <?php _e( 'Info' ); ?>
+               </a>
+       </nav>
+
+       <div class="wp-clearfix"></div>
+</div>
+
+<div class="wrap health-check-body">
+       <div class="site-status-all-clear hide">
+               <p class="icon">
+                       <span class="dashicons dashicons-yes"></span>
+               </p>
+
+               <p class="encouragement">
+                       <?php _e( 'Great job!' ); ?>
+               </p>
+
+               <p>
+                       <?php _e( 'Everything is running smoothly here.' ); ?>
+               </p>
+       </div>
+
+       <div class="site-status-has-issues">
+               <h2>
+                       <?php _e( 'Site Health Status' ); ?>
+               </h2>
+
+               <p><?php _e( 'The site health check shows critical information about your WordPress configuration and items that require your attention.' ); ?></p>
+
+               <div class="issues-wrapper" id="health-check-issues-critical">
+                       <h3>
+                               <span class="issue-count">0</span> <?php _e( 'Critical issues' ); ?>
+                       </h3>
+
+                       <dl id="health-check-site-status-critical" role="presentation" class="health-check-accordion issues"></dl>
+               </div>
+
+               <div class="issues-wrapper" id="health-check-issues-recommended">
+                       <h3>
+                               <span class="issue-count">0</span> <?php _e( 'Recommended improvements' ); ?>
+                       </h3>
+
+                       <dl id="health-check-site-status-recommended" role="presentation" class="health-check-accordion issues"></dl>
+               </div>
+       </div>
+
+       <div class="view-more">
+               <button type="button" class="button site-health-view-passed" aria-expanded="false">
+                       <?php _e( 'Show passed tests' ); ?>
+               </button>
+       </div>
+
+       <div class="issues-wrapper hidden" id="health-check-issues-good">
+               <h3>
+                       <span class="issue-count">0</span> <?php _e( 'Items with no issues detected' ); ?>
+               </h3>
+
+               <dl id="health-check-site-status-good" role="presentation" class="health-check-accordion issues"></dl>
+       </div>
+</div>
+
+<script id="tmpl-health-check-issue" type="text/template">
+       <dt role="heading" aria-level="4">
+               <button aria-expanded="false" class="health-check-accordion-trigger" aria-controls="health-check-accordion-block-{{ data.test }}" id="health-check-accordion-heading-{{ data.test }}" type="button">
+                       <span class="title">{{ data.label }}</span>
+                       <span class="badge {{ data.badge.color }}">{{ data.badge.label }}</span>
+                       <span class="icon"></span>
+               </button>
+       </dt>
+       <dd id="health-check-accordion-block-{{ data.test }}" aria-labelledby="health-check-accordion-heading-{{ data.test }}" role="region" class="health-check-accordion-panel" hidden="hidden">
+               {{{ data.description }}}
+               <div class="actions">
+                       <p class="button-container">{{{ data.actions }}}</p>
+               </div>
+       </dd>
+</script>
+
+<?php
+include( ABSPATH . 'wp-admin/admin-footer.php' );
</ins></span></pre></div>
<a id="trunksrcwpincludesscriptloaderphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/script-loader.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/script-loader.php   2019-03-23 03:36:10 UTC (rev 44985)
+++ trunk/src/wp-includes/script-loader.php     2019-03-23 03:54:16 UTC (rev 44986)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1688,6 +1688,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        )
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                $scripts->add( 'site-health', "/wp-admin/js/site-health$suffix.js", array( 'jquery', 'wp-util', 'wp-a11y' ), false, 1 );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 $scripts->add( 'updates', "/wp-admin/js/updates$suffix.js", array( 'jquery', 'wp-util', 'wp-a11y' ), false, 1 );
</span><span class="cx" style="display: block; padding: 0 10px">                did_action( 'init' ) && $scripts->localize(
</span><span class="cx" style="display: block; padding: 0 10px">                        'updates',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1933,6 +1935,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">        $styles->add( 'site-icon', "/wp-admin/css/site-icon$suffix.css" );
</span><span class="cx" style="display: block; padding: 0 10px">        $styles->add( 'l10n', "/wp-admin/css/l10n$suffix.css" );
</span><span class="cx" style="display: block; padding: 0 10px">        $styles->add( 'code-editor', "/wp-admin/css/code-editor$suffix.css", array( 'wp-codemirror' ) );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        $styles->add( 'site-health', "/wp-admin/css/site-health$suffix.css" );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        $styles->add( 'wp-admin', false, array( 'dashicons', 'common', 'forms', 'admin-menu', 'dashboard', 'list-tables', 'edit', 'revisions', 'media', 'themes', 'about', 'nav-menus', 'widgets', 'site-icon', 'l10n' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span></span></pre>
</div>
</div>

</body>
</html>