diff options
author | Christian Hofmaier | 2018-03-27 15:01:24 +0200 |
---|---|---|
committer | Christian Hofmaier | 2018-03-27 15:01:24 +0200 |
commit | 43b9df40a432856d53f859ca31ace3c65229476c (patch) | |
tree | 7dc9e684b8bc35dfa8d416543698ffe31eb3ee09 /modules-available | |
parent | [usb-lock-off] Added language tags for the edit rule page. (diff) | |
download | slx-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.php | 26 |
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'); |