wp-cli / ideas

💡 Ideas and feature requests are collected here
40 stars 1 forks source link

wp plugin activate --all should skip once failed and try again when all activated #137

Open mucahityilmaz opened 4 years ago

mucahityilmaz commented 4 years ago

Let's say we have these plugins to install:

We can install them successfully with this command: wp plugin install woocommerce woocommerce-services mailchimp-for-woocommerce

Regarding other possible plugins, let's assume we decided to activate all at once: wp plugin activate --all

It gives this error and stops activating other plugins: Error: The MailChimp For WooCommerce plugin requires the WooCommerce plugin to be active!

This is happened because the name of MailChimp plugin's folder starts with the letter 'm' and Woocommerce obviously starts with 'w'.

Problem: Our command shouldn't fail because of this alphabetical order.

Solution: The dependent plugin can be skipped once, until all the others are activated, then can be tried again. For extreme scenarios this can be recursive too, like until no dependency error has been found.

Because we are using this command line tool to automatize things and this is an unnecessary fail.

What do you think?

schlessera commented 4 years ago

I think we can implement this but we should put it behind an optional flag, and not have it be the default behavior, as I fear it might have unintended side effects in some scenarios.

Something like --retry would allow you to then use this within scripts.

mucahityilmaz commented 4 years ago

Or, if the command is capable to return the name of plugin which is required, maybe it can try to activate it first. But for this it should check somehow is the required one added to the command or not. This would prevent recursion as a best practice, I think.