Make WordPress Core

Ticket #22134: 22134-b.patch

File 22134-b.patch, 931 bytes (added by fliespl, 11 years ago)

Another solution to fix create table errors (excluding them if exist before triggering create table)

  • upgrade.php

     
    15001500        $global_tables = $wpdb->tables( 'global' );
    15011501        foreach ( $cqueries as $table => $qry ) {
    15021502                // Upgrade global tables only for the main site. Don't upgrade at all if DO_NOT_UPGRADE_GLOBAL_TABLES is defined.
    1503                 if ( in_array( $table, $global_tables ) && ( !is_main_site() || defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) )
     1503                if ( in_array( $table, $global_tables ) && ( !is_main_site() || defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) ) {
     1504                        $wpdb->suppress_errors();
     1505                        $tablefields = $wpdb->get_results("DESCRIBE {$table};");
     1506                        $wpdb->suppress_errors( false );
     1507                        if ( $tablefields )
     1508                                unset( $cqueries[ $table ], $for_update[ $table ] );
    15041509                        continue;
     1510                }
    15051511
    15061512                // Fetch the table column structure from the database
    15071513                $wpdb->suppress_errors();