Ticket #32127: 32127.2.diff
File 32127.2.diff, 2.5 KB (added by , 10 years ago) |
---|
-
src/wp-admin/includes/upgrade.php
527 527 if ( $wp_current_db_version < 31351 ) 528 528 upgrade_420(); 529 529 530 if ( $wp_current_db_version < 323 64)530 if ( $wp_current_db_version < 32378 ) 531 531 upgrade_430(); 532 532 533 533 maybe_disable_link_manager(); … … 1479 1479 wp_delete_comment( $comment->comment_ID, true ); 1480 1480 } 1481 1481 } 1482 1483 if ( $wp_current_db_version < 32378 && $wpdb->charset === 'utf8mb4' ) { 1484 if ( is_multisite() ) { 1485 $tables = $wpdb->tables( 'blog' ); 1486 } else { 1487 $tables = $wpdb->tables( 'all' ); 1488 } 1489 1490 foreach ( $tables as $table ) { 1491 maybe_convert_table_to_utf8mb4( $table ); 1492 } 1493 } 1482 1494 } 1483 1495 1484 1496 /** … … 1609 1621 if ( $upgrade ) { 1610 1622 $wpdb->query( "ALTER TABLE $wpdb->signups DROP INDEX domain_path, ADD INDEX domain_path(domain(140),path(51))" ); 1611 1623 } 1624 1625 $tables = $wpdb->tables( 'global' ); 1626 1627 foreach ( $tables as $table ) { 1628 maybe_convert_table_to_utf8mb4( $table ); 1629 } 1612 1630 } 1613 1631 } 1614 1632 } … … 2446 2464 $wpdb->query( "ALTER TABLE $wpdb->postmeta DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))" ); 2447 2465 $wpdb->query( "ALTER TABLE $wpdb->posts DROP INDEX post_name, ADD INDEX post_name(post_name(191))" ); 2448 2466 } 2467 2468 // Upgrade versions prior to 4.2.2 2469 if ( $wp_current_db_version < 32378 ) { 2470 $tables = array( 2471 $wpdb->usermeta => 'meta_key', 2472 $wpdb->terms => 'slug', 2473 $wpdb->terms => 'name', 2474 $wpdb->commentmeta => 'meta_key', 2475 $wpdb->postmeta => 'meta_key', 2476 $wpdb->posts => 'post_name', 2477 ); 2478 2479 foreach ( $tables as $table => $table_index ) { 2480 $upgrade = false; 2481 $indexes = $wpdb->get_results( "SHOW INDEXES FROM $table" ); 2482 foreach( $indexes as $index ) { 2483 if ( $table_index == $index->Key_name && $table_index == $index->Column_name && 191 != $index->Sub_part ) { 2484 $upgrade = true; 2485 break; 2486 } 2487 } 2488 2489 if ( $upgrade ) { 2490 $wpdb->query( "ALTER TABLE $table DROP INDEX $table_index, ADD INDEX $table_index($table_index(191))" ); 2491 } 2492 } 2493 } 2449 2494 } 2450 2495 2451 2496 /** -
src/wp-includes/wp-db.php
739 739 } 740 740 741 741 if ( ( $this->use_mysqli && ! ( $this->dbh instanceof mysqli ) ) 742 || ( empty( $this->dbh ) || ! ( $this->dbh instanceof mysqli )) ) {742 || ( empty( $this->dbh ) ) ) { 743 743 return; 744 744 } 745 745