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. Built from https://develop.svn.wordpress.org/trunk@47451 git-svn-id: http://core.svn.wordpress.org/trunk@47238 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
1367b1175f
commit
c8cc78671b
|
@ -13,7 +13,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.5-alpha-47450';
|
||||
$wp_version = '5.5-alpha-47451';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
|
@ -3610,14 +3610,26 @@ class wpdb {
|
|||
*
|
||||
* @since 2.7.0
|
||||
*
|
||||
* @return null|string Null on failure, version number on success.
|
||||
* @return string|null Version number on success, null on failure.
|
||||
*/
|
||||
public function db_version() {
|
||||
return preg_replace( '/[^0-9.].*/', '', $this->db_server_info() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves full MySQL server information.
|
||||
*
|
||||
* @since 5.5.0
|
||||
*
|
||||
* @return string|false Server info on success, false on failure.
|
||||
*/
|
||||
public function db_server_info() {
|
||||
if ( $this->use_mysqli ) {
|
||||
$server_info = mysqli_get_server_info( $this->dbh );
|
||||
} else {
|
||||
$server_info = mysql_get_server_info( $this->dbh );
|
||||
}
|
||||
return preg_replace( '/[^0-9.].*/', '', $server_info );
|
||||
|
||||
return $server_info;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue