From df874c9858e0203ba011b438a3b6ed56a26a0d26 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sun, 28 Jul 2019 14:54:06 +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. git-svn-id: https://develop.svn.wordpress.org/trunk@45691 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/class-wp-debug-data.php | 17 +---------------- src/wp-admin/includes/class-wp-site-health.php | 2 +- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/src/wp-admin/includes/class-wp-debug-data.php b/src/wp-admin/includes/class-wp-debug-data.php index 895f12fdc4..5f433ad741 100644 --- a/src/wp-admin/includes/class-wp-debug-data.php +++ b/src/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/src/wp-admin/includes/class-wp-site-health.php b/src/wp-admin/includes/class-wp-site-health.php index 6b9bb6d418..46a745c90a 100644 --- a/src/wp-admin/includes/class-wp-site-health.php +++ b/src/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';