diff options
author | Sem <sembrestels@riseup.net> | 2012-09-05 01:16:45 +0200 |
---|---|---|
committer | Sem <sembrestels@riseup.net> | 2012-09-05 01:16:45 +0200 |
commit | ba0761b5a0fb7d5dd3c20179de0f49b1aa8e0a89 (patch) | |
tree | 2e1923a1076bb4f08eb2aff6ceecf4c86c941ba5 /upgrade.php | |
parent | dce60b43126dcaa38e6845ae45e09db87aa7e229 (diff) | |
download | elgg-ba0761b5a0fb7d5dd3c20179de0f49b1aa8e0a89.tar.gz elgg-ba0761b5a0fb7d5dd3c20179de0f49b1aa8e0a89.tar.bz2 |
Moved upgrade lock/unlock functions to upgrade.php lib.
Diffstat (limited to 'upgrade.php')
-rw-r--r-- | upgrade.php | 35 |
1 files changed, 2 insertions, 33 deletions
diff --git a/upgrade.php b/upgrade.php index e1f3c6b9e..a58fcdc96 100644 --- a/upgrade.php +++ b/upgrade.php @@ -13,37 +13,6 @@ * @subpackage Upgrade */ -// @todo Move to ElggUpgradeManager::lock() when #4628 fixed. -function upgrade_lock() { - global $CONFIG, $DB_QUERY_CACHE; - - $is_locked = count(get_data("show tables like '{$CONFIG->dbprefix}locked'")); - - // Invalidate query cache - if ($DB_QUERY_CACHE) { - $DB_QUERY_CACHE->clear(); - elgg_log("Query cache invalidated", 'NOTICE'); - } - - if (!$is_locked) { - // lock it - insert_data("create table {$CONFIG->dbprefix}locked (id INT)"); - error_log('Upgrade continue running'); - return true; - } - - error_log('Upgrade is locked'); - return false; -} - -// @todo Move to ElggUpgradeManager::unlock() when #4682 fixed. -function upgrade_unlock() { - global $CONFIG; - delete_data("drop table {$CONFIG->dbprefix}locked"); - error_log('Upgrade unlocks itself'); -} - - // we want to know if an error occurs ini_set('display_errors', 1); @@ -53,7 +22,7 @@ require_once(dirname(__FILE__) . "/engine/start.php"); if (get_input('upgrade') == 'upgrade') { // prevent someone from running the upgrade script in parallel (see #4643) - if (!upgrade_lock()) { + if (!_elgg_upgrade_lock()) { forward(); } @@ -72,7 +41,7 @@ if (get_input('upgrade') == 'upgrade') { elgg_reset_system_cache(); // critical region has past - upgrade_unlock(); + _elgg_upgrade_unlock(); } else { // if upgrading from < 1.8.0, check for the core view 'welcome' and bail if it's found. |