Make WordPress Core

Changeset 45691


Ignore:
Timestamp:
07/28/2019 02:54:06 PM (4 years ago)
Author:
SergeyBiryukov
Message:

Site Health: Consistently use wpdb::db_version() for checking the database server version, instead of partically replicating its functionality.

Props Clorith, wpfed.
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

    r45680 r45691  
    706706        }
    707707
    708         /*
    709          * Check what database engine is used, this will throw compatibility
    710          * warnings from PHP compatibility testers, but `mysql_*` is
    711          * still valid in PHP 5.6, so we need to account for that.
    712          */
    713         if ( method_exists( $wpdb, 'db_version' ) ) {
    714             if ( $wpdb->use_mysqli ) {
    715                 // phpcs:ignore WordPress.DB.RestrictedFunctions.mysql_mysqli_get_server_info
    716                 $server = mysqli_get_server_info( $wpdb->dbh );
    717             } else {
    718                 // phpcs:ignore WordPress.DB.RestrictedFunctions.mysql_mysql_get_server_info
    719                 $server = mysql_get_server_info( $wpdb->dbh );
    720             }
    721         } else {
    722             $server = null;
    723         }
     708        $server = $wpdb->db_version();
    724709
    725710        if ( isset( $wpdb->use_mysqli ) && $wpdb->use_mysqli ) {
  • trunk/src/wp-admin/includes/class-wp-site-health.php

    r45649 r45691  
    131131            }
    132132
    133             $this->mysql_server_version = $wpdb->get_var( 'SELECT VERSION()' );
     133            $this->mysql_server_version = $wpdb->db_version();
    134134        }
    135135
Note: See TracChangeset for help on using the changeset viewer.