[wp-trac] Re: [WordPress Trac] #5625: Include a separate uninstall for plugins

WordPress Trac wp-trac at lists.automattic.com
Sun Jan 13 17:53:32 GMT 2008


#5625: Include a separate uninstall for plugins
-------------------------------+--------------------------------------------
 Reporter:  arickmann          |        Owner:  anonymous
     Type:  enhancement        |       Status:  new      
 Priority:  normal             |    Milestone:  2.6      
Component:  Administration     |      Version:           
 Severity:  normal             |   Resolution:           
 Keywords:  plugin-management  |  
-------------------------------+--------------------------------------------
Comment (by arickmann):

 I think I have boiled it down to the essential processes now so have
 included a patch for three files within the core.

 The processes work like this:

 The plugin author can include the following function as part of their
 activation process:

 register_plugin_assets( __FILE__ , callback or NULL , array of database
 table names, array of WordPress option names );

 When a plugin is deactivated, the plugins page will check to see if any
 assets have been registered and if so will provide the option to uninstall
 the plugin.

 If the user chooses to uninstall it, the plugin will be included, the
 callback function will be registered as an action (uninstall_pluginname)
 and the action will be called, allowing other plugins to hook into this
 uninstall process.

 After the callback has run the delete_plugin_assets function will be
 called and will delete the database tables and options mentioned.

 It will then redirect to the plugins page and display the success or
 failure message.

 The uninstall option will not be available while the plugin is activated.

 I reconsidered the consequences of just installing the plugin, vs
 requiring the plugin author to ringfence their uninstall callback and I
 think they are acceptable. No actions or filters will be called and the
 user will be redirected back to the plugins page after the uninstall
 process.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/5625#comment:9>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list