WP_Debug_Data::get_wp_database(): array

In this article

This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

Gets the WordPress database section of the debug data.

Return

array

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

VersionDescription
6.7.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.