mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-02-27 11:12:50 +00:00
Plugin Deletion: Properly clear the cache when multiple plugins are deleted. Props jdgrimes. Fixes #26065
git-svn-id: https://develop.svn.wordpress.org/trunk@26262 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
05ec933ea1
commit
520840e84c
@ -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;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user