WordPress.org

Make WordPress Core

Ticket #40037: Added_method_to_wpdb_to_get_full_server_info.patch

File Added_method_to_wpdb_to_get_full_server_info.patch, 1.6 KB (added by clarinetlord, 3 years ago)
  • src/wp-includes/wp-db.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    33303330         * @return null|string Null on failure, version number on success.
    33313331         */
    33323332        public function db_version() {
    3333                 if ( $this->use_mysqli ) {
    3334                         $server_info = mysqli_get_server_info( $this->dbh );
    3335                 } else {
    3336                         $server_info = mysql_get_server_info( $this->dbh );
    3337                 }
    3338                 return preg_replace( '/[^0-9.].*/', '', $server_info );
    3339         }
     3333                return preg_replace( '/[^0-9.].*/', '', $this->db_server_info() );
     3334        }
     3335
     3336    /**
     3337     * Retrieves full MySQL server information
     3338     *
     3339     * @return null|string Null on failure, server info on success.
     3340     */
     3341        public function db_server_info() {
     3342            return $this->use_mysqli ?
     3343            mysqli_get_server_info( $this->dbh ) :
     3344            mysql_get_server_info( $this->dbh );
     3345    }
    33403346}
  • tests/phpunit/tests/db/charset.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    2828
    2929                self::$_wpdb = new wpdb_exposed_methods_for_testing();
    3030
    31                 if ( self::$_wpdb->use_mysqli ) {
    32                         self::$server_info = mysqli_get_server_info( self::$_wpdb->dbh );
    33                 } else {
    34                         self::$server_info = mysql_get_server_info( self::$_wpdb->dbh );
    35                 }
     31        self::$server_info = self::$_wpdb->db_server_info();
    3632        }
    3733
    3834        /**