aboutsummaryrefslogtreecommitdiff
path: root/upgrade.php
diff options
context:
space:
mode:
authorSem <sembrestels@riseup.net>2013-02-13 01:25:07 +0100
committerSem <sembrestels@riseup.net>2013-02-13 01:25:07 +0100
commit5aff5b3913fbb6226d8fb3162453c58888fba38d (patch)
tree2bf8fe649d8c9d09a3be03154c4c669bccfbc54c /upgrade.php
parent3ed289b03fa3d851fd7fffbc0441ebc9b5e98310 (diff)
parent8d3a7ab1755829c6e070a038d6b33e326de8fc8f (diff)
downloadelgg-5aff5b3913fbb6226d8fb3162453c58888fba38d.tar.gz
elgg-5aff5b3913fbb6226d8fb3162453c58888fba38d.tar.bz2
Merge tag '1.8.13' of git://github.com/Elgg/Elgg
Elgg 1.8.13 release
Diffstat (limited to 'upgrade.php')
-rw-r--r--upgrade.php13
1 files changed, 12 insertions, 1 deletions
diff --git a/upgrade.php b/upgrade.php
index 60764ba93..c5f158c61 100644
--- a/upgrade.php
+++ b/upgrade.php
@@ -9,6 +9,8 @@
* new version of the script. Deleting the script is not a requirement and
* leaving it behind does not affect the security of the site.
*
+ * Upgrades use a table {db_prefix}upgrade_lock as a mutex to prevent concurrent upgrades.
+ *
* @package Elgg.Core
* @subpackage Upgrade
*/
@@ -20,6 +22,12 @@ define('UPGRADING', 'upgrading');
require_once(dirname(__FILE__) . "/engine/start.php");
if (get_input('upgrade') == 'upgrade') {
+ // prevent someone from running the upgrade script in parallel (see #4643)
+ if (!_elgg_upgrade_lock()) {
+ register_error(elgg_echo('upgrade:locked'));
+ forward();
+ }
+
// disable the system log for upgrades to avoid exceptions when the schema changes.
elgg_unregister_event_handler('log', 'systemlog', 'system_log_default_logger');
elgg_unregister_event_handler('all', 'all', 'system_log_listener');
@@ -33,6 +41,9 @@ if (get_input('upgrade') == 'upgrade') {
elgg_trigger_event('upgrade', 'system', null);
elgg_invalidate_simplecache();
elgg_reset_system_cache();
+
+ _elgg_upgrade_unlock();
+
} else {
// if upgrading from < 1.8.0, check for the core view 'welcome' and bail if it's found.
// see http://trac.elgg.org/ticket/3064
@@ -53,4 +64,4 @@ if (get_input('upgrade') == 'upgrade') {
exit;
}
-forward(); \ No newline at end of file
+forward();