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.
Built from https://develop.svn.wordpress.org/trunk@45904


git-svn-id: http://core.svn.wordpress.org/trunk@45715 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2019-08-28 03:09:52 +00:00
parent 181d77f04e
commit 6cad27efcd
3 changed files with 10 additions and 12 deletions

View File

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

View File

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

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.3-alpha-45903';
$wp_version = '5.3-alpha-45904';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.