Make WordPress Core

Changeset 33055


Ignore:
Timestamp:
07/03/2015 03:25:07 AM (9 years ago)
Author:
dd32
Message:

Enable utf8mb4 for MySQL extension users. Previously utf8mb4 was limited to MySQLi users only unintentionally.
This change does the following things

  • Allows utf8mb4 for the MySQL extension
  • Re-runs the utf8->utf8mb4 conversion for single sites, this will do nothing for tables already converted
  • Re-runs the utf8->utf8mb4 conversion for global tables in multisite when the environment supports utf8mb4
  • Removes upgrade_420() calling as upgrade_430() will perform those changes now instead

The index shortenings should have still taken place on utf8 sites previously, so there's no need to run those again.

Props kovshenin, pento, dd32
Fixes #32127 for trunk.

Location:
trunk/src
Files:
3 edited

Legend:

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

    r33020 r33055  
    532532        upgrade_400();
    533533
    534     // Don't harsh my mellow. upgrade_430() must be called before
    535     // upgrade_420() to catch bad comments prior to any auto-expansion of
    536     // MySQL column widths.
    537     if ( $wp_current_db_version < 32814 )
     534    if ( $wp_current_db_version < 33055 )
    538535        upgrade_430();
    539 
    540     if ( $wp_current_db_version < 31351 )
    541         upgrade_420();
    542536
    543537    maybe_disable_link_manager();
     
    14951489 * @global wpdb  $wpdb
    14961490 */
    1497 function upgrade_420() {
     1491function upgrade_420() {}
     1492
     1493/**
     1494 * Execute changes made in WordPress 4.3.0.
     1495 *
     1496 * @since 4.3.0
     1497 *
     1498 * @global int   $wp_current_db_version
     1499 * @global wpdb  $wpdb
     1500 */
     1501function upgrade_430() {
    14981502    global $wp_current_db_version, $wpdb;
    14991503
    1500     if ( $wp_current_db_version < 31351 && $wpdb->charset === 'utf8mb4' ) {
     1504    if ( $wp_current_db_version < 32364 ) {
     1505        upgrade_430_fix_comments();
     1506    }
     1507
     1508    if ( $wp_current_db_version < 32814 ) {
     1509        split_all_shared_terms();
     1510    }
     1511
     1512    if ( $wp_current_db_version < 33055 && 'utf8mb4' === $wpdb->charset ) {
    15011513        if ( is_multisite() ) {
    15021514            $tables = $wpdb->tables( 'blog' );
     
    15041516            $tables = $wpdb->tables( 'all' );
    15051517        }
    1506 
     1518   
    15071519        foreach ( $tables as $table ) {
    15081520            maybe_convert_table_to_utf8mb4( $table );
    15091521        }
    1510     }
    1511 }
    1512 
    1513 /**
    1514  * Execute changes made in WordPress 4.3.0.
    1515  *
    1516  * @since 4.3.0
    1517  *
    1518  * @global int   $wp_current_db_version
    1519  * @global wpdb  $wpdb
    1520  */
    1521 function upgrade_430() {
    1522     global $wp_current_db_version, $wpdb;
    1523 
    1524     if ( $wp_current_db_version < 32364 ) {
    1525         upgrade_430_fix_comments();
    1526     }
    1527 
    1528     if ( $wp_current_db_version < 32814 ) {
    1529         split_all_shared_terms();
    15301522    }
    15311523}
     
    16971689
    16981690    // 4.3
    1699     if ( $wp_current_db_version < 32378 && 'utf8mb4' === $wpdb->charset ) {
     1691    if ( $wp_current_db_version < 33055 && 'utf8mb4' === $wpdb->charset ) {
    17001692        if ( ! ( defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) && DO_NOT_UPGRADE_GLOBAL_TABLES ) ) {
    17011693            $upgrade = false;
     
    17101702            if ( $upgrade ) {
    17111703                $wpdb->query( "ALTER TABLE $wpdb->signups DROP INDEX domain_path, ADD INDEX domain_path(domain(140),path(51))" );
     1704            }
     1705
     1706            $tables = $wpdb->tables( 'global' );
     1707
     1708            foreach ( $tables as $table ) {
     1709                maybe_convert_table_to_utf8mb4( $table );
    17121710            }
    17131711        }
  • trunk/src/wp-includes/version.php

    r33046 r33055  
    1212 * @global int $wp_db_version
    1313 */
    14 $wp_db_version = 32814;
     14$wp_db_version = 33055;
    1515
    1616/**
  • trunk/src/wp-includes/wp-db.php

    r33006 r33055  
    741741        }
    742742
    743         if ( ( $this->use_mysqli && ! ( $this->dbh instanceof mysqli ) )
    744           || ( empty( $this->dbh ) || ! ( $this->dbh instanceof mysqli ) ) ) {
     743        if ( ( $this->use_mysqli && ! ( $this->dbh instanceof mysqli ) ) || empty( $this->dbh ) ) {
    745744            return;
    746745        }
Note: See TracChangeset for help on using the changeset viewer.