Make WordPress Core

Changeset 20526


Ignore:
Timestamp:
04/19/2012 03:43:56 AM (13 years ago)
Author:
nacin
Message:

Do not deactivate plugins which are already deactivated.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.3/wp-admin/plugins.php

    r19528 r20526  
    155155
    156156            check_admin_referer('deactivate-plugin_' . $plugin);
     157            if ( ! is_network_admin() && is_plugin_active_for_network() ) {
     158                wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") );
     159                exit;
     160            }
    157161            deactivate_plugins($plugin);
    158162            update_option('recently_activated', array($plugin => time()) + (array)get_option('recently_activated'));
     
    170174
    171175            $plugins = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array();
    172             $plugins = array_filter($plugins, 'is_plugin_active'); //Do not deactivate plugins which are already deactivated.
     176            // Do not deactivate plugins which are already deactivated.
     177            if ( is_network_admin() ) {
     178                $plugins = array_filter( $plugins, 'is_plugin_active_for_network' );
     179            } else {
     180                $plugins = array_filter( $plugins, 'is_plugin_active' );
     181                $plugins = array_diff( $plugins, array_filter( $plugins, 'is_plugin_active_for_network' ) );
     182            }
    173183            if ( empty($plugins) ) {
    174184                wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") );
Note: See TracChangeset for help on using the changeset viewer.