From a59301c2ba58f881ce005bddda7d8c10d9da1e22 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sun, 28 Jul 2019 14:55:57 +0000 Subject: [PATCH] Site Health: Consistently use `wpdb::db_version()` for checking the database server version, instead of partically replicating its functionality. Props Clorith, wpfed. Fixes #47738. Built from https://develop.svn.wordpress.org/trunk@45691 git-svn-id: http://core.svn.wordpress.org/trunk@45502 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/class-wp-debug-data.php | 17 +---------------- wp-admin/includes/class-wp-site-health.php | 2 +- wp-includes/version.php | 2 +- 3 files changed, 3 insertions(+), 18 deletions(-) diff --git a/wp-admin/includes/class-wp-debug-data.php b/wp-admin/includes/class-wp-debug-data.php index 895f12fdc4..5f433ad741 100644 --- a/wp-admin/includes/class-wp-debug-data.php +++ b/wp-admin/includes/class-wp-debug-data.php @@ -705,22 +705,7 @@ class WP_Debug_Data { $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; - } + $server = $wpdb->db_version(); if ( isset( $wpdb->use_mysqli ) && $wpdb->use_mysqli ) { $client_version = $wpdb->dbh->client_info; diff --git a/wp-admin/includes/class-wp-site-health.php b/wp-admin/includes/class-wp-site-health.php index 6b9bb6d418..46a745c90a 100644 --- a/wp-admin/includes/class-wp-site-health.php +++ b/wp-admin/includes/class-wp-site-health.php @@ -130,7 +130,7 @@ class WP_Site_Health { $mysql_server_type = mysql_get_server_info( $wpdb->dbh ); } - $this->mysql_server_version = $wpdb->get_var( 'SELECT VERSION()' ); + $this->mysql_server_version = $wpdb->db_version(); } $this->health_check_mysql_rec_version = '5.6'; diff --git a/wp-includes/version.php b/wp-includes/version.php index 694bb38da0..8329f47ec5 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.3-alpha-45690'; +$wp_version = '5.3-alpha-45691'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.