diff options
author | Simon Rettberg | 2016-11-30 18:20:11 +0100 |
---|---|---|
committer | Simon Rettberg | 2016-11-30 18:20:11 +0100 |
commit | ee5b58349db30fbe55693e3cefba33a376948c15 (patch) | |
tree | f891f164a0a325763dc88ff6d10b66314c16235a /modules-available | |
parent | [locations] Fix tag mismatch (diff) | |
download | slx-admin-ee5b58349db30fbe55693e3cefba33a376948c15.tar.gz slx-admin-ee5b58349db30fbe55693e3cefba33a376948c15.tar.xz slx-admin-ee5b58349db30fbe55693e3cefba33a376948c15.zip |
[exams] Add error checking to install script
Diffstat (limited to 'modules-available')
-rw-r--r-- | modules-available/exams/install.inc.php | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/modules-available/exams/install.inc.php b/modules-available/exams/install.inc.php index 45e9e41a..1af5031d 100644 --- a/modules-available/exams/install.inc.php +++ b/modules-available/exams/install.inc.php @@ -27,10 +27,18 @@ if (Database::exec("ALTER TABLE exams ADD INDEX `idx_daterange` ( `starttime` , } if (!tableHasColumn('exams', 'lectureid')) { - Database::exec("ALTER TABLE `exams` ADD `lectureid` CHAR(36) CHARACTER SET ascii COLLATE ascii_bin NULL DEFAULT NULL AFTER `examid`"); + $ret = Database::exec("ALTER TABLE `exams` ADD `lectureid` CHAR(36) CHARACTER SET ascii COLLATE ascii_bin NULL DEFAULT NULL AFTER `examid`"); + if ($ret === false) { + finalResponse(UPDATE_FAILED, 'Adding lectureid to exams failed: ' . Database::lastError()); + } + $res[] = UPDATE_DONE; } if (!tableHasColumn('exams', 'autologin')) { - Database::exec("ALTER TABLE `exams` ADD `autologin` CHAR(36) NULL DEFAULT NULL AFTER `endtime`"); + $ret = Database::exec("ALTER TABLE `exams` ADD `autologin` CHAR(36) NULL DEFAULT NULL AFTER `endtime`"); + if ($ret === false) { + finalResponse(UPDATE_FAILED, 'Adding autologin to exams failed: ' . Database::lastError()); + } + $res[] = UPDATE_DONE; } Database::exec("ALTER TABLE `exams` CHANGE `description` `description` varchar(500) DEFAULT NULL"); |