<!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>[47063] trunk/src: Site Health: Introduce Site Health Status dashboard widget.</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/47063">47063</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/47063","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>SergeyBiryukov</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2020-01-12 13:31:49 +0000 (Sun, 12 Jan 2020)</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'>Site Health: Introduce Site Health Status dashboard widget.

The widget informs administrators of any potential issues that should be addressed to improve the performance or security of their website, and directs them to the Site Health screen for more details.

Props Clorith, hedgefield, guddu1315.
See <a href="https://core.trac.wordpress.org/ticket/47606">#47606</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadminincludesclasswpsitehealthphp">trunk/src/wp-admin/includes/class-wp-site-health.php</a></li>
<li><a href="#trunksrcwpadminincludesdashboardphp">trunk/src/wp-admin/includes/dashboard.php</a></li>
<li><a href="#trunksrcwpsettingsphp">trunk/src/wp-settings.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadminincludesclasswpsitehealthphp"></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/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      2020-01-12 11:18:03 UTC (rev 47062)
+++ trunk/src/wp-admin/includes/class-wp-site-health.php        2020-01-12 13:31:49 UTC (rev 47063)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -8,6 +8,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"> class WP_Site_Health {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        private static $instance = null;
+
</ins><span class="cx" style="display: block; padding: 0 10px">         private $mysql_min_version_check;
</span><span class="cx" style="display: block; padding: 0 10px">        private $mysql_rec_version_check;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -29,6 +31,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @since 5.2.0
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function __construct() {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                $this->maybe_create_scheduled_event();
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 $this->prepare_sql_data();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $this->timeout_late_cron   = 0;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -42,9 +46,25 @@
</span><span class="cx" style="display: block; padding: 0 10px">                add_filter( 'admin_body_class', array( $this, 'admin_body_class' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                add_action( 'wp_site_health_scheduled_check', array( $this, 'wp_cron_scheduled_check' ) );
</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">        /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * Return an instance of the WP_Site_Health class, or create one if none exist yet.
+        *
+        * @since 5.4.0
+        *
+        * @return WP_Site_Health|null
+        */
+       public static function initialize() {
+               if ( null === self::$instance ) {
+                       self::$instance = new WP_Site_Health();
+               }
+
+               return self::$instance;
+       }
+
+       /**
</ins><span class="cx" style="display: block; padding: 0 10px">          * Enqueues the site health scripts.
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * @since 5.2.0
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -51,7 +71,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function enqueue_scripts() {
</span><span class="cx" style="display: block; padding: 0 10px">                $screen = get_current_screen();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if ( 'site-health' !== $screen->id ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( 'site-health' !== $screen->id && 'dashboard' !== $screen->id ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         return;
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -96,35 +116,13 @@
</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">                                        if ( method_exists( $this, $test_function ) && is_callable( array( $this, $test_function ) ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                /**
-                                                * Filter the output of a finished Site Health test.
-                                                *
-                                                * @since 5.3.0
-                                                *
-                                                * @param array $test_result {
-                                                *     An associated array of test result data.
-                                                *
-                                                *     @param string $label  A label describing the test, and is used as a header in the output.
-                                                *     @param string $status The status of the test, which can be a value of `good`, `recommended` or `critical`.
-                                                *     @param array  $badge {
-                                                *         Tests are put into categories which have an associated badge shown, these can be modified and assigned here.
-                                                *
-                                                *         @param string $label The test label, for example `Performance`.
-                                                *         @param string $color Default `blue`. A string representing a color to use for the label.
-                                                *     }
-                                                *     @param string $description A more descriptive explanation of what the test looks for, and why it is important for the end user.
-                                                *     @param string $actions     An action to direct the user to where they can resolve the issue, if one exists.
-                                                *     @param string $test        The name of the test being ran, used as a reference point.
-                                                * }
-                                                */
-                                               $health_check_js_variables['site_status']['direct'][] = apply_filters( 'site_status_test_result', call_user_func( array( $this, $test_function ) ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                         $health_check_js_variables['site_status']['direct'][] = $this->perform_test( array( $this, $test_function ) );
</ins><span class="cx" style="display: block; padding: 0 10px">                                                 continue;
</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><span class="cx" style="display: block; padding: 0 10px">                                if ( is_callable( $test['test'] ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        /** This filter is documented in wp-admin/includes/class-wp-site-health.php */
-                                       $health_check_js_variables['site_status']['direct'][] = apply_filters( 'site_status_test_result', call_user_func( $test['test'] ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 $health_check_js_variables['site_status']['direct'][] = $this->perform_test( $test['test'] );
</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"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -142,6 +140,40 @@
</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">+         * Run a Site Health test directly.
+        *
+        * @since 5.4.0
+        *
+        * @param $callback
+        *
+        * @return mixed|void
+        */
+       private function perform_test( $callback ) {
+               /**
+                * Filter the output of a finished Site Health test.
+                *
+                * @since 5.3.0
+                *
+                * @param array $test_result {
+                *     An associated array of test result data.
+                *
+                *     @param string $label  A label describing the test, and is used as a header in the output.
+                *     @param string $status The status of the test, which can be a value of `good`, `recommended` or `critical`.
+                *     @param array  $badge {
+                *         Tests are put into categories which have an associated badge shown, these can be modified and assigned here.
+                *
+                *         @param string $label The test label, for example `Performance`.
+                *         @param string $color Default `blue`. A string representing a color to use for the label.
+                *     }
+                *     @param string $description A more descriptive explanation of what the test looks for, and why it is important for the end user.
+                *     @param string $actions     An action to direct the user to where they can resolve the issue, if one exists.
+                *     @param string $test        The name of the test being ran, used as a reference point.
+                * }
+                */
+               return apply_filters( 'site_status_test_result', call_user_func( $callback ) );
+       }
+
+       /**
</ins><span class="cx" style="display: block; padding: 0 10px">          * Run the SQL version checks.
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * These values are used in later tests, but the part of preparing them is more easily managed early
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2005,6 +2037,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @return string The modified body class string.
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function admin_body_class( $body_class ) {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                $screen = get_current_screen();
+               if ( 'site-health' !== $screen->id ) {
+                       return $body_class;
+               }
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 $body_class .= ' site-health';
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                return $body_class;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2167,4 +2204,105 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        'message' => __( 'The loopback request to your site completed successfully.' ),
</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">+
+       /**
+        * Create a weekly cron event, if one does not already exist.
+        *
+        * @since 5.4.0
+        */
+       public function maybe_create_scheduled_event() {
+               if ( ! wp_next_scheduled( 'wp_site_health_scheduled_check' ) && ! wp_installing() ) {
+                       wp_schedule_event( time(), 'weekly', 'wp_site_health_scheduled_check' );
+               }
+       }
+
+       /**
+        * Run our scheduled event to check and update the latest site health status for the website.
+        *
+        * @since 5.4.0
+        */
+       public function wp_cron_scheduled_check() {
+               // Bootstrap wp-admin, as WP_Cron doesn't do this for us.
+               require_once( trailingslashit( ABSPATH ) . 'wp-admin/includes/admin.php' );
+
+               $tests = WP_Site_Health::get_tests();
+
+               $results = array();
+
+               $site_status = array(
+                       'good'        => 0,
+                       'recommended' => 0,
+                       'critical'    => 0,
+               );
+
+               // 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 ) {
+
+                       if ( is_string( $test['test'] ) ) {
+                               $test_function = sprintf(
+                                       'get_test_%s',
+                                       $test['test']
+                               );
+
+                               if ( method_exists( $this, $test_function ) && is_callable( array( $this, $test_function ) ) ) {
+                                       $results[] = $this->perform_test( array( $this, $test_function ) );
+                                       continue;
+                               }
+                       }
+
+                       if ( is_callable( $test['test'] ) ) {
+                               $results[] = $this->perform_test( $test['test'] );
+                       }
+               }
+
+               foreach ( $tests['async'] as $test ) {
+                       if ( is_string( $test['test'] ) ) {
+                               if ( isset( $test['has_rest'] ) && $test['has_rest'] ) {
+                                       $result_fetch = wp_remote_post(
+                                               rest_url( $test['test'] ),
+                                               array(
+                                                       'body' => array(
+                                                               '_wpnonce' => wp_create_nonce( 'wp_rest' ),
+                                                       ),
+                                               )
+                                       );
+                               } else {
+                                       $result_fetch = wp_remote_post(
+                                               admin_url( 'admin-ajax.php' ),
+                                               array(
+                                                       'body' => array(
+                                                               'action'   => $test['test'],
+                                                               '_wpnonce' => wp_create_nonce( 'health-check-site-status' ),
+                                                       ),
+                                               )
+                                       );
+                               }
+
+                               if ( ! is_wp_error( $result_fetch ) ) {
+                                       $results[] = json_decode( wp_remote_retrieve_body( $result_fetch ) );
+                               } else {
+                                       $results[] = array(
+                                               'status' => 'recommended',
+                                               'label'  => __( 'A test is unavailable' ),
+                                       );
+                               }
+                       }
+               }
+
+               foreach ( $results as $result ) {
+                       if ( 'critical' === $result['status'] ) {
+                               $site_status['critical']++;
+                       } elseif ( 'recommended' === $result['status'] ) {
+                               $site_status['recommended']++;
+                       } else {
+                               $site_status['good']++;
+                       }
+               }
+
+               set_transient( 'health-check-site-status-result', wp_json_encode( $site_status ) );
+       }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunksrcwpadminincludesdashboardphp"></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/dashboard.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/includes/dashboard.php 2020-01-12 11:18:03 UTC (rev 47062)
+++ trunk/src/wp-admin/includes/dashboard.php   2020-01-12 13:31:49 UTC (rev 47063)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -42,6 +42,20 @@
</span><span class="cx" style="display: block; padding: 0 10px">                wp_add_dashboard_widget( 'dashboard_php_nag', __( 'PHP Update Required' ), 'wp_dashboard_php_nag' );
</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">+        // Site Health.
+       if ( current_user_can( 'view_site_health_checks' ) ) {
+               if ( ! class_exists( 'WP_Site_Health' ) ) {
+                       require_once( ABSPATH . 'wp-admin/includes/class-wp-site-health.php' );
+               }
+
+               WP_Site_Health::initialize();
+
+               wp_enqueue_style( 'site-health' );
+               wp_enqueue_script( 'site-health' );
+
+               wp_add_dashboard_widget( 'dashboard_site_health', __( 'Site Health Status' ), 'wp_dashboard_site_health' );
+       }
+
</ins><span class="cx" style="display: block; padding: 0 10px">         // Right Now
</span><span class="cx" style="display: block; padding: 0 10px">        if ( is_blog_admin() && current_user_can( 'edit_posts' ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">                wp_add_dashboard_widget( 'dashboard_right_now', __( 'At a Glance' ), 'wp_dashboard_right_now' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1751,6 +1765,89 @@
</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">+ * Displays the Site Health Status widget.
+ *
+ * @since 5.4.0
+ */
+function wp_dashboard_site_health() {
+       $get_issues = get_transient( 'health-check-site-status-result' );
+
+       $issue_counts = new stdClass();
+
+       if ( false !== $get_issues ) {
+               $issue_counts = json_decode( $get_issues );
+       }
+
+       if ( ! is_object( $issue_counts ) || empty( $issue_counts ) ) {
+               $issue_counts = (object) array(
+                       'good'        => 0,
+                       'recommended' => 0,
+                       'critical'    => 0,
+               );
+       }
+
+       $issues_total = $issue_counts->recommended + $issue_counts->critical;
+       ?>
+       <div class="health-check-title-section site-health-progress-wrapper loading hide-if-no-js">
+               <div class="site-health-progress">
+                       <svg role="img" aria-hidden="true" focusable="false" 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 class="site-health-progress-label">
+                       <?php if ( false === $get_issues ) : ?>
+                               <?php _e( 'No information yet&hellip;' ); ?>
+                       <?php else : ?>
+                               <?php _e( 'Results are still loading&hellip;' ); ?>
+                       <?php endif; ?>
+               </div>
+       </div>
+
+       <?php if ( false === $get_issues ) : ?>
+               <p>
+                       <?php _e( 'No Site Health information has been gathered yet, you can do so by visiting the Site Health screen, alternatively the checks will run periodically.' ); ?>
+               </p>
+
+               <p>
+                       <?php
+                       printf(
+                               /* translators: %s: URL to Site Health screen. */
+                               __( '<a href="%s">Visit the Site Health screen</a> to gather information on about your site.' ),
+                               esc_url( admin_url( 'site-health.php' ) )
+                       );
+                       ?>
+               </p>
+
+       <?php else : ?>
+               <p>
+                       <?php if ( $issue_counts->critical > 0 ) : ?>
+                               <?php _e( 'Your site has critical issues that should be addressed as soon as possible to improve the performance or security of your website.' ); ?>
+                       <?php elseif ( $issues_total <= 0 ) : ?>
+                               <?php _e( 'Great job! Your site currently passes all site health checks.' ); ?>
+                       <?php else : ?>
+                               <?php _e( 'Your site health is looking quite good, but there are still some things you can do to improve the performance and security of your website.' ); ?>
+                       <?php endif; ?>
+               </p>
+       <?php endif; ?>
+
+       <?php if ( $issues_total > 0 && false !== $get_issues ) : ?>
+               <p>
+                       <?php
+                       printf(
+                               /* translators: 1: Number of issues. 2: URL to Site Health screen. */
+                               __( 'Take a look at the <strong>%1$d items</strong> on the <a href="%2$s">Site Health Status screen</a>.' ),
+                               $issues_total,
+                               esc_url( admin_url( 'site-health.php' ) )
+                       );
+                       ?>
+               </p>
+       <?php endif; ?>
+
+       <?php
+}
+
+/**
</ins><span class="cx" style="display: block; padding: 0 10px">  * Empty function usable by plugins to output empty dashboard widget (to be populated later by JS).
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * @since 2.5.0
</span></span></pre></div>
<a id="trunksrcwpsettingsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-settings.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-settings.php 2020-01-12 11:18:03 UTC (rev 47062)
+++ trunk/src/wp-settings.php   2020-01-12 13:31:49 UTC (rev 47063)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -351,6 +351,12 @@
</span><span class="cx" style="display: block; padding: 0 10px">        wp_recovery_mode()->initialize();
</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">+// Create an instance of WP_Site_Health so that Cron events may fire.
+if ( ! class_exists( 'WP_Site_Health' ) ) {
+       require_once( ABSPATH . 'wp-admin/includes/class-wp-site-health.php' );
+}
+WP_Site_Health::initialize();
+
</ins><span class="cx" style="display: block; padding: 0 10px"> // Load active plugins.
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( wp_get_active_and_valid_plugins() as $plugin ) {
</span><span class="cx" style="display: block; padding: 0 10px">        wp_register_plugin_realpath( $plugin );
</span></span></pre>
</div>
</div>

</body>
</html>