Make WordPress Core

Changeset 31351


Ignore:
Timestamp:
02/06/2015 05:25:22 AM (10 years ago)
Author:
pento
Message:

Upgrades: When deciding if we can upgrade a table to utf8mb4, make sure we're checking the character set, not the collation.

Bump the DB version as well, as the update in [31349] wouldn't have triggered for anyone who tried it.

See #21212

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/upgrade.php

    r31349 r31351  
    520520        upgrade_400();
    521521
    522     if ( $wp_current_db_version < 31349 )
     522    if ( $wp_current_db_version < 31351 )
    523523        upgrade_420();
    524524
     
    14181418    global $wp_current_db_version, $wpdb;
    14191419
    1420     if ( $wp_current_db_version < 31349 && $wpdb->charset === 'utf8mb4' ) {
     1420    if ( $wp_current_db_version < 31351 && $wpdb->charset === 'utf8mb4' ) {
    14211421        if ( is_multisite() ) {
    14221422            $tables = $wpdb->tables( 'blog' );
     
    15291529
    15301530    // 4.2
    1531     if ( $wp_current_db_version < 31349 && $wpdb->charset === 'utf8mb4' ) {
     1531    if ( $wp_current_db_version < 31351 && $wpdb->charset === 'utf8mb4' ) {
    15321532        if ( ! ( defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) && DO_NOT_UPGRADE_GLOBAL_TABLES ) ) {
    15331533            $wpdb->query( "ALTER TABLE $wpdb->site DROP INDEX domain, ADD INDEX domain(domain(140),path(51))" );
     
    16661666    foreach ( $results as $column ) {
    16671667        if ( $column->Collation ) {
    1668             if ( 'utf8' === $column->Collation ) {
     1668            list( $charset ) = explode( '_', $column->Collation );
     1669            $charset = strtolower( $charset );
     1670            if ( 'utf8' === $charset ) {
    16691671                $has_utf8 = true;
    1670             } elseif ( 'utf8mb4' !== $column->Collation ) {
     1672            } elseif ( 'utf8mb4' !== $charset ) {
    16711673                // Don't upgrade tables that have non-utf8 columns.
    16721674                return false;
     
    23622364
    23632365    // Upgrade versions prior to 4.2.
    2364     if ( $wp_current_db_version < 31349 ) {
     2366    if ( $wp_current_db_version < 31351 ) {
    23652367        // So that we can change tables to utf8mb4, we need to shorten the index lengths to less than 767 bytes
    23662368        $wpdb->query( "ALTER TABLE $wpdb->usermeta DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))" );
  • trunk/src/wp-includes/version.php

    r31349 r31351  
    1212 * @global int $wp_db_version
    1313 */
    14 $wp_db_version = 31349;
     14$wp_db_version = 31351;
    1515
    1616/**
Note: See TracChangeset for help on using the changeset viewer.