`wp plugin update-all` enters maintenance mode even when no updates are available #491

Closed
om4james opened this Issue Jun 5, 2013 · 6 comments

Comments

2 participants
Contributor

om4james commented Jun 5, 2013

When executing wp plugin update-all on a site with no plugin updates, the output is as follows:

Enabling Maintenance mode... Disabling Maintenance mode... Success: Updated 0/0 plugins.

I think ideally we shouldn't enter maintenance mode at all if no updates are available.

I suspect theme and possibly core updates might need the same enhancement as well.

Owner

scribu commented Jun 5, 2013

WP-CLI just uses the bulk upgrader from WordPress, so you should file a bug upstream:

http://core.trac.wordpress.org/

Contributor

om4james commented Jun 5, 2013

Thanks for the quick reply.

Upon further investigation, this only occurs when using WordPress Multisite:

wp plugin update-all Enabling Maintenance mode... Disabling Maintenance mode... Success: Updated 0/0 plugins.

Normal WordPress simply outputs:

wp plugin update-all Success: Updated 0/0 plugins.

I agree though @scribu, sounds like a fix is needed in WordPress core.

om4james pushed a commit to om4james/wp-cli that referenced this issue Jun 5, 2013

Only use maintenance mode if a plugin or theme needs updating
When updating plugins (wp plugin update-all) or themes (wp theme update-all) on a WordPress multisite installation, maintenance activated and deactivated even if there are no updates to install.

The Plugin_Upgrader::bulk_upgrade() and Theme_Upgrader::bulk_upgrade() WordPress functions currently don't check that the array passed to it isn't empty, causing maintenance mode to be enabled even if no updates are required.

This bug doesn't affect non multisite installs, because for non multisite installs the code in Plugin_Upgrader::bulk_upgrade() and Theme_Upgrader::bulk_upgrade() only uses maintenance mode if the plugin/theme being updated is activated.

Fixes #491
Contributor

om4james commented Jun 5, 2013

@scribu, this commit is one way to fix this in wp-cli.

The other would be for me to submit a patch for WordPress core that adds checks to Plugin_Upgrader::bulk_upgrade() and Theme_Upgrader::bulk_upgrade() only act if the array passed to them isn't empty.

Owner

scribu commented Jun 5, 2013

The other would be for me to submit a patch for WordPress core that adds checks to Plugin_Upgrader::bulk_upgrade() and Theme_Upgrader::bulk_upgrade() only act if the array passed to them isn't empty.

Please do that anyway, regardless of what WP-CLI does.

Contributor

om4james commented Jun 5, 2013

Core bug report: http://core.trac.wordpress.org/ticket/24496
Pull Request: #492

Thanks @scribu.

@scribu scribu closed this in #492 Jun 5, 2013

Contributor

om4james commented Aug 17, 2013

Core bug report: http://core.trac.wordpress.org/ticket/24496

This bug has now been fixed in core and will be included in WordPress 3.7.

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