From 2fbb13be2133e453039b8c4e5589a4ebcab6ec64 Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Fri, 3 Jul 2015 05:43:28 +0000 Subject: [PATCH] Don't upgrade global tables to utf8mb4 when `wp_should_upgrade_global_tables()` says not to. Additionally fixes an incorrect conditional in [33057] which would result in the usermeta index being altered twice on Multisite updates. See #32154 git-svn-id: https://develop.svn.wordpress.org/trunk@33058 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/upgrade.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/wp-admin/includes/upgrade.php b/src/wp-admin/includes/upgrade.php index e428e31c3c..f13c458bc9 100644 --- a/src/wp-admin/includes/upgrade.php +++ b/src/wp-admin/includes/upgrade.php @@ -1514,6 +1514,10 @@ function upgrade_430() { $tables = $wpdb->tables( 'blog' ); } else { $tables = $wpdb->tables( 'all' ); + if ( ! wp_should_upgrade_global_tables() ) { + $global_tables = $wpdb->tables( 'global' ); + $tables = array_diff_assoc( $tables, $global_tables ); + } } foreach ( $tables as $table ) { @@ -2634,7 +2638,7 @@ function pre_schema_upgrade() { // Upgrade versions prior to 4.2. if ( $wp_current_db_version < 31351 ) { - if ( wp_should_upgrade_global_tables() ) { + if ( ! is_multisite() && wp_should_upgrade_global_tables() ) { $wpdb->query( "ALTER TABLE $wpdb->usermeta DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))" ); } $wpdb->query( "ALTER TABLE $wpdb->terms DROP INDEX slug, ADD INDEX slug(slug(191))" ); @@ -2711,7 +2715,7 @@ function wp_should_upgrade_global_tables() { } /** - * Filter if upgrade routines should be run on global tables in multisite. + * Filter if upgrade routines should be run on global tables. * * @param bool $should_upgrade Whether to run the upgrade routines on global tables. */