Skip to content

Commit 143f1d1

Browse files
Upgrade/Install: Correct the database upgrade routine for WordPress 6.9.
This commit: * Moves the call to `upgrade_690()` to the correct place so it actually gets called. * Wraps Hello Dolly upgrade code in a version check per standard practice. * Removes the `$wpdb->query()` call to avoid attempting to create the new index twice, once in the upgrade and once in `dbDelta()`. Follow-up to [60666], [60716], [60717]. Props peterwilsoncc, mukesh27. See #50161, #53323. git-svn-id: https://develop.svn.wordpress.org/trunk@60721 602fd350-edb4-49c9-b593-d223f7449a82
1 parent cecd546 commit 143f1d1

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

src/wp-admin/includes/upgrade.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -880,13 +880,16 @@ function upgrade_all() {
880880

881881
if ( $wp_current_db_version < 58975 ) {
882882
upgrade_670();
883-
upgrade_690();
884883
}
885884

886885
if ( $wp_current_db_version < 60421 ) {
887886
upgrade_682();
888887
}
889888

889+
if ( $wp_current_db_version < 60717 ) {
890+
upgrade_690();
891+
}
892+
890893
maybe_disable_link_manager();
891894

892895
maybe_disable_automattic_widgets();
@@ -2488,25 +2491,22 @@ function ( $url ) {
24882491
* @ignore
24892492
* @since 6.9.0
24902493
*
2491-
* @global int $wp_current_db_version The old (current) database version.
2492-
* @global wpdb $wpdb WordPress database abstraction object.
2494+
* @global int $wp_current_db_version The old (current) database version.
24932495
*/
24942496
function upgrade_690() {
2495-
global $wp_current_db_version, $wpdb;
2496-
2497-
// Switch Hello Dolly from file to directory format. See #53323
2498-
$active_plugins = get_option( 'active_plugins' );
2499-
$old_plugin = 'hello.php';
2500-
$new_plugin = 'hello-dolly/hello.php';
2501-
$key = array_search( $old_plugin, $active_plugins, true );
2502-
2503-
if ( $key ) {
2504-
$active_plugins[ $key ] = $new_plugin;
2505-
update_option( 'active_plugins', $active_plugins );
2506-
}
2497+
global $wp_current_db_version;
25072498

25082499
if ( $wp_current_db_version < 60717 ) {
2509-
$wpdb->query( "ALTER TABLE $wpdb->posts ADD INDEX type_status_author (post_type,post_status,post_author)" );
2500+
// Switch Hello Dolly from file to directory format. See #53323
2501+
$active_plugins = get_option( 'active_plugins' );
2502+
$old_plugin = 'hello.php';
2503+
$new_plugin = 'hello-dolly/hello.php';
2504+
$key = array_search( $old_plugin, $active_plugins, true );
2505+
2506+
if ( $key ) {
2507+
$active_plugins[ $key ] = $new_plugin;
2508+
update_option( 'active_plugins', $active_plugins );
2509+
}
25102510
}
25112511
}
25122512

0 commit comments

Comments
 (0)