wp-cli / core-command

Downloads, installs, updates, and manages a WordPress installation.
MIT License
48 stars 49 forks source link

wp core update-db --network only updates the first network for "multinetwork" install #224

Open javiercasares opened 2 years ago

javiercasares commented 2 years ago

Hello! I've been trying something but doesn't work fine.

I have a WordPress MultiNetwork installed (for a client) and I've been trying to do this command wp core update-db like a network, but doesn't update everything.

wp core update-db --network --path=/web/example.com/

This updates the "first" multisite, as expected.

But, there are 2 networks, and inside each one, there are some subsites. If I execute

wp core update-db --network --url="network1.com" --path=/web/example.com/

Or any other "url" it always executes the first multisite in the network.

I think there are 2 possibles solutions there. The first one (I think that will the best one) is to run

wp core update-db --network --path=/web/example.com/

and check all the subsites (whatever network they are). I think maybe check all the sites in the database active or not (because archived sites should also update the database tables).

The other case may be to use the --url parameter with the main hostname (in a multinetwork you have hostnames and then subfolders), so if you use the --url parameter, check al the sites for this network.

danielbachhuber commented 1 year ago

Thanks for the report, @javiercasares !

The other case may be to use the --url parameter with the main hostname (in a multinetwork you have hostnames and then subfolders), so if you use the --url parameter, check al the sites for this network.

I think this approach probably makes more sense.

Out of curiosity, how does WordPress core handle this for the web?

javiercasares commented 1 year ago

Out of curiosity, how does WordPress core handle this for the web?

You need to do the process in each Network. When you execute the Update process in Network A, only lists the sites in Network A, and Network B, lists sites in B.