[wp-trac] [WordPress Trac] #21122: deactivate_plugins called within a deactivation callback doesn't work

WordPress Trac wp-trac at lists.automattic.com
Sat Jun 30 10:39:34 UTC 2012


#21122: deactivate_plugins called within a deactivation callback doesn't work
--------------------------+-----------------------------
 Reporter:  stephenh1988  |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Plugins       |    Version:  3.4
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 This problem occurs when you attempt to deactivate another a plug-in, when
 some other plug-in is deactivated. For instance, you may want to
 deactivate all 'dependent' plug-ins when their 'parent' plug-in is
 deactivated.

 First `deactivate_plugins` (Link to source:
 https://github.com/WordPress/WordPress/blob/3.4.1/wp-
 admin/includes/plugin.php#L580) retrieves an array of active plug-ins, and
 removes the plugin to be deactivated. It then triggers the plug-in's
 deactivation hook (inside which someone may try to deactivate a second
 plug-in). Once the actions have been completed, the array of active plug-
 ins is updated to the database - but this array does not reflect any
 activation / deactivation that has taken place as a result of the
 triggered actions.

 Consequently the array is updated with only the original plug-in removed.

 Importantly, the deactivation callbacks for all plug-ins are triggered,
 but all but the original plug-in exist as active in the database.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/21122>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list