summaryrefslogtreecommitdiffstats
path: root/modules-available/news/install.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2022-05-03 17:36:29 +0200
committerSimon Rettberg2022-05-03 17:36:29 +0200
commitb155c8167ddd5562f30fcfadd9eeb60d80e2619e (patch)
treecfbb0fda2f4aeadc24a0cbb010f975e3c10ee779 /modules-available/news/install.inc.php
parent[eventlog] Add de translations (diff)
downloadslx-admin-b155c8167ddd5562f30fcfadd9eeb60d80e2619e.tar.gz
slx-admin-b155c8167ddd5562f30fcfadd9eeb60d80e2619e.tar.xz
slx-admin-b155c8167ddd5562f30fcfadd9eeb60d80e2619e.zip
[locations/news] Add per-location news/help/loginscreentext
Diffstat (limited to 'modules-available/news/install.inc.php')
-rw-r--r--modules-available/news/install.inc.php25
1 files changed, 17 insertions, 8 deletions
diff --git a/modules-available/news/install.inc.php b/modules-available/news/install.inc.php
index 88a20749..89fc7069 100644
--- a/modules-available/news/install.inc.php
+++ b/modules-available/news/install.inc.php
@@ -1,6 +1,6 @@
<?php
-$res = array();
+$dbret = array();
@@ -10,7 +10,7 @@ if (tableExists('news')) {
if (!tableRename('news', 'vmchooser_pages')) {
finalResponse(UPDATE_FAILED, "Could not rename news to vmchooser_pages: " . Database::lastError());
}
- $res[] = UPDATE_DONE;
+ $dbret[] = UPDATE_DONE;
if (false === Database::exec("ALTER TABLE `vmchooser_pages` ADD COLUMN type VARCHAR(10)")) {
EventLog::warning("Could not add type column to vmchooser_pages: " . Database::lastError());
}
@@ -20,16 +20,16 @@ if (tableExists('news')) {
}
-$res[] = tableCreate('vmchooser_pages', "
+$dbret[] = tableCreate('vmchooser_pages', "
`newsid` int(10) unsigned NOT NULL AUTO_INCREMENT,
`dateline` int(10) unsigned NOT NULL,
`expires` int(10) unsigned NOT NULL,
+ `locationid` int(11) NULL,
`title` varchar(200) DEFAULT NULL,
- `content` text,
- `type` varchar(10),
+ `content` text NOT NULL,
+ `type` varchar(10) CHARACTER SET ascii NOT NULL,
PRIMARY KEY (`newsid`),
- KEY `type` (`type`, `dateline`),
- KEY `all3` (`type`, `expires`, `dateline`)
+ KEY `type` (`type`, `dateline`)
");
if (tableGetIndex('vmchooser_pages', ['dateline']) !== false) {
@@ -44,9 +44,18 @@ if (!tableHasColumn('vmchooser_pages', 'expires')) {
Database::exec('UPDATE vmchooser_pages SET expires = dateline + 86400 * 3650 WHERE expires = 0'); // ~10 Years
}
+if (!tableHasColumn('vmchooser_pages', 'locationid')) {
+ Database::exec('ALTER TABLE vmchooser_pages ADD COLUMN `locationid` int(11) NULL AFTER `expires`');
+}
+
+$dbret[] = Database::exec('ALTER TABLE vmchooser_pages MODIFY `type` varchar(10) CHARACTER SET ascii NOT NULL');
+
+$dbret[] = tableAddConstraint('remoteaccess_x_location', 'locationid', 'location', 'locationid',
+ 'ON UPDATE CASCADE ON DELETE CASCADE');
+
// Create response for browser
-if (in_array(UPDATE_DONE, $res)) {
+if (in_array(UPDATE_DONE, $dbret)) {
finalResponse(UPDATE_DONE, 'Tables created successfully');
}