cvs diff: Diffing modules/update
Index: modules/update/update.authorize.inc
===================================================================
RCS file: /Users/wright/drupal/local_repo/drupal/modules/update/update.authorize.inc,v
retrieving revision 1.8
diff -u -p -r1.8 update.authorize.inc
--- modules/update/update.authorize.inc	1 Dec 2010 07:02:14 -0000	1.8
+++ modules/update/update.authorize.inc	3 Jan 2011 00:53:58 -0000
@@ -182,7 +182,8 @@ function update_authorize_update_batch_f
     // update data and recompute our status, so prevent show bogus results.
     _update_authorize_clear_update_status();
 
-    if ($offline) {
+    // Take the site out of maintenance mode if it was previously that way.
+    if ($offline && isset($_SESSION['maintenance_mode']) && $_SESSION['maintenance_mode'] == FALSE) {
       variable_set('maintenance_mode', FALSE);
       $page_message = array(
         'message' => t('Update was completed successfully. Your site has been taken out of maintenance mode.'),
@@ -213,6 +214,9 @@ function update_authorize_update_batch_f
   $results['tasks'][] = t('Your modules have been downloaded and updated.');
   $results['tasks'][] = t('<a href="@update">Run database updates</a>', array('@update' => base_path() . 'update.php'));
 
+  // Unset the variable since it is no longer needed.
+  unset($_SESSION['maintenance_mode']);
+
   // Set all these values into the SESSION so authorize.php can display them.
   $_SESSION['authorize_results']['success'] = $success;
   $_SESSION['authorize_results']['page_message'] = $page_message;
@@ -235,18 +239,21 @@ function update_authorize_install_batch_
     }
   }
   $offline = variable_get('maintenance_mode', FALSE);
-  if ($success && $offline) {
-    variable_set('maintenance_mode', FALSE);
-    $page_message = array(
-      'message' => t('Installation was completed successfully. Your site has been taken out of maintenance mode.'),
-      'type' => 'status',
-    );
-  }
-  elseif ($success && !$offline) {
-    $page_message = array(
-      'message' => t('Installation was completed successfully.'),
-      'type' => 'status',
-    );
+  if ($success) {
+    // Take the site out of maintenance mode if it was previously that way.
+    if ($offline && isset($_SESSION['maintenance_mode']) && $_SESSION['maintenance_mode'] == FALSE) {
+      variable_set('maintenance_mode', FALSE);
+      $page_message = array(
+        'message' => t('Installation was completed successfully. Your site has been taken out of maintenance mode.'),
+        'type' => 'status',
+      );
+    }
+    else {
+      $page_message = array(
+        'message' => t('Installation was completed successfully.'),
+        'type' => 'status',
+      );
+    }
   }
   elseif (!$success && !$offline) {
     $page_message = array(
@@ -261,6 +268,9 @@ function update_authorize_install_batch_
     );
   }
 
+  // Unset the variable since it is no longer needed.
+  unset($_SESSION['maintenance_mode']);
+
   // Set all these values into the SESSION so authorize.php can display them.
   $_SESSION['authorize_results']['success'] = $success;
   $_SESSION['authorize_results']['page_message'] = $page_message;
Index: modules/update/update.manager.inc
===================================================================
RCS file: /Users/wright/drupal/local_repo/drupal/modules/update/update.manager.inc,v
retrieving revision 1.32
diff -u -p -r1.32 update.manager.inc
--- modules/update/update.manager.inc	2 Jan 2011 21:29:08 -0000	1.32
+++ modules/update/update.manager.inc	3 Jan 2011 00:48:34 -0000
@@ -389,6 +389,8 @@ function update_manager_update_ready_for
  * @see system_authorized_get_url()
  */
 function update_manager_update_ready_form_submit($form, &$form_state) {
+  // Store maintenance_mode setting so we can restore it when done.
+  $_SESSION['maintenance_mode'] = variable_get('maintenance_mode', FALSE);
   if ($form_state['values']['maintenance_mode'] == TRUE) {
     variable_set('maintenance_mode', TRUE);
   }
cvs diff: Diffing modules/update/tests
