-
Notifications
You must be signed in to change notification settings - Fork 57
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?
Conversation
Add site_id filtering to ensure only sites from the current network are updated when using --network flag. This allows proper operation in multinetwork WordPress installations when combined with --url parameter. Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Add a simple test to verify that SITE_ID_CURRENT_SITE is properly defined in multisite installations, which is used by the update-db command to filter sites by network. Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
wp core update-db --network to respect network ID in multinetwork installations
Include WordPress downgrade, database version downgrade, site creation, and verification of the actual update-db command execution and success. Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Since all blogs are filtered by site_id = network_id, there's no need to collect and deduplicate site_ids. Directly use network_id for the metadata update. Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
|
@swissspidy We have a fatal php error in tests https://github.com/wp-cli/core-command/actions/runs/19191674343/job/54867112573?pr=302 |
|
@wojsmol You're looking at a previous run. I just fixed that error in my recent commit, all tests are passing now (except for PHP nightly, but that's a different story) |
Description
In multinetwork WordPress installations,
wp core update-db --networkqueries all blogs without filtering bysite_id, causing it to only update the first network regardless of the--urlparameter.Changes
Core Logic (
src/Core_Command.php)SITE_ID_CURRENT_SITEconstant (set by--url), falling back toget_current_network_id(), then network ID 1site_idfilter to TableIterator WHERE clause to scope blogs to current network$network_idinstead of collecting and deduplicating site IDsTest Coverage (
features/core-update-db.feature)Usage
Backward Compatibility
Standard multisite installations (single network) maintain existing behavior as network ID defaults to 1.
Fixes #198
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.