WordPress.org

Make WordPress Core

Changeset 33063


Ignore:
Timestamp:
07/03/2015 12:43:48 PM (5 years ago)
Author:
dd32
Message:

Enable utf8mb4 for MySQL extension users. Previously utf8mb4 was limited to MySQLi users only unintentionally.

Ports [33055] to the 4.2 branch
Fixes #32127 for 4.2.3

Location:
branches/4.2/src
Files:
3 edited

Legend:

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

    r33059 r33063  
    525525        upgrade_400();
    526526
    527     // Don't harsh my mellow. upgrade_422() must be called before
    528     // upgrade_420() to catch bad comments prior to any auto-expansion of
    529     // MySQL column widths.
    530527    if ( $wp_current_db_version < 31534 )
    531528        upgrade_422();
    532529
    533     if ( $wp_current_db_version < 31351 )
    534         upgrade_420();
     530    if ( $wp_current_db_version < 31536 )
     531        upgrade_423();
    535532
    536533    maybe_disable_link_manager();
     
    14271424 */
    14281425function upgrade_420() {
    1429     global $wp_current_db_version, $wpdb;
    1430 
    1431     if ( $wp_current_db_version < 31351 && $wpdb->charset === 'utf8mb4' ) {
    1432         if ( is_multisite() ) {
    1433             $tables = $wpdb->tables( 'blog' );
    1434         } else {
    1435             $tables = $wpdb->tables( 'all' );
    1436             if ( defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) {
    1437                 $global_tables = $wpdb->tables( 'global' );
    1438                 $tables = array_diff_assoc( $tables, $global_tables );
    1439             }
    1440         }
    1441 
    1442         foreach ( $tables as $table ) {
    1443             maybe_convert_table_to_utf8mb4( $table );
    1444         }
    1445     }
    14461426}
    14471427
     
    14981478        foreach ( $comments as $comment ) {
    14991479            wp_delete_comment( $comment->comment_ID, true );
     1480        }
     1481    }
     1482}
     1483
     1484/**
     1485 * Execute changes made in WordPress 4.2.0.
     1486 *
     1487 * @since 4.2.3
     1488 */
     1489function upgrade_423() {
     1490    global $wp_current_db_version, $wpdb;
     1491
     1492    if ( $wp_current_db_version < 31536 && $wpdb->charset === 'utf8mb4' ) {
     1493        if ( is_multisite() ) {
     1494            $tables = $wpdb->tables( 'blog' );
     1495        } else {
     1496            $tables = $wpdb->tables( 'all' );
     1497            if ( defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) {
     1498                $global_tables = $wpdb->tables( 'global' );
     1499                $tables = array_diff_assoc( $tables, $global_tables );
     1500            }
     1501        }
     1502
     1503        foreach ( $tables as $table ) {
     1504            maybe_convert_table_to_utf8mb4( $table );
    15001505        }
    15011506    }
     
    16291634            if ( $upgrade ) {
    16301635                $wpdb->query( "ALTER TABLE $wpdb->signups DROP INDEX domain_path, ADD INDEX domain_path(domain(140),path(51))" );
     1636            }
     1637        }
     1638    }
     1639
     1640    // 4.2.3
     1641    if ( $wp_current_db_version < 31536 && $wpdb->charset === 'utf8mb4' ) {
     1642        if ( ! defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) {
     1643            $tables = $wpdb->tables( 'global' );
     1644
     1645            foreach ( $tables as $table ) {
     1646                maybe_convert_table_to_utf8mb4( $table );
    16311647            }
    16321648        }
  • branches/4.2/src/wp-includes/version.php

    r32470 r33063  
    1212 * @global int $wp_db_version
    1313 */
    14 $wp_db_version = 31535;
     14$wp_db_version = 31536;
    1515
    1616/**
  • branches/4.2/src/wp-includes/wp-db.php

    r32377 r33063  
    739739        }
    740740
    741         if ( ( $this->use_mysqli && ! ( $this->dbh instanceof mysqli ) )
    742           || ( empty( $this->dbh ) || ! ( $this->dbh instanceof mysqli ) ) ) {
     741        if ( ( $this->use_mysqli && ! ( $this->dbh instanceof mysqli ) ) || empty( $this->dbh ) ) {
    743742            return;
    744743        }
Note: See TracChangeset for help on using the changeset viewer.