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
This commit is contained in:
Sergey Biryukov 2019-07-28 14:55:57 +00:00
parent 182f813e24
commit a59301c2ba
3 changed files with 3 additions and 18 deletions

View File

@ -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;

View File

@ -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';

View File

@ -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.