summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--modules-available/sysconfig/hooks/cron.inc.php7
-rw-r--r--modules-available/sysconfig/install.inc.php11
2 files changed, 6 insertions, 12 deletions
diff --git a/modules-available/sysconfig/hooks/cron.inc.php b/modules-available/sysconfig/hooks/cron.inc.php
index d1f91437..d2457685 100644
--- a/modules-available/sysconfig/hooks/cron.inc.php
+++ b/modules-available/sysconfig/hooks/cron.inc.php
@@ -1,3 +1,8 @@
<?php
-Trigger::ldadp(); \ No newline at end of file
+Trigger::ldadp();
+
+// Cleanup orphaned config<->location where the location has been deleted
+Database::exec("DELETE c FROM configtgz_location c
+ LEFT JOIN location l USING (locationid)
+ WHERE l.locationid IS NULL");
diff --git a/modules-available/sysconfig/install.inc.php b/modules-available/sysconfig/install.inc.php
index 251b3de9..3e99b777 100644
--- a/modules-available/sysconfig/install.inc.php
+++ b/modules-available/sysconfig/install.inc.php
@@ -47,17 +47,6 @@ if (in_array(UPDATE_DONE, $res)) {
$res[] = tableAddConstraint('configtgz_location', 'configid', 'configtgz', 'configid',
'ON DELETE CASCADE ON UPDATE CASCADE');
}
-// To location
-if (tableExists('location')) {
- // Cleanup from when we didn't have the constraint
- Database::exec("DELETE c FROM configtgz_location c
- LEFT JOIN location l USING (locationid)
- WHERE l.locationid IS NULL");
- $res[] = tableAddConstraint('configtgz_location', 'locationid', 'location', 'locationid',
- 'ON UPDATE CASCADE ON DELETE CASCADE');
-} elseif (Module::get('locations') !== false) {
- $res[] = UPDATE_RETRY;
-}
// Update path