From 02621f2a14d1348baa7262452ce6b8e938d5fd78 Mon Sep 17 00:00:00 2001 From: Gary Pendergast Date: Fri, 8 May 2015 12:22:25 +0000 Subject: [PATCH] Upgrades: If a table has already been converted to `utf8mb4`, there's no need to try and convert it again. Props gabrielperezs for the initial patch. See #32310. Built from https://develop.svn.wordpress.org/trunk@32456 git-svn-id: http://core.svn.wordpress.org/trunk@32426 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/upgrade.php | 11 +++++++++++ wp-includes/version.php | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/wp-admin/includes/upgrade.php b/wp-admin/includes/upgrade.php index a8b4c740a5..dde618ab02 100644 --- a/wp-admin/includes/upgrade.php +++ b/wp-admin/includes/upgrade.php @@ -1751,6 +1751,17 @@ function maybe_convert_table_to_utf8mb4( $table ) { } } + $table_details = $wpdb->get_row( "SHOW TABLE STATUS LIKE '$table'" ); + if ( ! $table_details ) { + return false; + } + + list( $table_charset ) = explode( '_', $table_details->Collation ); + $table_charset = strtolower( $table_charset ); + if ( 'utf8mb4' === $table_charset ) { + return true; + } + 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 d5fa32dad4..c35b6c709a 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.3-alpha-32455'; +$wp_version = '4.3-alpha-32456'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.