Better table matching on multisite, hat tip to @claudiulodro for pointing me in the right direction.

This commit is contained in:
Gerhard Potgieter 2018-07-11 11:19:10 +02:00
parent beaa610cc0
commit 3cda8c439c
1 changed files with 3 additions and 4 deletions

View File

@ -721,12 +721,11 @@ class WC_REST_System_Status_Controller extends WC_REST_Controller {
'index' => 0,
);
$site_tables = $wpdb->tables( 'all', 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() ) {
if ( 0 !== strpos( $table->name, $wpdb->prefix ) ) {
continue;
}
if ( is_multisite() && ! in_array( $table->name, $site_tables, true ) ) {
continue;
}
$table_type = in_array( $table->name, $core_tables ) ? 'woocommerce' : 'other';