[wp-hackers] register_uninstall_hook VS uninstall.php

Andrew Nacin wp at andrewnacin.com
Fri May 7 17:26:36 UTC 2010


On Fri, May 7, 2010 at 1:20 PM, Azizur Rahman <
prodevstudio+wordpress at gmail.com <prodevstudio%2Bwordpress at gmail.com>>
wrote:
>
> Like the uninstall.php to uninstall, can we use install.php or
> activation.php for activation process?

No. Those are much more flexible, as they are run either after activation or
just
before deactivation. They can be class methods, what have you. Uninstall is
simply
an exception, and so in 2.7 uninstall.php was introduced so uninstall
scripts can be
isolated and more robust.

On Fri, May 7, 2010 at 1:19 PM, Davit Barbakadze <jayarjo at gmail.com> wrote:
>
> Hmmm... dont' you think that there is something wrong with this (current?)
> solution?

Not one bit. Use uninstall.php if you want flexibility, or
register_uninstall_hook if you
want simplicity. Bottom line is, we're executing code when a plugin is not
active, so we
need to be nimble about it.

On Fri, May 7, 2010 at 1:07 PM, scribu <scribu at gmail.com> wrote:
> On Fri, May 7, 2010 at 7:56 PM, Dion Hulse (dd32) <wordpress at dd32.id.au
>wrote:
> >
> > And no, You cannot use array(&$this in uninstall hooks, the uninstall
hook
> > is stored within the database, its not determined at run time.
>
> Actually, you can, but it causes an extra SQL query on each page load.



More information about the wp-hackers mailing list