Use is_plugin_active() and remove double searching. Props DD32. fixes #6332

git-svn-id: http://svn.automattic.com/wordpress/trunk@7488 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-03-23 16:36:05 +00:00
parent b274b643a1
commit 0590b75eec

View File

@ -122,12 +122,10 @@ function deactivate_plugins($plugins, $silent= false) {
$plugins = array($plugins);
foreach ( $plugins as $plugin ) {
$item = array_search( $plugin, $current);
if( false === $item)
if( ! is_plugin_active($plugin) )
continue;
if ( ( $key = array_search( $plugin, $current) ) !== false )
array_splice($current, $key, 1 ); // Fixed Array-fu!
if ( ! $silent )
array_splice($current, array_search( $plugin, $current), 1 ); // Fixed Array-fu!
if ( ! $silent ) //Used by Plugin updater to internally deactivate plugin, however, not to notify plugins of the fact to prevent plugin output.
do_action('deactivate_' . trim( $plugin ));
}