Make WordPress Core

Changeset 32456


Ignore:
Timestamp:
05/08/2015 12:21:18 PM (9 years ago)
Author:
pento
Message:

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.

File:
1 edited

Legend:

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

    r32440 r32456  
    17521752    }
    17531753
     1754    $table_details = $wpdb->get_row( "SHOW TABLE STATUS LIKE '$table'" );
     1755    if ( ! $table_details ) {
     1756        return false;
     1757    }
     1758
     1759    list( $table_charset ) = explode( '_', $table_details->Collation );
     1760    $table_charset = strtolower( $table_charset );
     1761    if ( 'utf8mb4' === $table_charset ) {
     1762        return true;
     1763    }
     1764
    17541765    return $wpdb->query( "ALTER TABLE $table CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci" );
    17551766}
Note: See TracChangeset for help on using the changeset viewer.