[wp-hackers] Will Activation Hook Be Executed During Plugin Upgradation?

Milan Dinić liste at srpski.biz
Mon Sep 20 18:33:38 UTC 2010


>
> The simplest method that would work everywhere would be simply to
> store the version number of the plugin somewhere (like in your options
> entry in the database), then compare the stored version with your
> known current and hardcoded version.
>

Yes, but isn't easiest to do this on activation?

2010/9/20 Otto <otto at ottodestruct.com>

> On Mon, Sep 20, 2010 at 1:10 PM, Rich Pedley <elfin at elfden.co.uk> wrote:
> > A lot of plugin authors, myself included (but I can easily change things
> if
> > necessary) use this 'feature' (well that's what MS calls it...) to
> upgrade
> > things. So if this really is the case that we shouldn't be using it, what
> > would be the correct way to upgrade?
>
> Depends on what exactly you're "upgrading".
>
> The simplest method that would work everywhere would be simply to
> store the version number of the plugin somewhere (like in your options
> entry in the database), then compare the stored version with your
> known current and hardcoded version. When you detect the difference,
> then that means an upgrade has taken place, and you can act
> accordingly.
>
> Another way is simply to make the plugin detect outdated options or
> older schemas and upgrade them on-the-fly. This is probably the most
> reliable, but it does depend on what exactly you're upgrading. You
> can't necessarily make this "generic".
>
> -Otto
>  _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list