summaryrefslogblamecommitdiffstats
path: root/modules-available/news/install.inc.php
blob: 48e13a415a1e335b1c4492b6c20932793a16e1a3 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11



               
 
 




                                                                                        
 
                                                                  
 












                                                                  
 







                                                                          
<?php

$res = array();



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", []);

	finalResponse(UPDATE_DONE, 'Tables updated 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*

	// Create response for browser

	if (in_array(UPDATE_DONE, $res)) {
		finalResponse(UPDATE_DONE, 'Tables created successfully');
	}

	finalResponse(UPDATE_NOOP, 'Everything already up to date');
}