Make WordPress Core

Opened 12 years ago

Closed 11 years ago

#24178 closed defect (bug) (fixed)

An active plugin which switches to network-only is impossible to deactivate

Reported by: johnbillion's profile johnbillion Owned by:
Milestone: 3.9 Priority: normal
Severity: major Version:
Component: Plugins Keywords: has-patch commit
Focuses: administration, multisite Cc:

Description

This might sound like an edge case, but this issue affects W3 Total Cache (which is highly popular) and will affect any other plugin that switches to being a network-only plugin as part of a plugin update.

Steps to reproduce:

  1. Write a nice plugin and activate it on one of your sites on Multisite.
  2. Decide that your plugin should only be network-activated. Add the Network: true header to the plugin.
  3. Visit the Plugins screen of the site that your plugin is active on. Note that the plugin is nowhere to be seen, even though the plugin is active.

Real-world example: The W3 Total Cache plugin was updated recently (or not so recently) to make it a network-only plugin (by adding the header above). The plugin gets hidden from the list of active Plugins on any site that it was individually activated on. This makes it impossible to deactivate. Even if you activate it network-wide and then deactivate it, the plugin remains active on the site it was originally active on.

Solution: Active plugins should always be shown on the Plugins screen of individual sites if they are active on the site but not active network-wide.

Loosely related: #18967

Attachments (1)

24178.patch (841 bytes) - added by mordauk 11 years ago.
Check if plugin is active before removing it from list table

Download all attachments as: .zip

Change History (7)

#1 @nacin
11 years ago

  • Focuses administration multisite added
  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 3.9
  • Severity changed from normal to major

Ouch. This is severe, let's fix this.

@mordauk
11 years ago

Check if plugin is active before removing it from list table

#2 @mordauk
11 years ago

  • Keywords has-patch added; needs-patch removed

24178.patch is completely untested as I don't have access to a multisite install at the moment, but I think that fixes it.

Version 0, edited 11 years ago by mordauk (next)

#3 @johnbillion
11 years ago

  • Keywords needs-testing added

#4 @mordauk
11 years ago

I've just tested and confirmed the patch to work. Steps I took:

  1. Created test plugin:
<?php
/*
 * Plugin Name: Network Only Test Plugin
 */

// Just a test plugin for network activation only
  1. Activated the plugin on a site in the network
  1. Added the Network: true header:
    <?php
    /*
     * Plugin Name: Network Only Test Plugin
     * Network: true
     */
    
    // Just a test plugin for network activation only
    
  1. Uploaded the modified version (imitating a plugin update)
  1. The plugin remained visible and active on the site it was activated on in 1.
  1. Deactivated the plugin and it immediately disappeared, as expected for a Network only plugin.

#5 @johnbillion
11 years ago

  • Keywords commit added; needs-testing removed

Tested and confirmed as working as above. Tested with the admin UI and WP-CLI.

#6 @johnbillion
11 years ago

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in [27326].

Note: See TracTickets for help on using tickets.