Skip to content
Permalink
Browse files

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
  • Loading branch information...
SergeyBiryukov committed Aug 28, 2019
1 parent 2d0cb48 commit 83efbc67e3e0aa66eb1bd0aff98b6df0504832b0
Showing with 9 additions and 11 deletions.
  1. +1 −1 src/wp-admin/includes/class-wp-debug-data.php
  2. +8 −10 src/wp-admin/includes/class-wp-site-health.php
@@ -719,7 +719,7 @@ static function 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;
@@ -132,18 +132,16 @@ public function enqueue_scripts() {
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' ) ) {

0 comments on commit 83efbc6

Please sign in to comment.
You can’t perform that action at this time.