diff options
author | Simon Rettberg | 2016-06-24 14:24:04 +0200 |
---|---|---|
committer | Simon Rettberg | 2016-06-24 14:24:04 +0200 |
commit | ce3a398d1d8f465e5681e8664caa8abc3475b9c0 (patch) | |
tree | 9ed25fe4cde44091dd65367fe5cec64a88d3f7d3 /modules-available/news/install.inc.php | |
parent | [exams] Indent location by tree depth; fix ordering of locations in vis.js (diff) | |
parent | display locationid=0 as locationid=* (diff) | |
download | slx-admin-ce3a398d1d8f465e5681e8664caa8abc3475b9c0.tar.gz slx-admin-ce3a398d1d8f465e5681e8664caa8abc3475b9c0.tar.xz slx-admin-ce3a398d1d8f465e5681e8664caa8abc3475b9c0.zip |
Merge branch 'modularization' of dnbd3:openslx-ng/slx-admin into modularization
Diffstat (limited to 'modules-available/news/install.inc.php')
-rw-r--r-- | modules-available/news/install.inc.php | 42 |
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'); +} |