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

Props kovshenin, pento.

See #32099.



git-svn-id: https://develop.svn.wordpress.org/trunk@32378 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Gary Pendergast 2015-05-06 07:33:53 +00:00
parent ba24459a63
commit ca11cafb07
2 changed files with 20 additions and 2 deletions

View File

@ -1584,7 +1584,7 @@ function upgrade_network() {
$wpdb->query( "ALTER TABLE $wpdb->usermeta DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))" );
$wpdb->query( "ALTER TABLE $wpdb->site DROP INDEX domain, ADD INDEX domain(domain(140),path(51))" );
$wpdb->query( "ALTER TABLE $wpdb->sitemeta DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))" );
$wpdb->query( "ALTER TABLE $wpdb->signups DROP INDEX domain, ADD INDEX domain(domain(140),path(51))" );
$wpdb->query( "ALTER TABLE $wpdb->signups DROP INDEX domain_path, ADD INDEX domain_path(domain(140),path(51))" );
$tables = $wpdb->tables( 'global' );
@ -1593,6 +1593,24 @@ function upgrade_network() {
}
}
}
// 4.3
if ( $wp_current_db_version < 31378 && 'utf8mb4' === $wpdb->charset ) {
if ( ! ( defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) && DO_NOT_UPGRADE_GLOBAL_TABLES ) ) {
$upgrade = false;
$indexes = $wpdb->get_results( "SHOW INDEXES FROM $wpdb->signups" );
foreach( $indexes as $index ) {
if ( 'domain_path' == $index->Key_name && 'domain' == $index->Column_name && 140 != $index->Sub_part ) {
$upgrade = true;
break;
}
}
if ( $upgrade ) {
$wpdb->query( "ALTER TABLE $wpdb->signups DROP INDEX domain_path, ADD INDEX domain_path(domain(140),path(51))" );
}
}
}
}
//

View File

@ -11,7 +11,7 @@ $wp_version = '4.3-alpha-32280-src';
*
* @global int $wp_db_version
*/
$wp_db_version = 32364;
$wp_db_version = 32378;
/**
* Holds the TinyMCE version