wp-cli / extension-command

Manages plugins and themes, including installs, activations, and updates.
MIT License
87 stars 82 forks source link

Plugin Dependencies Support #407

Open Luc45 opened 5 months ago

Luc45 commented 5 months ago

Feature Request

WordPress 6.5 adds the Plugin Dependencies capability. It would be useful if plugin install had a --with-dependencies flag to also install the dependencies of the plugin being installed.

swissspidy commented 5 months ago

Generally speaking, we need to test with the new plugin dependencies feature and see if and what to change. If the plugin‘s API provides this information easily, then I could see such a flag being useful for sure.

Luc45 commented 5 months ago

I haven't looked at how WP Core does it, but it should probably be surfaced on the API already to render it on the wp-admin?plugins.php page

swissspidy commented 5 months ago

Right. This is surfaced in the API via the requires_plugins field which contains an array of slugs.

Example: https://api.wordpress.org/plugins/info/1.2/?action=plugin_information&request%5Blocale%5D=en_US&request%5Bslug%5D=wpsso-wc-metadata&fields=versions

So should be available for us too 👍

Edit:

for already installed plugins we might be able to use the WP_Plugin_Dependencies class

swissspidy commented 3 months ago

One use case I just stumbled upon:

Provide an easy way to install all dependencies of a plugin.

e.g. if I have plugin X installed (not necessarily activated) that depends on Y and Z, I want an easy way to install Y and Z, without having to activate X.

swissspidy commented 3 months ago

Listing dependencies in wp plugin get <slug> would also be useful