WordPress.org

Make WordPress Core

Ticket #15709: 15709.diff

File 15709.diff, 1.7 KB (added by PeteMall, 5 years ago)
  • wp-admin/includes/plugin.php

     
    455455} 
    456456 
    457457/** 
     458 * Check whether the plugin is not network activated. 
     459 * 
     460 * Reverse of is_plugin_inactive_for_network(). Used as a callback. 
     461 * 
     462 * @since 3.1.1 
     463 * @see is_plugin_inactive_for_network() 
     464 * 
     465 * @param string $plugin Base plugin path from plugins directory. 
     466 * @return bool True if inactive. False if active. 
     467 */ 
     468function is_plugin_inactive_for_network( $plugin ) { 
     469        return ! is_plugin_active_for_network( $plugin ); 
     470} 
     471 
     472/** 
    458473 * Checks for "Network: true" in the plugin header to see if this should 
    459474 * be activated only as a network wide plugin. The plugin would also work 
    460475 * when Multisite is not enabled. 
  • wp-admin/plugins.php

     
    195195 
    196196                        //$_POST = from the plugin form; $_GET = from the FTP details screen. 
    197197                        $plugins = isset( $_REQUEST['checked'] ) ? (array) $_REQUEST['checked'] : array(); 
    198                         $plugins = array_filter($plugins, 'is_plugin_inactive'); // Do not allow to delete Activated plugins. 
     198 
     199                        if ( ! is_network_admin() ) 
     200                                $plugins = array_filter( $plugins, 'is_plugin_inactive' ); // Do not allow to delete Activated plugins. 
     201                        else 
     202                                $plugins = array_filter( $plugins, 'is_plugin_inactive_for_network' ); // Do not allow to delete Network Activated plugins. 
     203 
    199204                        if ( empty($plugins) ) { 
    200205                                wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") ); 
    201206                                exit;