WordPress.org

Make WordPress Core

Ticket #17998: 17998_upgrade_limit_show_tables.diff

File 17998_upgrade_limit_show_tables.diff, 695 bytes (added by brianlayman, 7 years ago)

Adds a where clause to the show all command

  • upgrade.php

     
    14041404        }
    14051405
    14061406        // Check to see which tables and fields exist
    1407         if ($tables = $wpdb->get_col('SHOW TABLES;')) {
     1407        if ($tables = $wpdb->get_col('SHOW TABLES WHERE (`Tables_in_' . $wpdb->dbname. '` like "' . $wpdb->prefix . '%") or ' .
     1408                                        '(`Tables_in_' . $wpdb->dbname. '` in ("' . implode('","',$wpdb->tables('global')) . '"));')) {
    14081409                // For every table in the database
    14091410                foreach ($tables as $table) {
    14101411                        // Upgrade global tables only for the main site. Don't upgrade at all if DO_NOT_UPGRADE_GLOBAL_TABLES is defined.