Index: plugin.php
===================================================================
--- plugin.php	(revision 6603)
+++ plugin.php	(working copy)
@@ -593,4 +593,51 @@
 		return $function[0].$function[1];
 }
 
-?>
+/**
+* register_plugin_assets() Add the plugin's database tables and option names as assets so they can be removed later.
+*
+* Part of the uninstall process. 
+* When a plugin activates, and creates the database tables, and WordPress options it needs to run the plugin author
+* can register those database tables and WordPress options so that they will be removed when the plugin is uninstalled.
+* A callback can also be registered to handle more complex uninstall requirements.
+*
+* Note: This does not allow files to be registered as there is danger of getting paths wrong and removing
+* similarly named files in different paths.
+*
+* @link http://trac.wordpress.org/ticket/5625
+*
+* @param string $plugin_file the path to the plugin file, usually given by __FILE__
+* @param string|array $callback function name of the plugin's uninstaller, can be NULL
+* @param array $tables array of table names that should be dropped when the plugin is uninstalled
+* @param array $options array of option names that should be deleted when the plugin is uninstalled
+*
+*/
+function register_plugin_assets( $plugin_file , $callback , $tables = array() , $options = array() ) {
+	$plugin_assets = get_option( 'plugin_assets' );
+	if ( !is_array( $plugin_assets ) ) 
+		$plugin_assets = array();
+	$plugin = plugin_basename( $plugin_file );
+	$plugin_assets[$plugin] = array( 'callback' => $callback ,
+									 'tables' => $tables ,
+									 'options' => $options );
+	update_option( 'plugin_assets' , $plugin_assets );
+}
+
+/**
+* unregister_plugin_assets(); Unregisters the plugins uninstallable assets from the option
+*
+* @link http://trac.wordpress.org/ticket/5625
+*
+* @param string $plugin_file the path to the plugin file, usually given by __FILE__
+*
+*/
+function unregister_plugin_assets( $plugin_file ){
+	$plugin_assets = get_option( 'plugin_assets' );
+	$plugin = plugin_basename( $plugin_file );
+	if ( isset( $plugin_assets[$plugin] ) ) {
+		unset($plugin_assets[$plugin]);
+		update_option( 'plugin_assets' , $plugin_assets );
+	}
+}
+
+?>
\ No newline at end of file
