Site Health: Standardize on SELECT VERSION() query for checking the database server version, due to the MariaDB version declaration potentially causing issues in production environments.

Partially reverts [45691].

Props Clorith.
Fixes #47738.

git-svn-id: https://develop.svn.wordpress.org/trunk@45904 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2019-08-28 03:07:59 +00:00
parent 2d0cb482ed
commit 83efbc67e3
2 changed files with 9 additions and 11 deletions

View File

@ -719,7 +719,7 @@ class WP_Debug_Data {
$extension = null; $extension = null;
} }
$server = $wpdb->db_version(); $server = $wpdb->get_var( 'SELECT VERSION()' );
if ( isset( $wpdb->use_mysqli ) && $wpdb->use_mysqli ) { if ( isset( $wpdb->use_mysqli ) && $wpdb->use_mysqli ) {
$client_version = $wpdb->dbh->client_info; $client_version = $wpdb->dbh->client_info;

View File

@ -132,7 +132,6 @@ class WP_Site_Health {
private function prepare_sql_data() { private function prepare_sql_data() {
global $wpdb; global $wpdb;
if ( method_exists( $wpdb, 'db_version' ) ) {
if ( $wpdb->use_mysqli ) { if ( $wpdb->use_mysqli ) {
// phpcs:ignore WordPress.DB.RestrictedFunctions.mysql_mysqli_get_server_info // phpcs:ignore WordPress.DB.RestrictedFunctions.mysql_mysqli_get_server_info
$mysql_server_type = mysqli_get_server_info( $wpdb->dbh ); $mysql_server_type = mysqli_get_server_info( $wpdb->dbh );
@ -141,8 +140,7 @@ class WP_Site_Health {
$mysql_server_type = mysql_get_server_info( $wpdb->dbh ); $mysql_server_type = mysql_get_server_info( $wpdb->dbh );
} }
$this->mysql_server_version = $wpdb->db_version(); $this->mysql_server_version = $wpdb->get_var( 'SELECT VERSION()' );
}
$this->health_check_mysql_rec_version = '5.6'; $this->health_check_mysql_rec_version = '5.6';