blavetstudio / wp-cli-db-anonymize

13 stars 0 forks source link

[Feature Request] Support multisite #1

Open tyrann0us opened 2 years ago

tyrann0us commented 2 years ago

Is your feature request related to a problem? Please describe. The tool looks very promising, but it does not support multisite yet: Error: This command doesn't support MultiSite yet. (there's a typo in "multisite" BTW).

It doesn't even work when ran for individual sites with the --url flag because you check for is_multisite() regardless of the command arguments: https://github.com/blavetstudio/wp-cli-db-anonymize/blob/02de19e4b45470a389e4a6c9736d47ab592a3170/src/DBAnonymizeCommand.php#L62

Describe the desired solution It would be great if you could add multisite support.

Describe the alternatives that you have considered Mention in the documentation that the tool does not support multisite. But this would not be an actual alternative for us because 100% of our projects use multisite.

Additional context We are in the process of questioning our current approach to anonymization and came across this tool during our research.

cfaria commented 2 years ago

PRs are open, but I'm going to take a look for it...

There is no --url flag available so it won't work that way 😄

cfaria commented 2 years ago

BTW, what typo in MultiSite? you mean the uppercase? 🤣

tyrann0us commented 2 years ago

Hi @cfaria, thanks for getting back to me.

There is no --url flag available so it won't work that way 😄

I was referring to WP-CLI's global --url argument, see here. Even without "official" multisite support of this tool, it would allow us to loop over all sites in the network like this:

for URL in $(wp site list --field=url); do wp db-anonymize --woocommerce --url="$URL"; done

BTW, what typo in MultiSite? you mean the uppercase? 🤣

Yes, according to https://wordpress.org/support/article/glossary/#multisite, it's "multisite". 🙂