diff options
author | Simon Rettberg | 2016-06-08 18:33:30 +0200 |
---|---|---|
committer | Simon Rettberg | 2016-06-08 18:33:30 +0200 |
commit | ffffab643e031524b6fdfe0c39adae1f6c8e9c4d (patch) | |
tree | 84e55c5a7ea0e02481b9f44730814ae788f05e12 /modules-available/eventlog/install.inc.php | |
parent | [dashboard] Remove needsSchemaUpdate call (diff) | |
download | slx-admin-ffffab643e031524b6fdfe0c39adae1f6c8e9c4d.tar.gz slx-admin-ffffab643e031524b6fdfe0c39adae1f6c8e9c4d.tar.xz slx-admin-ffffab643e031524b6fdfe0c39adae1f6c8e9c4d.zip |
[install] Implement install scripts for most modules
Diffstat (limited to 'modules-available/eventlog/install.inc.php')
-rw-r--r-- | modules-available/eventlog/install.inc.php | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/modules-available/eventlog/install.inc.php b/modules-available/eventlog/install.inc.php new file mode 100644 index 00000000..e5fd32f6 --- /dev/null +++ b/modules-available/eventlog/install.inc.php @@ -0,0 +1,31 @@ +<?php + +$res = array(); + +$res[] = tableCreate('eventlog', " +`logid` int(10) unsigned NOT NULL AUTO_INCREMENT, +`dateline` int(10) unsigned NOT NULL, +`logtypeid` varchar(30) NOT NULL, +`description` varchar(255) NOT NULL, +`extra` TEXT NOT NULL, +PRIMARY KEY (`logid`), +KEY `dateline` (`dateline`), +KEY `logtypeid` (`logtypeid`,`dateline`) +"); + +// Update path + +if (!tableHasColumn('eventlog', 'extra')) { + if (Database::exec("ALTER TABLE `eventlog` ADD `extra` TEXT NOT NULL") === false) { + finalResponse(UPDATE_FAILED, 'Could not add extra to eventlog: ' . Database::lastError()); + } + $res[] = UPDATE_DONE; +} + +// Create response for browser + +if (in_array(UPDATE_DONE, $res)) { + finalResponse(UPDATE_DONE, 'Tables created successfully'); +} + +finalResponse(UPDATE_NOOP, 'Everything already up to date'); |