Make WordPress Core

Changeset 45904


Ignore:
Timestamp:
08/28/2019 03:07:59 AM (5 years ago)
Author:
SergeyBiryukov
Message:

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.

Location:
trunk/src/wp-admin/includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-debug-data.php

    r45889 r45904  
    720720        }
    721721
    722         $server = $wpdb->db_version();
     722        $server = $wpdb->get_var( 'SELECT VERSION()' );
    723723
    724724        if ( isset( $wpdb->use_mysqli ) && $wpdb->use_mysqli ) {
  • trunk/src/wp-admin/includes/class-wp-site-health.php

    r45803 r45904  
    133133        global $wpdb;
    134134
    135         if ( method_exists( $wpdb, 'db_version' ) ) {
    136             if ( $wpdb->use_mysqli ) {
    137                 // phpcs:ignore WordPress.DB.RestrictedFunctions.mysql_mysqli_get_server_info
    138                 $mysql_server_type = mysqli_get_server_info( $wpdb->dbh );
    139             } else {
    140                 // phpcs:ignore WordPress.DB.RestrictedFunctions.mysql_mysql_get_server_info
    141                 $mysql_server_type = mysql_get_server_info( $wpdb->dbh );
    142             }
    143 
    144             $this->mysql_server_version = $wpdb->db_version();
    145         }
     135        if ( $wpdb->use_mysqli ) {
     136            // phpcs:ignore WordPress.DB.RestrictedFunctions.mysql_mysqli_get_server_info
     137            $mysql_server_type = mysqli_get_server_info( $wpdb->dbh );
     138        } else {
     139            // phpcs:ignore WordPress.DB.RestrictedFunctions.mysql_mysql_get_server_info
     140            $mysql_server_type = mysql_get_server_info( $wpdb->dbh );
     141        }
     142
     143        $this->mysql_server_version = $wpdb->get_var( 'SELECT VERSION()' );
    146144
    147145        $this->health_check_mysql_rec_version = '5.6';
Note: See TracChangeset for help on using the changeset viewer.