Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only use maintenance mode if a plugin or theme needs updating #492

Merged
merged 3 commits into from Jun 5, 2013
Merged

Only use maintenance mode if a plugin or theme needs updating #492

merged 3 commits into from Jun 5, 2013

Conversation

om4james
Copy link

@om4james om4james commented Jun 5, 2013

Fixes #491

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
$result = array();

// Only attempt to update if there is something to update
if ( count($items_to_update) > 0 )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idiomatic way would be to check !empty( $items_to_update ).

@om4james
Copy link
Author

om4james commented Jun 5, 2013

Thanks for the feedback @scribu!

scribu pushed a commit that referenced this pull request Jun 5, 2013
Only use maintenance mode if a plugin or theme needs updating
@scribu scribu merged commit 862e0c4 into wp-cli:master Jun 5, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

wp plugin update-all enters maintenance mode even when no updates are available
3 participants