- // Loop over the WP tables, checking and repairing as needed.
- foreach ($wpdb->tables as $table) {
- if ( in_array($table, $wpdb->old_tables) )
- continue;
-
- $check = $wpdb->get_row("CHECK TABLE {$wpdb->prefix}$table");
+ $tables = $wpdb->tables();
+ // Sitecategories may not exist if global terms are disabled.
+ if ( is_multisite() && ! $wpdb->get_var( "SHOW TABLES LIKE '$wpdb->sitecategories'" ) )
+ unset( $tables['sitecategories'] );
+ $tables = array_merge( $tables, (array) apply_filters( 'tables_to_repair', array() ) ); // Return tables with table prefixes.
+ // Loop over the tables, checking and repairing as needed.
+ foreach ( $tables as $table ) {
+ $check = $wpdb->get_row("CHECK TABLE $table");