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

Built from https://develop.svn.wordpress.org/branches/4.2@33063


git-svn-id: http://core.svn.wordpress.org/branches/4.2@33034 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dion Hulse 2015-07-03 12:44:28 +00:00
parent 61122743e2
commit 63f64d5909
3 changed files with 40 additions and 25 deletions

View File

@ -524,14 +524,11 @@ function upgrade_all() {
if ( $wp_current_db_version < 29630 )
upgrade_400();
// Don't harsh my mellow. upgrade_422() must be called before
// upgrade_420() to catch bad comments prior to any auto-expansion of
// MySQL column widths.
if ( $wp_current_db_version < 31534 )
upgrade_422();
if ( $wp_current_db_version < 31351 )
upgrade_420();
if ( $wp_current_db_version < 31536 )
upgrade_423();
maybe_disable_link_manager();
@ -1426,23 +1423,6 @@ function upgrade_400() {
* @since 4.2.0
*/
function upgrade_420() {
global $wp_current_db_version, $wpdb;
if ( $wp_current_db_version < 31351 && $wpdb->charset === 'utf8mb4' ) {
if ( is_multisite() ) {
$tables = $wpdb->tables( 'blog' );
} else {
$tables = $wpdb->tables( 'all' );
if ( defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) {
$global_tables = $wpdb->tables( 'global' );
$tables = array_diff_assoc( $tables, $global_tables );
}
}
foreach ( $tables as $table ) {
maybe_convert_table_to_utf8mb4( $table );
}
}
}
/**
@ -1501,6 +1481,31 @@ function upgrade_422() {
}
}
/**
* Execute changes made in WordPress 4.2.0.
*
* @since 4.2.3
*/
function upgrade_423() {
global $wp_current_db_version, $wpdb;
if ( $wp_current_db_version < 31536 && $wpdb->charset === 'utf8mb4' ) {
if ( is_multisite() ) {
$tables = $wpdb->tables( 'blog' );
} else {
$tables = $wpdb->tables( 'all' );
if ( defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) {
$global_tables = $wpdb->tables( 'global' );
$tables = array_diff_assoc( $tables, $global_tables );
}
}
foreach ( $tables as $table ) {
maybe_convert_table_to_utf8mb4( $table );
}
}
}
/**
* Executes network-level upgrade routines.
*
@ -1631,6 +1636,17 @@ function upgrade_network() {
}
}
}
// 4.2.3
if ( $wp_current_db_version < 31536 && $wpdb->charset === 'utf8mb4' ) {
if ( ! defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) {
$tables = $wpdb->tables( 'global' );
foreach ( $tables as $table ) {
maybe_convert_table_to_utf8mb4( $table );
}
}
}
}
//

View File

@ -11,7 +11,7 @@ $wp_version = '4.2.3-alpha';
*
* @global int $wp_db_version
*/
$wp_db_version = 31535;
$wp_db_version = 31536;
/**
* Holds the TinyMCE version

View File

@ -738,8 +738,7 @@ class wpdb {
$this->charset = DB_CHARSET;
}
if ( ( $this->use_mysqli && ! ( $this->dbh instanceof mysqli ) )
|| ( empty( $this->dbh ) || ! ( $this->dbh instanceof mysqli ) ) ) {
if ( ( $this->use_mysqli && ! ( $this->dbh instanceof mysqli ) ) || empty( $this->dbh ) ) {
return;
}