mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Deactivate plugins during plugin update. Props DD32. see #6262
git-svn-id: https://develop.svn.wordpress.org/trunk@7465 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -197,13 +197,19 @@ function wp_update_plugin($plugin, $feedback = '') {
|
||||
// Once installed, delete the package
|
||||
unlink($file);
|
||||
|
||||
if ( is_plugin_active($plugin) ) {
|
||||
//Deactivate the plugin
|
||||
apply_filters('update_feedback', __('Deactivating the plugin'));
|
||||
deactivate_plugins($plugin, true);
|
||||
}
|
||||
|
||||
// Remove the existing plugin.
|
||||
apply_filters('update_feedback', __('Removing the old version of the plugin'));
|
||||
$plugin_dir = dirname($base . PLUGINDIR . "/$plugin");
|
||||
$plugin_dir = trailingslashit($plugin_dir);
|
||||
|
||||
// If plugin is in its own directory, recursively delete the directory.
|
||||
if( strpos($plugin, '/') && $plugin_dir != $base . PLUGINDIR . '/' )
|
||||
if ( strpos($plugin, '/') && $plugin_dir != $base . PLUGINDIR . '/' )
|
||||
$deleted = $wp_filesystem->delete($plugin_dir, true);
|
||||
else
|
||||
$deleted = $wp_filesystem->delete($base . PLUGINDIR . "/$plugin");
|
||||
@@ -225,6 +231,13 @@ function wp_update_plugin($plugin, $feedback = '') {
|
||||
|
||||
// Force refresh of plugin update information
|
||||
delete_option('update_plugins');
|
||||
|
||||
//Return the new plugin file.
|
||||
if ( ! preg_match('!/([a-z0-9\-]+)/?$!i', $working_dir, $mat) )
|
||||
return false;
|
||||
$plugin = get_plugins('/' . $mat[1]); //Pass it with a leading slash
|
||||
$list = array_keys($plugin);
|
||||
return $mat[1] . '/' . $list[0]; //Pass it without a leading slash.
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user