diff --git a/features/core-update-db.feature b/features/core-update-db.feature index 26c0b868..ab698d49 100644 --- a/features/core-update-db.feature +++ b/features/core-update-db.feature @@ -151,6 +151,45 @@ Feature: Update core's database {UPDATE_VERSION} """ + # This test downgrades to an older WordPress version, but the SQLite plugin requires 6.0+ + @require-mysql + Scenario: Update db respects current network in multinetwork setup + Given a WP multisite install + And a disable_sidebar_check.php file: + """ + $wpdb->blogs, 'where' => [ + 'site_id' => $network_id, 'spam' => 0, 'deleted' => 0, 'archived' => 0, @@ -1326,16 +1342,14 @@ public function update_db( $args, $assoc_args ) { $it = new TableIterator( $iterator_args ); $success = 0; $total = 0; - $site_ids = []; /** * @var object{site_id: int, domain: string, path: string} $blog */ foreach ( $it as $blog ) { ++$total; - $site_ids[] = $blog->site_id; - $url = $blog->domain . $blog->path; - $cmd = "--url={$url} core update-db"; + $url = $blog->domain . $blog->path; + $cmd = "--url={$url} core update-db"; if ( $dry_run ) { $cmd .= ' --dry-run'; } @@ -1365,9 +1379,7 @@ public function update_db( $args, $assoc_args ) { } } if ( ! $dry_run && $total && $success === $total ) { - foreach ( array_unique( $site_ids ) as $site_id ) { - update_metadata( 'site', $site_id, 'wpmu_upgrade_site', $wp_db_version ); - } + update_metadata( 'site', $network_id, 'wpmu_upgrade_site', $wp_db_version ); } WP_CLI::success( "WordPress database upgraded on {$success}/{$total} sites." ); } else {