[wp-trac] [WordPress Trac] #13786: Problems with the current register_uninstall_hook implementation
WordPress Trac
wp-trac at lists.automattic.com
Tue Jun 8 17:04:23 UTC 2010
#13786: Problems with the current register_uninstall_hook implementation
--------------------------+-------------------------------------------------
Reporter: x3r0ss | Owner: westi
Type: defect (bug) | Status: new
Priority: normal | Milestone: Unassigned
Component: Plugins | Version: 3.0
Severity: normal | Keywords: hooks, plugins
--------------------------+-------------------------------------------------
Changes (by nacin):
* milestone: 3.1 => Unassigned
Comment:
Very simply, the plugin might not be active, which is why we are storing
callbacks in the database in the first place. That means we need to re-
load the entire plugin on a require_once just to check if it has added a
callback to an uninstall_$plugin hook.
The patch (I've deleted the duplicate one) would force any plugin -- one
that may or may not be active, and more importantly may or may not be safe
to run in the middle of a script during the uninstall hook
detection/firing process -- to be included.
You are also assuming that the uninstall hook is being registered in
global scope, which is not only an unfair assumption but improper use of
the hook. It should instead be run on a hook, preferably activation. Most
plugins that use uninstall hooks do indeed do this, that way you're only
writing to the database once. There's no reason to run it again after
activation. This thus addresses your "re-save" concern.
The other ticket is #12754. That ticket describes that a class method
using a static calling method will work.
Including a script and running one small component out of it can cause
problems, more so if we decide to change its implementation. There are
ideas in #12754 best left to a plugin that will work, and beyond that,
uninstall.php is the preferred method anyway.
Suggesting wontfix.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/13786#comment:5>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list