Make WordPress Core

Changeset 60721


Ignore:
Timestamp:
09/08/2025 01:46:00 PM (2 months ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

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

    r60718 r60721  
    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();
     887    }
     888
     889    if ( $wp_current_db_version < 60717 ) {
     890        upgrade_690();
    888891    }
    889892
     
    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 */
    24942496function 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}
Note: See TracChangeset for help on using the changeset viewer.