From 3a6e79c409f721a59fdf9e55026081620e978e06 Mon Sep 17 00:00:00 2001 From: Gary Pendergast Date: Wed, 6 May 2015 07:34:24 +0000 Subject: [PATCH] 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. Built from https://develop.svn.wordpress.org/trunk@32378 git-svn-id: http://core.svn.wordpress.org/trunk@32348 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/upgrade.php | 20 +++++++++++++++++++- wp-includes/version.php | 4 ++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/wp-admin/includes/upgrade.php b/wp-admin/includes/upgrade.php index ece8daf349..cabeb003a1 100644 --- a/wp-admin/includes/upgrade.php +++ b/wp-admin/includes/upgrade.php @@ -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))" ); + } + } + } } // diff --git a/wp-includes/version.php b/wp-includes/version.php index 37f3189cc1..70984750ff 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,14 +4,14 @@ * * @global string $wp_version */ -$wp_version = '4.3-alpha-32375'; +$wp_version = '4.3-alpha-32378'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * * @global int $wp_db_version */ -$wp_db_version = 32364; +$wp_db_version = 32378; /** * Holds the TinyMCE version