Make WordPress Core


Ignore:
Timestamp:
03/12/2020 03:53:01 PM (6 years ago)
Author:
SergeyBiryukov
Message:

Database: Introduce wpdb::db_server_info() to retrieve full MySQL server information string as supplied by mysqli_get_server_info().

This complements wpdb::db_version(), which only returns a numeric version string and strips any additional information, e.g. vendor name.

Props clarinetlord, birgire, webaware, pento.
Fixes #40037. See #27703.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/wp-db.php

    r47230 r47451  
    36113611         * @since 2.7.0
    36123612         *
    3613          * @return null|string Null on failure, version number on success.
     3613         * @return string|null Version number on success, null on failure.
    36143614         */
    36153615        public function db_version() {
     3616                return preg_replace( '/[^0-9.].*/', '', $this->db_server_info() );
     3617        }
     3618
     3619        /**
     3620         * Retrieves full MySQL server information.
     3621         *
     3622         * @since 5.5.0
     3623         *
     3624         * @return string|false Server info on success, false on failure.
     3625         */
     3626        public function db_server_info() {
    36163627                if ( $this->use_mysqli ) {
    36173628                        $server_info = mysqli_get_server_info( $this->dbh );
     
    36193630                        $server_info = mysql_get_server_info( $this->dbh );
    36203631                }
    3621                 return preg_replace( '/[^0-9.].*/', '', $server_info );
     3632
     3633                return $server_info;
    36223634        }
    36233635}
Note: See TracChangeset for help on using the changeset viewer.