Plugin Deletion: Properly clear the cache when multiple plugins are deleted. Props jdgrimes. Fixes #26065

Built from https://develop.svn.wordpress.org/trunk@26262


git-svn-id: http://core.svn.wordpress.org/trunk@26168 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dion Hulse 2013-11-19 04:08:09 +00:00
parent c43e93d935
commit f29b2e02ac
1 changed files with 12 additions and 6 deletions

View File

@ -803,15 +803,21 @@ function delete_plugins($plugins, $redirect = '' ) {
$errors[] = $plugin_file;
}
// Remove deleted plugins from the plugin updates list.
if ( $current = get_site_transient('update_plugins') ) {
// Don't remove the plugins that weren't deleted.
$deleted = array_diff( $plugins, $errors );
foreach ( $deleted as $plugin_file ) {
unset( $current->response[ $plugin_file ] );
}
set_site_transient( 'update_plugins', $current );
}
if ( ! empty($errors) )
return new WP_Error('could_not_remove_plugin', sprintf(__('Could not fully remove the plugin(s) %s.'), implode(', ', $errors)) );
// Force refresh of plugin update information
if ( $current = get_site_transient('update_plugins') ) {
unset( $current->response[ $plugin_file ] );
set_site_transient('update_plugins', $current);
}
return true;
}