Make WordPress Core


Ignore:
Timestamp:
05/06/2015 07:41:55 AM (10 years ago)
Author:
pento
Message:

Upgrades: When converting to utf8mb4, we were trying to change the wrong index on wp_signups, causing the conversion to later fail.

Merge [32378] to the 4.2 branch.

Props kovshenin, pento.

Fixes #32099.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/4.2/src/wp-admin/includes/upgrade.php

    r32367 r32380  
    15931593            $wpdb->query( "ALTER TABLE $wpdb->site DROP INDEX domain, ADD INDEX domain(domain(140),path(51))" );
    15941594            $wpdb->query( "ALTER TABLE $wpdb->sitemeta DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))" );
    1595             $wpdb->query( "ALTER TABLE $wpdb->signups DROP INDEX domain, ADD INDEX domain(domain(140),path(51))" );
     1595            $wpdb->query( "ALTER TABLE $wpdb->signups DROP INDEX domain_path, ADD INDEX domain_path(domain(140),path(51))" );
    15961596
    15971597            $tables = $wpdb->tables( 'global' );
     
    15991599            foreach ( $tables as $table ) {
    16001600                maybe_convert_table_to_utf8mb4( $table );
     1601            }
     1602        }
     1603    }
     1604
     1605    // 4.2.2
     1606    if ( $wp_current_db_version < 31535 && 'utf8mb4' === $wpdb->charset ) {
     1607        if ( ! ( defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) && DO_NOT_UPGRADE_GLOBAL_TABLES ) ) {
     1608            $upgrade = false;
     1609            $indexes = $wpdb->get_results( "SHOW INDEXES FROM $wpdb->signups" );
     1610            foreach( $indexes as $index ) {
     1611                if ( 'domain_path' == $index->Key_name && 'domain' == $index->Column_name && 140 != $index->Sub_part ) {
     1612                    $upgrade = true;
     1613                    break;
     1614                }
     1615            }
     1616
     1617            if ( $upgrade ) {
     1618                $wpdb->query( "ALTER TABLE $wpdb->signups DROP INDEX domain_path, ADD INDEX domain_path(domain(140),path(51))" );
    16011619            }
    16021620        }
Note: See TracChangeset for help on using the changeset viewer.