updated install file for v0.9.2.1-dev
This commit is contained in:
parent
2234c1ecea
commit
f7ed681eac
56
install.php
56
install.php
|
@ -2,7 +2,7 @@
|
||||||
// Installation/upgrade file
|
// Installation/upgrade file
|
||||||
// Current version: 0.9.2 (or 0.9.1-dev)
|
// Current version: 0.9.2 (or 0.9.1-dev)
|
||||||
|
|
||||||
define('VERSION', 'v0.9.2-dev');
|
define('VERSION', 'v0.9.2.1-dev');
|
||||||
|
|
||||||
require 'inc/functions.php';
|
require 'inc/functions.php';
|
||||||
require 'inc/display.php';
|
require 'inc/display.php';
|
||||||
|
@ -18,37 +18,47 @@
|
||||||
|
|
||||||
if(file_exists($config['has_installed'])) {
|
if(file_exists($config['has_installed'])) {
|
||||||
|
|
||||||
|
sql_open();
|
||||||
|
|
||||||
// Check the version number
|
// Check the version number
|
||||||
$version = file_get_contents($config['has_installed']);
|
$version = file_get_contents($config['has_installed']);
|
||||||
if(empty($version)) {
|
switch($version) {
|
||||||
// v0.9 or v0.9.1
|
case '':
|
||||||
// Upgrading to v0.9.2
|
case 'v0.9':
|
||||||
|
case 'v0.9.1':
|
||||||
|
// Upgrading to v0.9.2-dev
|
||||||
|
|
||||||
sql_open();
|
$boards = listBoards();
|
||||||
|
foreach($boards as &$_board) {
|
||||||
|
openBoard($_board['uri']);
|
||||||
|
|
||||||
$boards = listBoards();
|
// Add `capcode` field after `trip`
|
||||||
foreach($boards as &$_board) {
|
query(sprintf("ALTER TABLE `posts_%s` ADD `capcode` VARCHAR( 50 ) NULL AFTER `trip`", $board['uri'])) or error(db_error());
|
||||||
openBoard($_board['uri']);
|
|
||||||
|
|
||||||
// Add `capcode` field after `trip`
|
// Resize `trip` to 15 characters
|
||||||
query(sprintf("ALTER TABLE `posts_%s` ADD `capcode` VARCHAR( 50 ) NULL AFTER `trip`", $board['uri'])) or error(db_error());
|
query(sprintf("ALTER TABLE `posts_%s` CHANGE `trip` `trip` VARCHAR( 15 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL", $board['uri'])) or error(db_error());
|
||||||
|
}
|
||||||
|
case 'v0.9.2-dev':
|
||||||
|
// Upgrade to v0.9.2.1-dev
|
||||||
|
|
||||||
// Resize `trip` to 15 characters
|
// New table: `theme_settings`
|
||||||
query(sprintf("ALTER TABLE `posts_%s` CHANGE `trip` `trip` VARCHAR( 15 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL", $board['uri'])) or error(db_error());
|
query(sprintf("CREATE TABLE IF NOT EXISTS `theme_settings` ( `name` varchar(40) NOT NULL, `value` text, UNIQUE KEY `name` (`name`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;", $board['uri'])) or error(db_error());
|
||||||
}
|
|
||||||
|
|
||||||
file_put_contents($config['has_installed'], VERSION);
|
// New table: `news`
|
||||||
|
query(sprintf("CREATE TABLE IF NOT EXISTS `news` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` text NOT NULL, `time` int(11) NOT NULL, `subject` text NOT NULL, `body` text NOT NULL, UNIQUE KEY `id` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;", $board['uri'])) or error(db_error());
|
||||||
|
|
||||||
$page['title'] = 'Upgraded';
|
$page['title'] = 'Upgraded';
|
||||||
$page['body'] = '<p style="text-align:center">Successfully upgraded from v0.9 (or v0.9.1) to <strong>' . VERSION . '</strong>.</p>';
|
$page['body'] = '<p style="text-align:center">Successfully upgraded from v0.9 (or v0.9.1) to <strong>' . VERSION . '</strong>.</p>';
|
||||||
} elseif($version == VERSION) {
|
break;
|
||||||
$page['title'] = 'Already installed';
|
default:
|
||||||
$page['body'] = '<p style="text-align:center">It appears that Tinyboard is already installed! Delete <strong>' . $config['has_installed'] . '</strong> to reinstall.</p>';
|
$page['title'] = 'Unknown version';
|
||||||
} else {
|
$page['body'] = '<p style="text-align:center">Tinyboard was unable to determine what version is currently installed.</p>';
|
||||||
$page['title'] = 'Unknown version';
|
case VERSION:
|
||||||
$page['body'] = '<p style="text-align:center">Tinyboard was unable to determine what version is currently installed.</p>';
|
$page['title'] = 'Already installed';
|
||||||
|
$page['body'] = '<p style="text-align:center">It appears that Tinyboard is already installed! Delete <strong>' . $config['has_installed'] . '</strong> to reinstall.</p>';
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
file_put_contents($config['has_installed'], VERSION);
|
||||||
|
|
||||||
|
|
||||||
die(Element('page.html', $page));
|
die(Element('page.html', $page));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user