summaryrefslogtreecommitdiffstats
path: root/modules-available/sysconfig/hooks
diff options
context:
space:
mode:
authorSimon Rettberg2017-11-28 13:39:34 +0100
committerSimon Rettberg2017-11-28 13:39:34 +0100
commit9335cf1158870647f23cd7e6922eef508178a3d5 (patch)
tree97dab6ec08a27adbd36953c88b12e85e48534351 /modules-available/sysconfig/hooks
parent[baseconfig] Add current unix timestamp to config (diff)
downloadslx-admin-9335cf1158870647f23cd7e6922eef508178a3d5.tar.gz
slx-admin-9335cf1158870647f23cd7e6922eef508178a3d5.tar.xz
slx-admin-9335cf1158870647f23cd7e6922eef508178a3d5.zip
[sysconfig] Revert contraint to location table: Breaks default config
Default config is locationid = 0, which obviously doesn't work with the constraint. Using NULL proves difficult here (dups etc.), so don't for now, and add code to the cron hook that will clean up deleted locations.
Diffstat (limited to 'modules-available/sysconfig/hooks')
-rw-r--r--modules-available/sysconfig/hooks/cron.inc.php7
1 files changed, 6 insertions, 1 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");