WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 6 years ago

#4176 closed enhancement (fixed)

Option to "Reactivate All Plugins" after deactivating them

Reported by: dougal Owned by: westi
Milestone: 2.5 Priority: normal
Severity: normal Version:
Component: Administration Keywords: plugins, activation, has-patch, needs-testing plugin-management
Focuses: Cc:

Description

The new "Deactivate All Plugins" function is great. Now we just need a quick way to "Reactivate All". Patch attached.

When the "Deactivate All" function is used, this will store the old plugin list in an option named 'deactivated_plugins'. When the plugin page sees that the 'active_plugins' option is empty, but 'deactivated_plugins' is not empty, it will present a "Reactivate All Plugins" button.

When an attempt to reactivate the previous set of plugins is made, each plugin is tested in turn, and errors in individual plugins will be listed, if possible (e.g. if a plugin was deleted between the "Deactivate All" and the "Reactivate All").

A fatal PHP error in a plugin will cause the reactivation to abort, and no plugins will be activated. I was hoping that I could just ignore that one plugin, but couldn't find a way, due to the lack of real exception handling in PHP 4.

I tried to test what I could think of, but any third-party testing would also be appreciated.

Attachments (3)

reactivate-plugins.diff (5.5 KB) - added by dougal 7 years ago.
Patch to wp-admin/plugins.php to add "Reactivate All Plugins" function. Patch against branches/2.2 r5290
reactivate-plugins.2.diff (5.6 KB) - added by DD32 7 years ago.
Reactivate All Plugins against 2.3beta
reactivate-plugins+output2.diff (4.3 KB) - added by DD32 7 years ago.
Reactivate All Plugins(And also catch non-fatal errors)

Download all attachments as: .zip

Change History (19)

dougal7 years ago

Patch to wp-admin/plugins.php to add "Reactivate All Plugins" function. Patch against branches/2.2 r5290

comment:1 rob1n7 years ago

  • Milestone changed from 2.2 to 2.3

I really think this is a niche case. Apart from upgrading (and I leave all my plugins active when I upgrade, personally), the use for Deactivate All Plugins was initially to get everything deactivated, in a hurry, in case some plugin was causing a fatal error of some kind, or to debug.

I'm -0.5. I think the way it's implemented could be improved, but I personally have no better way so I'm not going to add or detract based on that.

comment:2 DD327 years ago

I really think this is a niche case
Not entirely, Anyone who finds "Deactivate All" will find this one useful, Its painful to have to re-enable each one one-by-one, especially when you just want to deactivate all the plugins to see if an issue is being caused by them(Plugins), or something completely different.
I implemented something very similar in my GSOC WordPress Update plugin(no public as of yet), and was intending on submitting the "re-activate all" part as a trac ticket for Core when i got some spare time.

So i think its a good idea for integration.

comment:3 schulte7 years ago

I can see the casual user of WP hitting the "Deactivate All Plugins" button and suddenly finding things awry, needing that quick fix to restore their plugins to the prior, activated state. I don't think you can have one of these actions without the other.

Patched. Tires kicked on 2.3-alpha (rev 5291). Seemed to go as expected. Removal of a plugin after deactivation/reactivation was handled gracefully.

+1

comment:4 markjaquith7 years ago

I think this is necessary functionality if we have a "Deactivate All" button.

+1

comment:5 torbens7 years ago

Definitely very useful! This also might help to overcome one's inhibition to perform a minor security update...

But why not incorporating functionality provided by this plugin (http://www.wiso.cz/2007/03/07/my-new-wordpress-plugin-wp-enhanced-plugin-manager-10/) into the core. This could be very useful.

+1

comment:6 follow-up: DD327 years ago

Any chance of this going into 2.3, I realise its Feature frozen, But this is really only the other half of the "Deactivate All" function IMO.

comment:7 in reply to: ↑ 6 westi7 years ago

  • Keywords needs-patch added; has-patch removed
  • Owner changed from anonymous to westi
  • Status changed from new to assigned

Replying to DD32:

Any chance of this going into 2.3, I realise its Feature frozen, But this is really only the other half of the "Deactivate All" function IMO.

I think we could slip this into 2.3 - I see the lack of reactivate as a bug ;-)

However the current patch doesn't apply cleanly.

So we need a new tested patch ;-)

Marking as needs-patch

DD327 years ago

Reactivate All Plugins against 2.3beta

DD327 years ago

Reactivate All Plugins(And also catch non-fatal errors)

comment:8 DD327 years ago

  • Keywords has-patch added; needs-patch removed

I suggest to apply "reactivate-plugins+output2.diff".
It catches non-fatal errors during the re-activation and reports on them.

After submitting them here i've noticed there may be some unneeded code in there from the last patch, But the code works fine still.

comment:9 DD327 years ago

Also note to anyone testing:
Activating plugins in Subdirectories is brocken as of posting this, Its not the patch(Had me worried there for a bit) See #4884

comment:10 ryan7 years ago

  • Milestone changed from 2.3 to 2.4

comment:11 darkdragon6 years ago

  • Keywords plugin-management added

comment:12 hansengel6 years ago

I think it would be better to word it as Activate All. I'll test this and reply with the results.

comment:13 ryan6 years ago

(In [6580]) Plugin reactivation. Props dougal. see #4176

comment:14 ryan6 years ago

That adds a reactivate_all_plugins() function. Not all of the error collection that was in the original patches is still present. The errors aren't that interesting since only non-fatal ones will actually be collected, and the only non-fatal one likely to be encountered is if the plugin goes missing after being deactivated.

comment:15 dougal6 years ago

Yay me! Can't wait to grab the latest svn and try it out "for real" :)

Since there was always some disagreement about what to actually call it, I had an idea: How about instead of "Deactivate/Reactivate all plugins", if we used something akin to "Safe Mode", a la Windows? That's really what this is about, anyways.

Thoughts?

comment:16 ryan6 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed
Note: See TracTickets for help on using tickets.