[wp-hackers] Plugin deactivation

Ryan Boren ryan at boren.nu
Mon Jul 4 06:37:21 GMT 2005


On Sun, 2005-07-03 at 23:35 -0400, Scott Merrill wrote:
> Ryan Boren wrote:
> > On Sun, 2005-07-03 at 22:02 -0400, Robert Deaton wrote:
> > 
> >>I agree that we need activation and deactivation hooks, and its a
> >>shame that it was pushed aside for 1.5.1 because its a feature I know
> >>a lot of plugin authors really would have liked to seen included. Is
> >>there any chance of getting the patch attached to 1052 included in the
> >>core?
> > 
> > 
> > Not that particular patch.  Every plugin listening for those events will
> > get them and think they are activating/deactivating.  It's a broadcast
> > to all plugins.  Won't work.  
> 
> If you pass the name of the plugin as a parameter to the (de)activation 
> hook, couldn't plugins just pay attention as necessary?

Sure, but that would make the plugins more complicated and fragile.  The
whole process can be hidden behind one function call.

> I can envision modest automated plugin dependency chains.  For example, 
> de-activating my WP-Cron plugin should also deactivate all the helper 
> plugins it enables.
> Yes, the helper plugins should rely on
>    `if (function_exists(WP-Cron stuff) { ... }`
> but they'll still be left active, cluttering the plugin list for no good 
> reason.

Plugins can negotiate their own dependencies.  WP-Cron can send an "I'm
going down" event from its deactivation hook.

> Skimming the older proposed patch, I looks like it supports all the 
> above, just as well.

Patch updated for 1.6.

Ryan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: activate_hook.diff
Type: text/x-patch
Size: 2406 bytes
Desc: not available
Url : http://comox.textdrive.com/pipermail/wp-hackers/attachments/20050704/2bc66004/activate_hook.bin


More information about the wp-hackers mailing list