From 7444799a82781f9e1103ade967220fc4717ea7f3 Mon Sep 17 00:00:00 2001 From: Gary Pendergast Date: Fri, 6 Feb 2015 05:59:23 +0000 Subject: [PATCH] Upgrades: When upgrading a table to utf8mb4, we should run the `ALTER TABLE` query, even if it doesn't have any text columns. This will update the table's default character set, so that any text columns added in the future will have the expected character set. See #21212 Built from https://develop.svn.wordpress.org/trunk@31354 git-svn-id: http://core.svn.wordpress.org/trunk@31335 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/upgrade.php | 10 +--------- wp-includes/version.php | 2 +- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/wp-admin/includes/upgrade.php b/wp-admin/includes/upgrade.php index 1b88eb3690..58263d2653 100644 --- a/wp-admin/includes/upgrade.php +++ b/wp-admin/includes/upgrade.php @@ -1662,25 +1662,17 @@ function maybe_convert_table_to_utf8mb4( $table ) { return false; } - $has_utf8 = false; foreach ( $results as $column ) { if ( $column->Collation ) { list( $charset ) = explode( '_', $column->Collation ); $charset = strtolower( $charset ); - if ( 'utf8' === $charset ) { - $has_utf8 = true; - } elseif ( 'utf8mb4' !== $charset ) { + if ( 'utf8' !== $charset && 'utf8mb4' !== $charset ) { // Don't upgrade tables that have non-utf8 columns. return false; } } } - if ( ! $has_utf8 ) { - // Don't bother upgrading tables that don't have utf8 columns. - return false; - } - return $wpdb->query( "ALTER TABLE $table CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci" ); } diff --git a/wp-includes/version.php b/wp-includes/version.php index 771965d3d8..ba375221c7 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.2-alpha-31353'; +$wp_version = '4.2-alpha-31354'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.