summaryrefslogtreecommitdiffstats
path: root/modules-available/locations/install.inc.php
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/locations/install.inc.php
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/locations/install.inc.php')
-rw-r--r--modules-available/locations/install.inc.php39
1 files changed, 39 insertions, 0 deletions
diff --git a/modules-available/locations/install.inc.php b/modules-available/locations/install.inc.php
new file mode 100644
index 00000000..f833568d
--- /dev/null
+++ b/modules-available/locations/install.inc.php
@@ -0,0 +1,39 @@
+<?php
+
+$res = array();
+
+$res[] = tableCreate('setting_location', '
+ `locationid` INT(11) NOT NULL,
+ `setting` VARCHAR(28) NOT NULL,
+ `value` TEXT NOT NULL,
+ `displayvalue` TEXT NOT NULL,
+ PRIMARY KEY (`locationid`,`setting`),
+ KEY `setting` (`setting`)
+');
+
+$res[] = tableCreate('location', '
+ `locationid` INT(11) NOT NULL AUTO_INCREMENT,
+ `parentlocationid` INT(11) NOT NULL,
+ `locationname` VARCHAR(100) NOT NULL,
+ PRIMARY KEY (`locationid`),
+ KEY `locationname` (`locationname`),
+ KEY `parentlocationid` (`parentlocationid`)
+');
+
+$res[] = tableCreate('subnet', '
+ `subnetid` INT(11) NOT NULL AUTO_INCREMENT,
+ `startaddr` DECIMAL(39,0) UNSIGNED NOT NULL,
+ `endaddr` DECIMAL(39,0) UNSIGNED NOT NULL,
+ `locationid` INT(11) NOT NULL,
+ PRIMARY KEY (`subnetid`),
+ KEY `startaddr` (`startaddr`,`endaddr`),
+ KEY `locationid` (`locationid`)
+');
+
+// Create response for browser
+
+if (in_array(UPDATE_DONE, $res)) {
+ finalResponse(UPDATE_DONE, 'Tables created successfully');
+}
+
+finalResponse(UPDATE_NOOP, 'Everything already up to date');