query(sprintf("ALTER TABLE `posts_%s` CHANGE `trip` `trip` VARCHAR( 15 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL",$_board['uri']))orerror(db_error());
}
case'v0.9.2-dev':
// Upgrade to v0.9.2-dev-1
// New table: `theme_settings`
query("CREATE TABLE IF NOT EXISTS `theme_settings` ( `name` varchar(40) NOT NULL, `value` text, UNIQUE KEY `name` (`name`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;")orerror(db_error());
// New table: `news`
query("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;")orerror(db_error());
case'v0.9.2.1-dev':
case'v0.9.2-dev-1':
// Fix broken version number/mistake
$version='v0.9.2-dev-1';
// Upgrade to v0.9.2-dev-2
foreach($boardsas&$_board){
// Increase field sizes
query(sprintf("ALTER TABLE `posts_%s` CHANGE `subject` `subject` VARCHAR( 50 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL",$_board['uri']))orerror(db_error());
query(sprintf("ALTER TABLE `posts_%s` CHANGE `name` `name` VARCHAR( 35 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL",$_board['uri']))orerror(db_error());
}
case'v0.9.2-dev-2':
// Upgrade to v0.9.2-dev-3 (v0.9.2)
foreach($boardsas&$_board){
// Add `custom_fields` field
query(sprintf("ALTER TABLE `posts_%s` ADD `embed` TEXT NULL",$_board['uri']))orerror(db_error());
query("ALTER TABLE `theme_settings` CHANGE `name` `name` VARCHAR( 40 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL")orerror(db_error());
query("ALTER TABLE `theme_settings` DROP INDEX `name`")orerror(db_error());
case'v0.9.3-dev-1':
query("ALTER TABLE `mods` ADD `boards` TEXT NOT NULL")orerror(db_error());
query("UPDATE `mods` SET `boards` = '*'")orerror(db_error());
case'v0.9.3-dev-2':
foreach($boardsas&$_board){
query(sprintf("ALTER TABLE `posts_%s` CHANGE `filehash` `filehash` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL",$_board['uri']))orerror(db_error());
}
case'v0.9.3-dev-3':
// Board-specifc bans
query("ALTER TABLE `bans` ADD `board` SMALLINT NULL AFTER `reason`")orerror(db_error());
case'v0.9.3-dev-4':
// add ban ID
query("ALTER TABLE `bans` ADD `id` INT NOT NULL AUTO_INCREMENT FIRST, ADD PRIMARY KEY ( `id` ), ADD UNIQUE (`id`)");
case'v0.9.3-dev-5':
foreach($boardsas&$_board){
// Increase subject field size
query(sprintf("ALTER TABLE `posts_%s` CHANGE `subject` `subject` VARCHAR( 100 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL",$_board['uri']))orerror(db_error());
query("ALTER TABLE `{$table}` ENGINE = MYISAM DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci")orerror(db_error());
}
case'v0.9.3-dev-7':
foreach($boardsas&$board){
query(sprintf("ALTER TABLE `posts_%s` CHANGE `filename` `filename` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL",$board['uri']))orerror(db_error());
}
case'v0.9.3-dev-8':
foreach($boardsas&$board){
query(sprintf("ALTER TABLE `posts_%s` ADD INDEX ( `thread` )",$board['uri']))orerror(db_error());
}
case'v0.9.3-dev-9':
foreach($boardsas&$board){
query(sprintf("ALTER TABLE `posts_%s`ADD INDEX ( `time` )",$board['uri']))orerror(db_error());
query("ALTER TABLE `mutes` ADD INDEX (`ip`)")orerror(db_error());
query("ALTER TABLE `news` ADD INDEX (`time`)")orerror(db_error());
query("ALTER TABLE `theme_settings` ADD INDEX (`theme`)")orerror(db_error());
case'v0.9.4-dev-1':
foreach($boardsas&$board){
query(sprintf("ALTER TABLE `posts_%s` ADD `sage` INT( 1 ) NOT NULL AFTER `locked`",$board['uri']))orerror(db_error());
}
case'v0.9.4-dev-2':
if(!isset($_GET['confirm'])){
$page['title']='License Change';
$page['body']='<p style="text-align:center">You are upgrading to a version which uses an amended license. The licenses included with Tinyboard distributions prior to this version (v0.9.4-dev-2) are still valid for those versions, but no longer apply to this and newer versions.</p>'.
$page['body']='<p style="text-align:center">Successfully upgraded from '.$version.' to <strong>'.VERSION.'</strong>.</p>';
break;
default:
$page['title']='Unknown version';
$page['body']='<p style="text-align:center">Tinyboard was unable to determine what version is currently installed.</p>';
break;
caseVERSION:
$page['title']='Already installed';
$page['body']='<p style="text-align:center">It appears that Tinyboard is already installed ('.$version.') and there is nothing to upgrade! Delete <strong>'.$config['has_installed'].'</strong> to reinstall.</p>';
$page['body']='<p style="text-align:center">Thank you for using Tinyboard. Please remember to report any bugs you discover. <a href="http://tinyboard.org/docs/?p=Config">How do I edit the config files?</a></p>';
if(!empty($sql_errors)){
$page['body'].='<div class="ban"><h2>SQL errors</h2><p>SQL errors were encountered when trying to install the database. This may be the result of using a database which is already occupied with a Tinyboard installation; if so, you can probably ignore this.</p><p>The errors encountered were:</p><ul>'.$sql_errors.'</ul><p><a href="?step=5">Ignore errors and complete installation.</a></p></div>';
$page['body'].='<div class="ban"><h2>Delete install.php!</h2><p>I couldn\'t remove <strong>install.php</strong>. You will have to remove it manually.</p></div>';
$page['body']='<p style="text-align:center">Thank you for using Tinyboard. Please remember to report any bugs you discover.</p>';
file_write($config['has_installed'],VERSION);
if(!file_unlink(__FILE__)){
$page['body'].='<div class="ban"><h2>Delete install.php!</h2><p>I couldn\'t remove <strong>install.php</strong>. You will have to remove it manually.</p></div>';