summaryrefslogtreecommitdiffstats
path: root/modules-available/news/install.inc.php
diff options
context:
space:
mode:
authorChristian Klinger2016-06-24 13:02:38 +0200
committerChristian Klinger2016-06-24 13:02:38 +0200
commit5394876236afc3eb724ceebeac08abbbd9f2382b (patch)
tree6175a968d612dc24e5e41b6de70ad7b15e876f99 /modules-available/news/install.inc.php
parent[exams] Apply formatting (diff)
downloadslx-admin-5394876236afc3eb724ceebeac08abbbd9f2382b.tar.gz
slx-admin-5394876236afc3eb724ceebeac08abbbd9f2382b.tar.xz
slx-admin-5394876236afc3eb724ceebeac08abbbd9f2382b.zip
also allow users to edit the help.
The code is still a little ugly.
Diffstat (limited to 'modules-available/news/install.inc.php')
-rw-r--r--modules-available/news/install.inc.php42
1 files changed, 27 insertions, 15 deletions
diff --git a/modules-available/news/install.inc.php b/modules-available/news/install.inc.php
index 69db5aa9..48e13a41 100644
--- a/modules-available/news/install.inc.php
+++ b/modules-available/news/install.inc.php
@@ -2,23 +2,35 @@
$res = array();
-$res[] = tableCreate('news', "
- `newsid` int(10) unsigned NOT NULL AUTO_INCREMENT,
- `dateline` int(10) unsigned NOT NULL,
- `title` varchar(200) DEFAULT NULL,
- `content` text,
- PRIMARY KEY (`newsid`),
- KEY `dateline` (`dateline`)
-");
-// Update path
-// *crickets*
+if (tableExists('news')) {
+ /* rename news and add column "type" */
+ tableRename('news', 'vmchooser_pages');
+ Database::exec("ALTER TABLE `vmchooser_pages` ADD COLUMN type varchar(10)", []);
+ Database::exec("UPDATE `vmchooser_pages` set `type`='news` WHERE 1", []);
-// Create response for browser
+ finalResponse(UPDATE_DONE, 'Tables updated successfully');
-if (in_array(UPDATE_DONE, $res)) {
- finalResponse(UPDATE_DONE, 'Tables created successfully');
-}
+} else {
+ $res[] = tableCreate('vmchooser_pages', "
+ `newsid` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `dateline` int(10) unsigned NOT NULL,
+ `title` varchar(200) DEFAULT NULL,
+ `content` text,
+ `type` varchar(10),
+ PRIMARY KEY (`newsid`),
+ KEY `dateline` (`dateline`)
+ ");
+
+
+ // *crickets*
-finalResponse(UPDATE_NOOP, 'Everything already up to date');
+ // Create response for browser
+
+ if (in_array(UPDATE_DONE, $res)) {
+ finalResponse(UPDATE_DONE, 'Tables created successfully');
+ }
+
+ finalResponse(UPDATE_NOOP, 'Everything already up to date');
+}