Site Health: Add some more MySQL information to the Site Health Info screen.
This adds three values to the debug info in the Database section: * Max allowed packet size * Max connections number * Query cache size Props zodiac1978, donmhico, mukesh27, SergeyBiryukov. Fixes #53845. Built from https://develop.svn.wordpress.org/trunk@51522 git-svn-id: http://core.svn.wordpress.org/trunk@51133 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
aa0ed0fcdd
commit
2a0191b901
|
@ -925,6 +925,21 @@ class WP_Debug_Data {
|
|||
'private' => true,
|
||||
);
|
||||
|
||||
$info['wp-database']['fields']['max_allowed_packet'] = array(
|
||||
'label' => __( 'Max allowed packet size' ),
|
||||
'value' => self::get_mysql_var( 'max_allowed_packet' ),
|
||||
);
|
||||
|
||||
$info['wp-database']['fields']['max_connections'] = array(
|
||||
'label' => __( 'Max connections number' ),
|
||||
'value' => self::get_mysql_var( 'max_connections' ),
|
||||
);
|
||||
|
||||
$info['wp-database']['fields']['query_cache_size'] = array(
|
||||
'label' => __( 'Query cache size' ),
|
||||
'value' => self::get_mysql_var( 'query_cache_size' ),
|
||||
);
|
||||
|
||||
// List must use plugins if there are any.
|
||||
$mu_plugins = get_mu_plugins();
|
||||
|
||||
|
@ -1444,6 +1459,29 @@ class WP_Debug_Data {
|
|||
return $info;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value of a MySQL variable.
|
||||
*
|
||||
* @since 5.9.0
|
||||
*
|
||||
* @param string $var Name of the MySQL variable.
|
||||
* @return string|null The variable value on success. Null if the variable does not exist.
|
||||
*/
|
||||
public static function get_mysql_var( $var ) {
|
||||
global $wpdb;
|
||||
|
||||
$result = $wpdb->get_row(
|
||||
$wpdb->prepare( 'SHOW VARIABLES LIKE %s', $var ),
|
||||
ARRAY_A
|
||||
);
|
||||
|
||||
if ( ! empty( $result ) && array_key_exists( 'Value', $result ) ) {
|
||||
return $result['Value'];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format the information gathered for debugging, in a manner suitable for copying to a forum or support ticket.
|
||||
*
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.9-alpha-51521';
|
||||
$wp_version = '5.9-alpha-51522';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue