summaryrefslogtreecommitdiffstats
path: root/modules-available
diff options
context:
space:
mode:
authorChristian Hofmaier2018-03-27 15:01:24 +0200
committerChristian Hofmaier2018-03-27 15:01:24 +0200
commit43b9df40a432856d53f859ca31ace3c65229476c (patch)
tree7dc9e684b8bc35dfa8d416543698ffe31eb3ee09 /modules-available
parent[usb-lock-off] Added language tags for the edit rule page. (diff)
downloadslx-admin-43b9df40a432856d53f859ca31ace3c65229476c.tar.gz
slx-admin-43b9df40a432856d53f859ca31ace3c65229476c.tar.xz
slx-admin-43b9df40a432856d53f859ca31ace3c65229476c.zip
[usb-lock-off] use install.php only once instead of twice to make it work... DONE
Diffstat (limited to 'modules-available')
-rw-r--r--modules-available/usblockoff/install.inc.php26
1 files changed, 8 insertions, 18 deletions
diff --git a/modules-available/usblockoff/install.inc.php b/modules-available/usblockoff/install.inc.php
index 47a07573..31f31003 100644
--- a/modules-available/usblockoff/install.inc.php
+++ b/modules-available/usblockoff/install.inc.php
@@ -45,29 +45,19 @@ $res[] = tableCreate('usb_configs', '
//$ret = Database::exec("DROP TABLE `usblockoff_hw_prop`");
//$ret = Database::exec("DROP TABLE `usb_configs`");
-if ($t1 === UPDATE_DONE || $t2 === UPDATE_DONE) {
- $ret = Database::exec('ALTER TABLE `usblockoff_hw`
- ADD CONSTRAINT `usblockoff_hw_ibfk_1` FOREIGN KEY (`hwid`) REFERENCES `statistic_hw` (`hwid`) ON DELETE CASCADE');
- if ($ret === false) {
- finalResponse(UPDATE_FAILED, 'Adding constraints to usblockoff_hw failed: ' . Database::lastError());
- }
- $ret = Database::exec('ALTER TABLE `usblockoff_hw_prop`
- ADD CONSTRAINT `usblockoff_hw__prop_ibfk_1` FOREIGN KEY (`hwid`, `serial`) REFERENCES `usblockoff_hw` (`hwid`, `serial`) ON DELETE CASCADE');
+if ($t4 === UPDATE_DONE) {
+ $ret = Database::exec("ALTER TABLE `usb_configs` ADD `configdesc` VARCHAR(200)");
if ($ret === false) {
- finalResponse(UPDATE_FAILED, 'Adding constraints to usblockoff_hw_prop failed: ' . Database::lastError());
+ finalResponse(UPDATE_FAILED, 'Adding column configdesc to usb_configs failed.');
}
- $res[] = UPDATE_DONE;
}
-if ($t4 === UPDATE_NOOP) {
- Database::exec("ALTER TABLE `usb_configs`
- ADD `configdesc` VARCHAR(200)");
-}
+$res[] = tableAddConstraint("usblockoff_hw", "hwid", "statistic_hw", "hwid", "ON DELETE CASCADE");
+// TODO: Works, as the one above already forces retry. How to write it in tableAddConstraint ?
+$ret = Database::exec('ALTER TABLE `usblockoff_hw_prop`
+ ADD CONSTRAINT `usblockoff_hw__prop_ibfk_1` FOREIGN KEY (`hwid`, `serial`) REFERENCES `usblockoff_hw` (`hwid`, `serial`) ON DELETE CASCADE');
-if (in_array(UPDATE_DONE, $res)) {
- finalResponse(UPDATE_DONE, 'Table created successfully');
-}
+responseFromArray($res);
-finalResponse(UPDATE_NOOP, 'Everything already up to date');