[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:13:10 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
--------------------------+-------------------------------------------------

Comment(by x3r0ss):

 Okay I understand that you don't want that entire file to be loaded which
 I understand, but as it is only once to remove the plugin I don't see how
 this would be a big problem.

 And if the plugin is running unsafe things in the file it should use
 uninstall.php anyways.

 I guess an alternative to this that doesn't require the core to be changed
 is to include the class in my uninstall.php.



 And finally I think an alternative suggestion would be that if you detect
 the callback to contain an instantiated class you don't save it to the DB
 and issue a warning or something like that.

 And from what I understand the hook should only be ran once (On plugin
 activation I guess).

 If that is the case there's still a problem that if you register the hook
 twice (Deactivate/reactivate ?) it will add the hook a second time in the
 database (Now I don't know if this only happens with instantiated classes
 though) which might be a problem worth looking into.

 Replying to [comment:6 nacin]:
 > In the first paragraph, "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," I was referring to the suggested patch, not
 current behavior, in case that is not obvious.
 Yes I understood that

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/13786#comment:7>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list