-
Notifications
You must be signed in to change notification settings - Fork 56
Fix wp core update-db --network to respect network ID in multinetwork installations
#302
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
f1c9d05
fe80523
b9f51da
43acb45
67cef5c
c1c1844
778d7bc
7dd1285
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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: | ||
| """ | ||
| <?php | ||
| WP_CLI::add_wp_hook( 'init', static function () { | ||
| remove_action( 'after_switch_theme', '_wp_sidebars_changed' ); | ||
| } ); | ||
| """ | ||
| And I try `wp theme install twentytwenty --activate` | ||
| And I run `wp core download --version=5.4 --force` | ||
| And I run `wp option update db_version 45805 --require=disable_sidebar_check.php` | ||
| And I run `wp site option update wpmu_upgrade_site 45805` | ||
| And I run `wp site create --slug=foo` | ||
| And I run `wp site create --slug=bar` | ||
|
|
||
| When I run `wp eval "echo defined('SITE_ID_CURRENT_SITE') ? SITE_ID_CURRENT_SITE : 'not defined';"` | ||
| Then STDOUT should contain: | ||
| """ | ||
| 1 | ||
| """ | ||
|
|
||
| When I run `wp site option get wpmu_upgrade_site` | ||
| Then save STDOUT as {UPDATE_VERSION} | ||
|
|
||
| When I run `wp core update-db --network` | ||
| Then STDOUT should contain: | ||
| """ | ||
| Success: WordPress database upgraded on 3/3 sites. | ||
| """ | ||
|
|
||
| When I run `wp site option get wpmu_upgrade_site` | ||
| Then STDOUT should not contain: | ||
| """ | ||
| {UPDATE_VERSION} | ||
| """ | ||
|
Comment on lines
+156
to
+191
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The new test scenario is titled "Update db respects current network in multinetwork setup", but the test itself only sets up a standard single-network multisite installation. While this is a good regression test to ensure the command still works for standard multisite, it doesn't verify the core of the fix, which is to correctly target a specific network in a true multinetwork environment (with multiple networks). To make the test more comprehensive and accurately reflect its name, it should be updated to:
This would provide confidence that the fix works as intended for the multinetwork scenario described in the pull request. |
||
|
|
||
| Scenario: Ensure update-db sets WP_INSTALLING constant | ||
| Given a WP install | ||
| And a before.php file: | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.