aboutsummaryrefslogtreecommitdiff
path: root/actions/admin/site/unlock_upgrade.php
diff options
context:
space:
mode:
Diffstat (limited to 'actions/admin/site/unlock_upgrade.php')
-rw-r--r--actions/admin/site/unlock_upgrade.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/actions/admin/site/unlock_upgrade.php b/actions/admin/site/unlock_upgrade.php
new file mode 100644
index 000000000..b73cf7033
--- /dev/null
+++ b/actions/admin/site/unlock_upgrade.php
@@ -0,0 +1,23 @@
+<?php
+/**
+ * Unlocks the upgrade script
+ */
+
+// @todo Move this in ElggUpgradeManager::isLocked() when #4682 fixed
+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) {
+ // @todo Move to ElggUpgradeManager::unlock() when #4682 fixed.
+ delete_data("drop table {$CONFIG->dbprefix}locked");
+ error_log('Upgrade unlocks itself');
+}
+system_message(elgg_echo('upgrade:unlock:success'));
+forward(REFERER); \ No newline at end of file