[wp-trac] [WordPress Trac] #40037: Add ability to ask wpdb for full db server info
WordPress Trac
noreply at wordpress.org
Sun Mar 4 10:38:56 UTC 2018
#40037: Add ability to ask wpdb for full db server info
----------------------------------------+------------------------------
Reporter: clarinetlord | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Database | Version: 4.8
Severity: normal | Resolution:
Keywords: has-patch needs-unit-tests | Focuses:
----------------------------------------+------------------------------
Comment (by birgire):
This enhancement would be useful in #39165 where it currently uses:
{{{
if ( method_exists( $wpdb, 'db_version' ) ) {
if ( $wpdb->use_mysqli ) {
$server = mysqli_get_server_info( $wpdb->dbh );
} else {
$server = mysql_get_server_info( $wpdb->dbh );
}
} else {
$server = null;
}
}}}
I refreshed the patch into a new [attachment:40037.2.diff], according to
the Coding Standard (e.g. use tabs for indentation, added @since etc).
Regarding a "unit test" for the method, I think it's implicitly covered
with the existing test method for the db version:
{{{
function test_db_version() {
global $wpdb;
$this->assertTrue( version_compare( $wpdb->db_version(), '5.0',
'>=' ) );
}
}}}
as {{{$wpdb::db_version()}}} would be a wrapper for
{{{$wpdb::db_server_info()}}}.
Otherwise this kind of test:
{{{
function test_db_server_info() {
global $wpdb;
$this->assertTrue( is_string( $wpdb->db_server_info() ) );
}
}}}
feels like we're just testing the output type of the PHP server info
functions.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/40037#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list