#28651 closed defect (bug) (fixed)
activate_plugin() re-triggers activation routine for already-active network plugins
Reported by: | jbrinley | Owned by: | wonderboymusic |
---|---|---|---|
Milestone: | 4.1 | Priority: | normal |
Severity: | normal | Version: | 3.8 |
Component: | Plugins | Keywords: | has-patch |
Focuses: | multisite | Cc: |
Description
In activate_plugins()
, there's a check to see if the plugin you are activating is already in the array of currently active plugins. If that fails, nothing else should happen in activate_plugins()
; it just skips to the end and returns null
.
When network activating a plugin, though, the $current
array is flipped. Plugin paths are keys, and the values are activation timestamps. The in_array()
will always return false
, unless one of the plugins happens to have a timestamp of 0. So if a plugin is already network active, sending it through activate_plugin()
again will trigger 'activate_plugin'
and 'activate_' . $plugin
again on the already-active plugin.
Attachments (1)
Change History (6)
#1
@
11 years ago
- Keywords has-patch added
I ran into this when using an mu-plugin to force certain plugins to be active. Since my plugin was giving network-active plugins a timestamp of 0, it was preventing me from manually network activating plugins. Fairly trivial to work around in my plugin, but it did expose this minor bug.
The attached patch fixes the bug and adds a unit test for it.
#2
@
11 years ago
I've encountered a similar issue earlier this year, cannot verify the patch but +1 for the bug report.
#3
@
10 years ago
- Version changed from trunk to 3.8
I was able to reproduce this in 3.9 and 3.8 with the unit test.
Checks for already active network plugins in the correct location