[wp-trac] [WordPress Trac] #14912: Introduce register_upgrade_hook()
WordPress Trac
wp-trac at lists.automattic.com
Wed Sep 22 00:45:19 UTC 2010
#14912: Introduce register_upgrade_hook()
-----------------------------+----------------------------------------------
Reporter: scribu | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Future Release
Component: Upgrade/Install | Version:
Severity: normal | Keywords: needs-patch
-----------------------------+----------------------------------------------
Comment(by ericmann):
Replying to [comment:17 scribu]:
> Upgrades shouldn't be tied to activation at all.
>
> The way I see it, the active version should be added and updated from
register_update_hook().
I agree ... and I've changed the newest patch to do just that.
`register_update_hook` will do all the work, checking the plugin's current
version against its stored value, running the callback function if
necessary, and updating the stored plugin version afterwards. I've also
changed it so we're passing both the current version ''and'' the stored
version to the callback function. I can think of a few times where that
would have helped a few of my clients when updating plugins across
multiple versions.
I also took a stab at extending this for multisite. If we're working with
a multisite installation, I use `get_site_option` and `update_site_option`
instead of their standard single-installation counterparts. This makes
sense to me, so correct me if the implementation seems to be in error.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/14912#comment:18>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list