Make WordPress Core

Changeset 31354


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

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

File:
1 edited

Legend:

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

    r31351 r31354  
    16631663    }
    16641664
    1665     $has_utf8 = false;
    16661665    foreach ( $results as $column ) {
    16671666        if ( $column->Collation ) {
    16681667            list( $charset ) = explode( '_', $column->Collation );
    16691668            $charset = strtolower( $charset );
    1670             if ( 'utf8' === $charset ) {
    1671                 $has_utf8 = true;
    1672             } elseif ( 'utf8mb4' !== $charset ) {
     1669            if ( 'utf8' !== $charset && 'utf8mb4' !== $charset ) {
    16731670                // Don't upgrade tables that have non-utf8 columns.
    16741671                return false;
    16751672            }
    16761673        }
    1677     }
    1678 
    1679     if ( ! $has_utf8 ) {
    1680         // Don't bother upgrading tables that don't have utf8 columns.
    1681         return false;
    16821674    }
    16831675
Note: See TracChangeset for help on using the changeset viewer.