diff --git a/wp-admin/includes/class-wp-debug-data.php b/wp-admin/includes/class-wp-debug-data.php index 016c9e3129..a044414789 100644 --- a/wp-admin/includes/class-wp-debug-data.php +++ b/wp-admin/includes/class-wp-debug-data.php @@ -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. * diff --git a/wp-includes/version.php b/wp-includes/version.php index 20a041782c..24eccc05eb 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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.