WordPress.org

Make WordPress Core

Opened 12 months ago

Closed 7 weeks ago

#24178 closed defect (bug) (fixed)

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

Reported by: 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 2 months ago.
Check if plugin is active before removing it from list table

Download all attachments as: .zip

Change History (7)

comment:1 nacin2 months 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.

mordauk2 months ago

Check if plugin is active before removing it from list table

comment:2 mordauk2 months 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.

Last edited 7 weeks ago by SergeyBiryukov (previous) (diff)

comment:3 johnbillion2 months ago

  • Keywords needs-testing added

comment:4 mordauk2 months 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.

comment:5 johnbillion7 weeks ago

  • Keywords commit added; needs-testing removed

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

comment:6 johnbillion7 weeks ago

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

Fixed in [27326].

Note: See TracTickets for help on using tickets.