diff options
author | Dries Buytaert <dries@buytaert.net> | 2008-09-19 07:17:58 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2008-09-19 07:17:58 +0000 |
commit | c1d4a90cd118f37580538782ea9ded38f5899d34 (patch) | |
tree | 4ffc4f63cc45cf802d5fdbc753594fd7b99b8298 /update.php | |
parent | f2c05c63f98d2cc4f30dc23ad59819e53e405116 (diff) | |
download | brdo-c1d4a90cd118f37580538782ea9ded38f5899d34.tar.gz brdo-c1d4a90cd118f37580538782ea9ded38f5899d34.tar.bz2 |
- Patch #309821 by Rob Loach: automatically put sites in maintenance mode when updates are being run.
Diffstat (limited to 'update.php')
-rw-r--r-- | update.php | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/update.php b/update.php index d4cf70933..e899e4349 100644 --- a/update.php +++ b/update.php @@ -285,6 +285,13 @@ function update_script_selection_form() { function update_batch() { global $base_url; + // During the update, toggle site maintenance so that schema changes + // don't effect visiting users. + $site_offline = variable_get('site_offline', FALSE); + if ($site_offline == FALSE) { + variable_set('site_offline', TRUE); + } + $operations = array(); // Set the installed version so updates start at the correct place. foreach ($_POST['start'] as $module => $version) { @@ -308,6 +315,12 @@ function update_batch() { ); batch_set($batch); batch_process($base_url . '/update.php?op=results', $base_url . '/update.php'); + + // Now that the update is done, we can disable site maintenance if + // it was previously turned off. + if ($site_offline == FALSE) { + variable_set('site_offline', FALSE); + } } function update_finished($success, $results, $operations) { |