WordPress.org

Make WordPress Core

Changeset 32457


Ignore:
Timestamp:
05/08/2015 12:27:13 PM (5 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.

Merge of [32456] to the 4.2 branch.

Fixes #32310.

File:
1 edited

Legend:

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

    r32441 r32457  
    17601760    }
    17611761
     1762    $table_details = $wpdb->get_row( "SHOW TABLE STATUS LIKE '$table'" );
     1763    if ( ! $table_details ) {
     1764        return false;
     1765    }
     1766
     1767    list( $table_charset ) = explode( '_', $table_details->Collation );
     1768    $table_charset = strtolower( $table_charset );
     1769    if ( 'utf8mb4' === $table_charset ) {
     1770        return true;
     1771    }
     1772
    17621773    return $wpdb->query( "ALTER TABLE $table CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci" );
    17631774}
Note: See TracChangeset for help on using the changeset viewer.