Index: wp-admin/update.php
===================================================================
--- wp-admin/update.php	(revision 10008)
+++ wp-admin/update.php	(working copy)
@@ -102,22 +102,30 @@
 		return;
 	}
 
-	//TODO: Is theme currently active?
-	$was_current = false; //is_plugin_active($plugin); //Check now, It'll be deactivated by the next line if it is
+	//Is the current theme active? If so, Put the blog into maintainence mode before update.
+	$was_current = strtolower(get_option('stylesheet')) == strtolower($theme) || strtolower(get_option('template')) == strtolower($theme);
 
+	if ( $was_current ) {
+		show_message( __('Blog has been put into maintainence mode for duration of theme update') );
+		// Create maintenance file to signal that we are upgrading
+		$maintenance_string = '<?php $upgrading = ' . time() . '; ?>';
+		$maintenance_file = $wp_filesystem->abspath() . '.maintenance';
+		$wp_filesystem->delete($maintenance_file);
+		$wp_filesystem->put_contents($maintenance_file, $maintenance_string, 0644);
+	}
+
 	$result = wp_update_theme($theme, 'show_message');
 
+	if ( $was_current ) {
+		// Remove maintenance file, we're done.
+		$wp_filesystem->delete($maintenance_file);
+	}
+
 	if ( is_wp_error($result) ) {
 		show_message($result);
 		show_message( __('Installation Failed') );
 	} else {
-		//Result is the new plugin file relative to WP_PLUGIN_DIR
 		show_message( __('Theme upgraded successfully') );
-		if( $result && $was_current ){
-			show_message(__('Setting theme as Current'));
-			//TODO: Actually set it as active again.
-			//echo '<iframe style="border:0" width="100%" height="170px" src="' . wp_nonce_url('update.php?action=activate-plugin&plugin=' . $result, 'activate-plugin_' . $result) .'"></iframe>';
-		}
 	}
 	echo '</div>';
 }

