From e713bf9a880663edc5087fdb3579c3f0d42ed19b Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sat, 8 Feb 2020 20:10:05 +0000 Subject: [PATCH] Site Health: Only get MySQL server information in tests where it's actually needed. This resolves an issue with plugins like HyperDB, which doesn't have a database connection until a query is made. Props xkon, Otto42, Clorith. See #47606. Built from https://develop.svn.wordpress.org/trunk@47215 git-svn-id: http://core.svn.wordpress.org/trunk@47015 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/class-wp-site-health.php | 10 ++++++++-- wp-includes/version.php | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/wp-admin/includes/class-wp-site-health.php b/wp-admin/includes/class-wp-site-health.php index bbf38dce62..b337d94dae 100644 --- a/wp-admin/includes/class-wp-site-health.php +++ b/wp-admin/includes/class-wp-site-health.php @@ -33,8 +33,6 @@ class WP_Site_Health { public function __construct() { $this->maybe_create_scheduled_event(); - $this->prepare_sql_data(); - $this->timeout_late_cron = 0; $this->timeout_missed_cron = - 5 * MINUTE_IN_SECONDS; @@ -1095,6 +1093,10 @@ class WP_Site_Health { * @return array The test results. */ public function get_test_sql_server() { + if ( ! $this->mysql_server_version ) { + $this->prepare_sql_data(); + } + $result = array( 'label' => __( 'SQL server is up to date' ), 'status' => 'good', @@ -1182,6 +1184,10 @@ class WP_Site_Health { public function get_test_utf8mb4_support() { global $wpdb; + if ( ! $this->mysql_server_version ) { + $this->prepare_sql_data(); + } + $result = array( 'label' => __( 'UTF8MB4 is supported' ), 'status' => 'good', diff --git a/wp-includes/version.php b/wp-includes/version.php index 52740f81f1..795c730da8 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.4-alpha-47214'; +$wp_version = '5.4-alpha-47215'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.