Skip to content

Asynchronous Plugin installation #29

Description

@moshie

When attempting to install plugins Asynchronously using the bash & WP-cli throws errors regarding failed plugin installation.

To recreate this issue run these commands on a fresh WordPress install.

wp plugin install disable-emojis jetpack &
wp plugin install tiny-compress-images antispam-bee akismet bbpress --activate &

Log:

Downloading install package from https://downloads.wordpress.org/plugin/disable-emojis.1.5.3.zip...
Installing Compress JPEG & PNG images (2.2.4)
Downloading install package from https://downloads.wordpress.org/plugin/tiny-compress-images.2.2.4.zip...
Unpacking the package...
Installing the plugin...
Plugin installed successfully.
Unpacking the package...
Installing the plugin...
Plugin installed successfully.
Installing Jetpack by WordPress.com (5.2.1)
Activating 'tiny-compress-images'...
Plugin 'tiny-compress-images' activated.
Downloading install package from https://downloads.wordpress.org/plugin/jetpack.5.2.1.zip...
Installing Antispam Bee (2.7.1)
Downloading install package from https://downloads.wordpress.org/plugin/antispam-bee.2.7.1.zip...
Unpacking the package...
Installing the plugin...
Plugin installed successfully.
Activating 'antispam-bee'...
Plugin 'antispam-bee' activated.
Installing Akismet (3.3.4)
Downloading install package from https://downloads.wordpress.org/plugin/akismet.3.3.4.zip...
Unpacking the package...
Unpacking the package...
Installing the plugin...
Warning: The package could not be installed. "No valid plugins were found."
Plugin install failed.
Installing the plugin...
Plugin installed successfully.
Error: Only installed 1 of 2 plugins.
Activating 'akismet'...
Plugin 'akismet' activated.
Installing bbPress (2.5.13)
Downloading install package from https://downloads.wordpress.org/plugin/bbpress.2.5.13.zip...
Unpacking the package...
Installing the plugin...
Plugin installed successfully.
Activating 'bbpress'...
Plugin 'bbpress' activated.
Success: Installed 4 of 4 plugins.

Activity

danielbachhuber commented on Aug 4, 2017

@danielbachhuber
Member

Thanks for the report @moshie.

I don't believe this is a fixable problem but I welcome suggestions otherwise. If you install plugins asynchronously, you'll have two separate, parallel processes using the object cache and writing to the database. You can read more about the nature of the problem here: https://core.trac.wordpress.org/ticket/31245

moshie commented on Aug 4, 2017

@moshie
Author

@danielbachhuber Thanks for getting back so quickly and the link to the ticket!

I was afraid that might be the case. Could explain why WordPress only updates it's plugins one at a time even when attempted with ajax.

I am not overly familiar with the inner workings of wp-cli I only stumbled on this as I am building a node api wrapper for wp-cli and was hoping to be able to spawn async child processes for plugin & theme installation.

danielbachhuber commented on Aug 4, 2017

@danielbachhuber
Member

Could explain why WordPress only installs it's plugins one at a time even when attempted with ajax.

Exactly.

I am not overly familiar with the inner workings of wp-cli

Under the hood, WP-CLI simply wraps WordPress core functions. It's typically outside the scope of the WP-CLI project to solve issues in WordPress core.

I am building a node api wrapper for wp-cli

Neat!

was hoping to be able to spawn async child processes for plugin & theme installation.

Probably safest to avoid async for now and instead batch installation whenever possible (e.g. wp plugin install <plugin>...)

theodejager commented on Mar 6, 2023

@theodejager

@danielbachhuber I know this is an old topic and slightly off-topic, but releated, could it be possible to run commands "asynchronously" in remote alias groups.

For example, updating the plugins for a WP-CLI alias group @live-sites, containing a 100 sites, but not have it done sequentially to save time.

wp @live-sites plugin update --all

danielbachhuber commented on Mar 6, 2023

@danielbachhuber
Member

@theodejager Want to open a new issue for that in the main repo? https://github.com/wp-cli/wp-cli/issues

theodejager commented on Mar 7, 2023

@theodejager

Thanks @danielbachhuber, I opened a new issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions