summaryrefslogtreecommitdiffstats
path: root/modules-available/sysconfig
diff options
context:
space:
mode:
authorSimon Rettberg2017-12-01 13:42:04 +0100
committerSimon Rettberg2017-12-01 13:42:04 +0100
commit5393703f6e1485ddff94a50f63bcdd216ab629f4 (patch)
treece2db7130302bd4fb78b170e1fbd75496a1b4510 /modules-available/sysconfig
parentMerge remote-tracking branch 'origin/permission-manager' into permission-manager (diff)
parent[roomplanner] Sort already placed machines to the bottom (diff)
downloadslx-admin-5393703f6e1485ddff94a50f63bcdd216ab629f4.tar.gz
slx-admin-5393703f6e1485ddff94a50f63bcdd216ab629f4.tar.xz
slx-admin-5393703f6e1485ddff94a50f63bcdd216ab629f4.zip
Merge branch 'master' into permission-manager
Diffstat (limited to 'modules-available/sysconfig')
-rw-r--r--modules-available/sysconfig/hooks/cron.inc.php7
-rw-r--r--modules-available/sysconfig/install.inc.php26
-rw-r--r--modules-available/sysconfig/lang/de/module.json1
-rw-r--r--modules-available/sysconfig/lang/en/module.json3
4 files changed, 18 insertions, 19 deletions
diff --git a/modules-available/sysconfig/hooks/cron.inc.php b/modules-available/sysconfig/hooks/cron.inc.php
index d1f91437..b518ca06 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 AND c.locationid <> 0");
diff --git a/modules-available/sysconfig/install.inc.php b/modules-available/sysconfig/install.inc.php
index 91f282dd..3e99b777 100644
--- a/modules-available/sysconfig/install.inc.php
+++ b/modules-available/sysconfig/install.inc.php
@@ -39,21 +39,18 @@ $res[] = tableCreate('configtgz_location', "
// Constraints
if (in_array(UPDATE_DONE, $res)) {
- $ret = Database::exec("ALTER TABLE `configtgz_x_module`
- ADD CONSTRAINT `configtgz_x_module_ibfk_1` FOREIGN KEY (`configid`) REFERENCES `configtgz` (`configid`)
- ON DELETE CASCADE");
- $ret = Database::exec("ALTER TABLE `configtgz_x_module`
- ADD CONSTRAINT `configtgz_x_module_ibfk_2` FOREIGN KEY (`moduleid`) REFERENCES `configtgz_module` (`moduleid`)") || $ret;
- $ret = Database::exec("ALTER TABLE `configtgz_location`
- ADD CONSTRAINT `configtgz_location_fk_configid` FOREIGN KEY ( `configid` ) REFERENCES `openslx`.`configtgz` (`configid`)
- ON DELETE CASCADE ON UPDATE CASCADE") || $ret;
- if ($ret) {
- $res[] = UPDATE_DONE;
- }
+ // To self
+ $res[] = tableAddConstraint('configtgz_x_module', 'configid', 'configtgz', 'configid',
+ '');
+ $res[] = tableAddConstraint('configtgz_x_module', 'moduleid', 'configtgz_module', 'moduleid',
+ '');
+ $res[] = tableAddConstraint('configtgz_location', 'configid', 'configtgz', 'configid',
+ 'ON DELETE CASCADE ON UPDATE CASCADE');
}
// Update path
+// #######################
// ##### 2014-12-12
// Rename config modules
Database::exec("UPDATE configtgz_module SET moduletype = 'Branding' WHERE moduletype = 'BRANDING'");
@@ -98,9 +95,4 @@ if ($list === false) {
}
// Create response for browser
-
-if (in_array(UPDATE_DONE, $res)) {
- finalResponse(UPDATE_DONE, 'Tables created successfully');
-}
-
-finalResponse(UPDATE_NOOP, 'Everything already up to date');
+responseFromArray($res);
diff --git a/modules-available/sysconfig/lang/de/module.json b/modules-available/sysconfig/lang/de/module.json
index 056cd158..4b401437 100644
--- a/modules-available/sysconfig/lang/de/module.json
+++ b/modules-available/sysconfig/lang/de/module.json
@@ -1,4 +1,5 @@
{
+ "config-module": "Konfigurationsmodul",
"lang_clientSshConfig": "SSH-Konfiguration",
"lang_configurationCompilation": "Konfiguration zusammenstellen",
"lang_contentOf": "Inhalt von",
diff --git a/modules-available/sysconfig/lang/en/module.json b/modules-available/sysconfig/lang/en/module.json
index 526f6562..ba2d0591 100644
--- a/modules-available/sysconfig/lang/en/module.json
+++ b/modules-available/sysconfig/lang/en/module.json
@@ -1,4 +1,5 @@
{
+ "config-module": "Config module",
"lang_clientSshConfig": "SSH configuration",
"lang_configurationCompilation": "Compile configuration",
"lang_contentOf": "Content of",
@@ -7,4 +8,4 @@
"lang_unknwonTaskManager": "Unknown Task Manager error",
"module_name": "Localization",
"page_title": "Localize and integrate"
-}
+} \ No newline at end of file