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:
parent
c43e93d935
commit
f29b2e02ac
|
@ -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