Index: upgrade.php
===================================================================
--- upgrade.php	(revision 6385)
+++ upgrade.php	(working copy)
@@ -144,11 +144,13 @@
 	if ( $wp_db_version == $wp_current_db_version )
 		return;
 
+	$plugin_results = wp_call_pre_upgrade_hook();
 	wp_check_mysql_version();
 	wp_cache_flush();
 	make_db_current_silent();
 	upgrade_all();
 	wp_cache_flush();
+	wp_call_post_upgrade_hook($plugin_results);
 }
 endif;
 
@@ -1243,6 +1245,53 @@
 	}
 }
 
+/**
+ * Called before upgrade for plugins to clean up.
+ *
+ * Plugins must not die during their call. Plugins will be able to enable themselves
+ * after the upgrade has been made and the result of the pre-upgrade hook will be passed
+ * to the post upgrade plugin hook.
+ *
+ * @uses apply_filters() Calls pre_upgrade_PLUGIN PLUGIN is the path from PLUGINDIR.
+ *
+ * @returns array The results of the 
+ */
+function wp_call_pre_upgrade_hook()
+{
+	$plugin_pre_upgrade = array();
+	$current_plugins = __get_option('active_plugins');
+	if ( is_array($current_plugins) ) {
+		foreach ($current_plugins as $plugin) {
+			if ('' != $plugin && file_exists(ABSPATH . PLUGINDIR . '/' . $plugin)) {
+				include_once(ABSPATH . PLUGINDIR . '/' . $plugin);
+
+				$plugin_pre_upgrade[ $plugin ] = apply_filters('pre_upgrade_'.$plugin, null);
+			}
+		}
+	}
+
+	return $plugin_pre_upgrade;
+}
+
+/**
+ * Called for plugins after the WordPress upgrade process has been made.
+ *
+ * The results of the pre-upgrade process is passed to the plugin from the pre
+ * upgrade process. The plugin can use this as they will. The plugin may also 
+ * output their status for the user to see on the upgrade page to provide feedback.
+ *
+ * @uses do_action() Calls post_upgrade_PLUGIN where PLUGIN is the path of the plugin from PLUGINDIR
+ * @param array $pre_upgrade Passed the array from the pre upgrade
+ */
+function wp_call_post_upgrade_hook($pre_upgrade)
+{
+	if ( is_array($pre_upgrade) ) {
+		foreach ($pre_upgrade as $plugin => $result) {
+			do_action( 'post_upgrade_'.$plugin, $result );
+		}
+	}
+}
+
 function wp_check_mysql_version() {
 	global $wpdb;
 	$result = $wpdb->check_database_version();
