Merge pull request #23101 from woocommerce/update/23090
Add table ENGINE to system status report
This commit is contained in:
commit
945ff7958f
|
@ -475,8 +475,8 @@ $untested_plugins = $plugin_updates->get_untested_plugins( WC()->version, 'min
|
||||||
if ( ! $table_data ) {
|
if ( ! $table_data ) {
|
||||||
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . esc_html__( 'Table does not exist', 'woocommerce' ) . '</mark>';
|
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . esc_html__( 'Table does not exist', 'woocommerce' ) . '</mark>';
|
||||||
} else {
|
} else {
|
||||||
/* Translators: %1$f: Table size, %2$f: Index size. */
|
/* Translators: %1$f: Table size, %2$f: Index size, %3$s Engine. */
|
||||||
printf( esc_html__( 'Data: %1$.2fMB + Index: %2$.2fMB', 'woocommerce' ), esc_html( wc_format_decimal( $table_data['data'], 2 ) ), esc_html( wc_format_decimal( $table_data['index'], 2 ) ) );
|
printf( esc_html__( 'Data: %1$.2fMB + Index: %2$.2fMB + Engine %3$s', 'woocommerce' ), esc_html( wc_format_decimal( $table_data['data'], 2 ) ), esc_html( wc_format_decimal( $table_data['index'], 2 ) ), esc_html( $table_data['engine'] ) );
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
|
@ -489,8 +489,8 @@ $untested_plugins = $plugin_updates->get_untested_plugins( WC()->version, 'min
|
||||||
<td class="help"> </td>
|
<td class="help"> </td>
|
||||||
<td>
|
<td>
|
||||||
<?php
|
<?php
|
||||||
/* Translators: %1$f: Table size, %2$f: Index size. */
|
/* Translators: %1$f: Table size, %2$f: Index size, %3$s Engine. */
|
||||||
printf( esc_html__( 'Data: %1$.2fMB + Index: %2$.2fMB', 'woocommerce' ), esc_html( wc_format_decimal( $table_data['data'], 2 ) ), esc_html( wc_format_decimal( $table_data['index'], 2 ) ) );
|
printf( esc_html__( 'Data: %1$.2fMB + Index: %2$.2fMB + Engine %3$s', 'woocommerce' ), esc_html( wc_format_decimal( $table_data['data'], 2 ) ), esc_html( wc_format_decimal( $table_data['index'], 2 ) ), esc_html( $table_data['engine'] ) );
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -696,10 +696,11 @@ class WC_REST_System_Status_V2_Controller extends WC_REST_Controller {
|
||||||
public function get_database_info() {
|
public function get_database_info() {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
$database_table_sizes = $wpdb->get_results(
|
$database_table_information = $wpdb->get_results(
|
||||||
$wpdb->prepare(
|
$wpdb->prepare(
|
||||||
"SELECT
|
"SELECT
|
||||||
table_name AS 'name',
|
table_name AS 'name',
|
||||||
|
engine,
|
||||||
round( ( data_length / 1024 / 1024 ), 2 ) 'data',
|
round( ( data_length / 1024 / 1024 ), 2 ) 'data',
|
||||||
round( ( index_length / 1024 / 1024 ), 2 ) 'index'
|
round( ( index_length / 1024 / 1024 ), 2 ) 'index'
|
||||||
FROM information_schema.TABLES
|
FROM information_schema.TABLES
|
||||||
|
@ -754,7 +755,7 @@ class WC_REST_System_Status_V2_Controller extends WC_REST_Controller {
|
||||||
|
|
||||||
$site_tables_prefix = $wpdb->get_blog_prefix( get_current_blog_id() );
|
$site_tables_prefix = $wpdb->get_blog_prefix( get_current_blog_id() );
|
||||||
$global_tables = $wpdb->tables( 'global', true );
|
$global_tables = $wpdb->tables( 'global', true );
|
||||||
foreach ( $database_table_sizes as $table ) {
|
foreach ( $database_table_information as $table ) {
|
||||||
// Only include tables matching the prefix of the current site, this is to prevent displaying all tables on a MS install not relating to the current.
|
// Only include tables matching the prefix of the current site, this is to prevent displaying all tables on a MS install not relating to the current.
|
||||||
if ( is_multisite() && 0 !== strpos( $table->name, $site_tables_prefix ) && ! in_array( $table->name, $global_tables, true ) ) {
|
if ( is_multisite() && 0 !== strpos( $table->name, $site_tables_prefix ) && ! in_array( $table->name, $global_tables, true ) ) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -762,8 +763,9 @@ class WC_REST_System_Status_V2_Controller extends WC_REST_Controller {
|
||||||
$table_type = in_array( $table->name, $core_tables ) ? 'woocommerce' : 'other';
|
$table_type = in_array( $table->name, $core_tables ) ? 'woocommerce' : 'other';
|
||||||
|
|
||||||
$tables[ $table_type ][ $table->name ] = array(
|
$tables[ $table_type ][ $table->name ] = array(
|
||||||
'data' => $table->data,
|
'data' => $table->data,
|
||||||
'index' => $table->index,
|
'index' => $table->index,
|
||||||
|
'engine' => $table->engine,
|
||||||
);
|
);
|
||||||
|
|
||||||
$database_size['data'] += $table->data;
|
$database_size['data'] += $table->data;
|
||||||
|
|
Loading…
Reference in New Issue