[wp-trac] [WordPress Trac] #12754: register_uninstall_hook() doesn't allow multiple callbacks
WordPress Trac
wp-trac at lists.automattic.com
Mon Mar 29 08:15:05 UTC 2010
#12754: register_uninstall_hook() doesn't allow multiple callbacks
--------------------------+-------------------------------------------------
Reporter: scribu | Owner: westi
Type: defect (bug) | Status: new
Priority: normal | Milestone: 3.0
Component: Plugins | Version: 3.0
Severity: normal | Keywords: has-patch
--------------------------+-------------------------------------------------
Comment(by scribu):
Replying to [comment:7 nacin]:
> So, the only way the patch would work is if it is run in global scope.
This may be a requirement for register_activation_hook(), but it is not a
requirement for register_uninstall_hook(), which works perfectly fine if
done only on activation. I'm not speaking for the original developer or
committer, of course -- that could have been the idea.
My opinion is that having the ability to register multiple uninstall hooks
is more useful than being able to use it outside the global scope.
Also, it's consistent with the other functions. At the very least, it
should be clearly stated in the docs that it doesn't behave like the
others.
> If there's no conditional case involved, then there's little reason to
keep updating the database option, so on activation is fine.
Funny you should mention that. update_option() first does a $new_value ===
$old_value to see if it really needs to update the database.
I was calling register_activation_hook() with an array($obj, 'method')
callback. Because the current object instance didn't match the
unserialized instance, it _did_ force multiple UPDATE queries on each page
load.
In contrast, storing just 'true' instead of the callback, the UPDATE query
is only done the first time the plugin is run.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/12754#comment:8>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list