Merge pull request #21706 from nishitlangaliya/issue-21657

fix: Various 'Table does not exist' in WooCommerce status
This commit is contained in:
Claudiu Lodromanean 2018-11-15 09:12:51 -08:00 committed by GitHub
commit 9fab802ff3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -721,10 +721,11 @@ 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() );
$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() && ! in_array( $table->name, $site_tables, true ) ) {
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';