aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
authorBrett Profitt <brett.profitt@gmail.com>2012-12-16 17:26:03 -0500
committerBrett Profitt <brett.profitt@gmail.com>2012-12-16 17:26:03 -0500
commit22e8d9be4582b78a500382e14046a653a14e3f43 (patch)
treef1c87208494bc243d510c8daf8c11beb6b1fcabe /engine/lib
parentba0761b5a0fb7d5dd3c20179de0f49b1aa8e0a89 (diff)
downloadelgg-22e8d9be4582b78a500382e14046a653a14e3f43.tar.gz
elgg-22e8d9be4582b78a500382e14046a653a14e3f43.tar.bz2
Refs #4643. Cleanup for the upgrade lock.
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/upgrade.php20
1 files changed, 12 insertions, 8 deletions
diff --git a/engine/lib/upgrade.php b/engine/lib/upgrade.php
index 7f55c4cba..f4f4b16f5 100644
--- a/engine/lib/upgrade.php
+++ b/engine/lib/upgrade.php
@@ -313,7 +313,9 @@ function elgg_upgrade_bootstrap_17_to_18() {
}
/**
- * Locks a mutual execution of upgrade
+ * Creates a table {prefix}upgrade_lock that is used as a mutex for upgrades.
+ *
+ * @see _elgg_upgrade_lock()
*
* @return bool
* @access private
@@ -323,24 +325,26 @@ function _elgg_upgrade_lock() {
if (!_elgg_upgrade_is_locked()) {
// lock it
- insert_data("create table {$CONFIG->dbprefix}locked (id INT)");
- error_log('Upgrade continue running');
+ insert_data("create table {$CONFIG->dbprefix}upgrade_lock (id INT)");
+ elgg_log('Locked for upgrade.', 'NOTICE');
return true;
}
- error_log('Upgrade is locked');
+ elgg_log('Cannot lock for upgrade: already locked.', 'WARNING');
return false;
}
/**
- * Unlocks upgrade for new upgrade executions
+ * Unlocks upgrade.
+ *
+ * @see _elgg_upgrade_lock()
*
* @access private
*/
function _elgg_upgrade_unlock() {
global $CONFIG;
- delete_data("drop table {$CONFIG->dbprefix}locked");
- error_log('Upgrade unlocks itself');
+ delete_data("drop table {$CONFIG->dbprefix}upgrade_lock");
+ elgg_log('Upgrade unlocked.', 'NOTICE');
}
/**
@@ -352,7 +356,7 @@ function _elgg_upgrade_unlock() {
function _elgg_upgrade_is_locked() {
global $CONFIG, $DB_QUERY_CACHE;
- $is_locked = count(get_data("show tables like '{$CONFIG->dbprefix}locked'"));
+ $is_locked = count(get_data("show tables like '{$CONFIG->dbprefix}upgrade_lock'"));
// Invalidate query cache
if ($DB_QUERY_CACHE) {