summaryrefslogtreecommitdiffstats
path: root/modules-available/main
diff options
context:
space:
mode:
authorSimon Rettberg2016-06-08 18:33:30 +0200
committerSimon Rettberg2016-06-08 18:33:30 +0200
commitffffab643e031524b6fdfe0c39adae1f6c8e9c4d (patch)
tree84e55c5a7ea0e02481b9f44730814ae788f05e12 /modules-available/main
parent[dashboard] Remove needsSchemaUpdate call (diff)
downloadslx-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/main')
-rw-r--r--modules-available/main/install.inc.php73
1 files changed, 73 insertions, 0 deletions
diff --git a/modules-available/main/install.inc.php b/modules-available/main/install.inc.php
new file mode 100644
index 00000000..4c9d4baa
--- /dev/null
+++ b/modules-available/main/install.inc.php
@@ -0,0 +1,73 @@
+<?php
+
+$res = array();
+
+$res[] = tableCreate('callback', "
+ `taskid` varchar(40) CHARACTER SET ascii COLLATE ascii_bin NOT NULL,
+ `dateline` int(10) unsigned NOT NULL,
+ `cbfunction` varchar(16) CHARACTER SET ascii COLLATE ascii_bin NOT NULL,
+ `args` text NOT NULL,
+ PRIMARY KEY (`taskid`,`cbfunction`),
+ KEY `dateline` (`dateline`)
+");
+
+$res[] = tableCreate('permission', "
+ `mask` int(10) unsigned NOT NULL,
+ `identifier` varchar(32) NOT NULL,
+ PRIMARY KEY (`mask`),
+ UNIQUE KEY `identifier` (`identifier`)
+");
+
+$res[] = tableCreate('property', "
+ `name` varchar(50) NOT NULL,
+ `dateline` int(10) unsigned NOT NULL DEFAULT '0',
+ `value` text NOT NULL,
+ PRIMARY KEY (`name`),
+ KEY `dateline` (`dateline`)
+");
+
+$res[] = tableCreate('user', "
+ `userid` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `login` varchar(100) NOT NULL,
+ `passwd` varchar(150) NOT NULL,
+ `fullname` varchar(100) DEFAULT NULL,
+ `phone` varchar(100) DEFAULT NULL,
+ `email` varchar(100) DEFAULT NULL,
+ `permissions` int(10) unsigned NOT NULL,
+ `lasteventid` int(10) unsigned NOT NULL DEFAULT '0',
+ PRIMARY KEY (`userid`),
+ UNIQUE KEY `login` (`login`)
+");
+
+// Update path
+
+// #######################
+// ##### 2014-05-28
+// Add dateline field to property table
+if (!tableHasColumn('property', 'dateline')) {
+ Database::exec("ALTER TABLE `property` ADD `dateline` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0' AFTER `name` , ADD INDEX ( `dateline` )");
+}
+
+// #######################
+// ##### 2014-08-18
+// Remove description column from permission table
+tableDropColumn('permission', 'description');
+// Add details column to eventlog table
+if (!tableHasColumn('user', 'lasteventid')) {
+ Database::exec("ALTER TABLE `user` ADD `lasteventid` INT(10) UNSIGNED NOT NULL DEFAULT '0'");
+}
+
+// #######################
+// ##### 2015-01-16
+// Extend config module db table, add argument feature to callbacks
+if (!tableHasColumn('callback', 'args')) {
+ Database::exec("ALTER TABLE `callback` ADD `args` TEXT NOT NULL DEFAULT ''");
+}
+
+// Create response for browser
+
+if (in_array(UPDATE_DONE, $res)) {
+ finalResponse(UPDATE_DONE, 'Tables created successfully');
+}
+
+finalResponse(UPDATE_NOOP, 'Everything already up to date');