Index: wp-includes/plugin.php
===================================================================
--- wp-includes/plugin.php	(revision 15641)
+++ wp-includes/plugin.php	(working copy)
@@ -668,6 +668,46 @@
 }
 
 /**
+ * Set the update hook for a plugin.
+ * 
+ * Registers the update hook that will be called when the user updates the
+ * plugin to a newer version than previously installed.  
+ *
+ * This function performs calls action called update_plugin- suffixed by the name
+ * of the plugin.  Plugins can hook update scripts to this action in order to 
+ * clean up options or extra database tables across versions.
+ *
+ * @since 3.1
+ *
+ * @param string $file
+ * @param callback $callback The function to run when the hook is called.
+ * @param string $version The version number to which the plugin is updating.
+ */
+function register_update_hook($file, $callback, $version) {
+	$plugin = plugin_basename($file);
+
+	if(is_multisite()) {
+		$current_vers = get_site_option( 'active_plugin_versions', array() );
+		$network = true;
+	} else {
+		$current_vers = get_option( 'active_plugin_versions', array() );
+		network = false;
+	}
+	
+	if( version_compare( $version, $current_vers[ $plugin ], '>' ) ) {
+		call_user_func( $callback, $current_vers[ $plugin ], $network ) );
+		
+		$current_vers[ $plugin ] = $version;
+	}
+	
+	if( $network ) {
+		update_site_option( 'active_plugin_versions', $current_vers );
+	} else {
+		update_option( 'active_plugin_versions', $current_vers );
+	}
+}
+
+/**
  * Calls the 'all' hook, which will process the functions hooked into it.
  *
  * The 'all' hook passes all of the arguments or parameters that were used for
