From e275bf2b1d6c747b939e6270c021c0f81df70102 Mon Sep 17 00:00:00 2001 From: nishitlangaliya Date: Sat, 27 Oct 2018 11:20:21 -0800 Subject: [PATCH 1/2] fix: Various 'Table does not exist' in WooCommerce status --- includes/api/v2/class-wc-rest-system-status-v2-controller.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/api/v2/class-wc-rest-system-status-v2-controller.php b/includes/api/v2/class-wc-rest-system-status-v2-controller.php index ced5e273f96..d44a503fc22 100644 --- a/includes/api/v2/class-wc-rest-system-status-v2-controller.php +++ b/includes/api/v2/class-wc-rest-system-status-v2-controller.php @@ -721,10 +721,10 @@ class WC_REST_System_Status_V2_Controller extends WC_REST_Controller { 'index' => 0, ); - $site_tables = $wpdb->tables( 'all', true ); + $site_tables_prefix = $wpdb->get_blog_prefix( get_current_blog_id() ); foreach ( $database_table_sizes 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. - if ( is_multisite() && ! in_array( $table->name, $site_tables, true ) ) { + if ( is_multisite() && 0 !== strpos( $table->name, $site_tables_prefix ) ) { continue; } $table_type = in_array( $table->name, $core_tables ) ? 'woocommerce' : 'other'; From e7b9056c581bf163594adce00943dfa1658e1b14 Mon Sep 17 00:00:00 2001 From: nishitlangaliya Date: Tue, 30 Oct 2018 20:50:09 +0530 Subject: [PATCH 2/2] fix: global table included along with multisite tables --- includes/api/v2/class-wc-rest-system-status-v2-controller.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/api/v2/class-wc-rest-system-status-v2-controller.php b/includes/api/v2/class-wc-rest-system-status-v2-controller.php index d44a503fc22..40308030720 100644 --- a/includes/api/v2/class-wc-rest-system-status-v2-controller.php +++ b/includes/api/v2/class-wc-rest-system-status-v2-controller.php @@ -722,9 +722,10 @@ class WC_REST_System_Status_V2_Controller extends WC_REST_Controller { ); $site_tables_prefix = $wpdb->get_blog_prefix( get_current_blog_id() ); + $global_tables = $wpdb->tables( 'global', true ); foreach ( $database_table_sizes 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. - if ( is_multisite() && 0 !== strpos( $table->name, $site_tables_prefix ) ) { + if ( is_multisite() && 0 !== strpos( $table->name, $site_tables_prefix ) && ! in_array( $table->name, $global_tables, true ) ) { continue; } $table_type = in_array( $table->name, $core_tables ) ? 'woocommerce' : 'other';