mirror of
https://github.com/WordPress/WordPress.git
synced 2024-09-12 15:48:34 +02:00
Don't upgrade global tables to utf8mb4 when DO_NOT_UPGRADE_GLOBAL_TABLES
is defined.
This change also standardises on only checking `DO_NOT_UPGRADE_GLOBAL_TABLES` is defined, not it's value. Fixes #32154 for 4.2 Built from https://develop.svn.wordpress.org/branches/4.2@33059 git-svn-id: http://core.svn.wordpress.org/branches/4.2@33030 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
371db8aea1
commit
61122743e2
@ -1433,6 +1433,10 @@ function upgrade_420() {
|
|||||||
$tables = $wpdb->tables( 'blog' );
|
$tables = $wpdb->tables( 'blog' );
|
||||||
} else {
|
} else {
|
||||||
$tables = $wpdb->tables( 'all' );
|
$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 ) {
|
foreach ( $tables as $table ) {
|
||||||
@ -1596,7 +1600,7 @@ function upgrade_network() {
|
|||||||
|
|
||||||
// 4.2
|
// 4.2
|
||||||
if ( $wp_current_db_version < 31351 && $wpdb->charset === 'utf8mb4' ) {
|
if ( $wp_current_db_version < 31351 && $wpdb->charset === 'utf8mb4' ) {
|
||||||
if ( ! ( defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) && DO_NOT_UPGRADE_GLOBAL_TABLES ) ) {
|
if ( ! defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) {
|
||||||
$wpdb->query( "ALTER TABLE $wpdb->usermeta DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))" );
|
$wpdb->query( "ALTER TABLE $wpdb->usermeta DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))" );
|
||||||
$wpdb->query( "ALTER TABLE $wpdb->site DROP INDEX domain, ADD INDEX domain(domain(140),path(51))" );
|
$wpdb->query( "ALTER TABLE $wpdb->site DROP INDEX domain, ADD INDEX domain(domain(140),path(51))" );
|
||||||
$wpdb->query( "ALTER TABLE $wpdb->sitemeta DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))" );
|
$wpdb->query( "ALTER TABLE $wpdb->sitemeta DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))" );
|
||||||
@ -1612,7 +1616,7 @@ function upgrade_network() {
|
|||||||
|
|
||||||
// 4.2.2
|
// 4.2.2
|
||||||
if ( $wp_current_db_version < 31535 && 'utf8mb4' === $wpdb->charset ) {
|
if ( $wp_current_db_version < 31535 && 'utf8mb4' === $wpdb->charset ) {
|
||||||
if ( ! ( defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) && DO_NOT_UPGRADE_GLOBAL_TABLES ) ) {
|
if ( ! defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) {
|
||||||
$upgrade = false;
|
$upgrade = false;
|
||||||
$indexes = $wpdb->get_results( "SHOW INDEXES FROM $wpdb->signups" );
|
$indexes = $wpdb->get_results( "SHOW INDEXES FROM $wpdb->signups" );
|
||||||
foreach( $indexes as $index ) {
|
foreach( $indexes as $index ) {
|
||||||
@ -2459,7 +2463,7 @@ function pre_schema_upgrade() {
|
|||||||
|
|
||||||
// Upgrade versions prior to 4.2.
|
// Upgrade versions prior to 4.2.
|
||||||
if ( $wp_current_db_version < 31351 ) {
|
if ( $wp_current_db_version < 31351 ) {
|
||||||
if ( ! is_multisite() ) {
|
if ( ! is_multisite() && ! defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) {
|
||||||
$wpdb->query( "ALTER TABLE $wpdb->usermeta DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))" );
|
$wpdb->query( "ALTER TABLE $wpdb->usermeta DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))" );
|
||||||
}
|
}
|
||||||
$wpdb->query( "ALTER TABLE $wpdb->terms DROP INDEX slug, ADD INDEX slug(slug(191))" );
|
$wpdb->query( "ALTER TABLE $wpdb->terms DROP INDEX slug, ADD INDEX slug(slug(191))" );
|
||||||
|
Loading…
Reference in New Issue
Block a user