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
This commit is contained in:
Sergey Biryukov 2019-07-28 14:54:06 +00:00
parent 3df5f2a3d7
commit df874c9858
2 changed files with 2 additions and 17 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';