Gets the WordPress database section of the debug data.
Source
private static function get_wp_database(): array {
global $wpdb;
// Populate the database debug fields.
if ( is_object( $wpdb->dbh ) ) {
// mysqli or PDO.
$extension = get_class( $wpdb->dbh );
} else {
// Unknown sql extension.
$extension = null;
}
$server = $wpdb->get_var( 'SELECT VERSION()' );
$client_version = $wpdb->dbh->client_info;
$fields = array(
'extension' => array(
'label' => __( 'Database Extension' ),
'value' => $extension,
),
'server_version' => array(
'label' => __( 'Server version' ),
'value' => $server,
),
'client_version' => array(
'label' => __( 'Client version' ),
'value' => $client_version,
),
'database_user' => array(
'label' => __( 'Database username' ),
'value' => $wpdb->dbuser,
'private' => true,
),
'database_host' => array(
'label' => __( 'Database host' ),
'value' => $wpdb->dbhost,
'private' => true,
),
'database_name' => array(
'label' => __( 'Database name' ),
'value' => $wpdb->dbname,
'private' => true,
),
'database_prefix' => array(
'label' => __( 'Table prefix' ),
'value' => $wpdb->prefix,
'private' => true,
),
'database_charset' => array(
'label' => __( 'Database charset' ),
'value' => $wpdb->charset,
'private' => true,
),
'database_collate' => array(
'label' => __( 'Database collation' ),
'value' => $wpdb->collate,
'private' => true,
),
'max_allowed_packet' => array(
'label' => __( 'Max allowed packet size' ),
'value' => self::get_mysql_var( 'max_allowed_packet' ),
),
'max_connections' => array(
'label' => __( 'Max connections number' ),
'value' => self::get_mysql_var( 'max_connections' ),
),
);
return array(
'label' => __( 'Database' ),
'fields' => $fields,
);
}
Changelog
| Version | Description |
|---|---|
| 6.7.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.