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
This commit is contained in:
parent
8c362e1d8d
commit
7444799a82
|
@ -1662,25 +1662,17 @@ function maybe_convert_table_to_utf8mb4( $table ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$has_utf8 = false;
|
|
||||||
foreach ( $results as $column ) {
|
foreach ( $results as $column ) {
|
||||||
if ( $column->Collation ) {
|
if ( $column->Collation ) {
|
||||||
list( $charset ) = explode( '_', $column->Collation );
|
list( $charset ) = explode( '_', $column->Collation );
|
||||||
$charset = strtolower( $charset );
|
$charset = strtolower( $charset );
|
||||||
if ( 'utf8' === $charset ) {
|
if ( 'utf8' !== $charset && 'utf8mb4' !== $charset ) {
|
||||||
$has_utf8 = true;
|
|
||||||
} elseif ( 'utf8mb4' !== $charset ) {
|
|
||||||
// Don't upgrade tables that have non-utf8 columns.
|
// Don't upgrade tables that have non-utf8 columns.
|
||||||
return false;
|
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" );
|
return $wpdb->query( "ALTER TABLE $table CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @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.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue