summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--install.php24
1 files changed, 19 insertions, 5 deletions
diff --git a/install.php b/install.php
index 856a84e6..48a5a166 100644
--- a/install.php
+++ b/install.php
@@ -1,8 +1,6 @@
<?php
- // Installation/upgrade file
- // Current version: 0.9.2 (or 0.9.1-dev)
-
- define('VERSION', 'v0.9.2.1-dev');
+ // Installation/upgrade file
+ define('VERSION', 'v0.9.2-dev-2');
require 'inc/functions.php';
require 'inc/display.php';
@@ -42,13 +40,27 @@
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
+ // Upgrade to v0.9.2-dev-1
// New table: `theme_settings`
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());
// 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());
+ 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
+
+ $boards = listBoards();
+ foreach($boards as &$_board) {
+ openBoard($_board['uri']);
+
+ // 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'])) or error(db_error());
+ query(sprintf("ALTER TABLE `posts_%s` CHANGE `name` `name` VARCHAR( 35 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL", $board['uri'])) or error(db_error());
+ }
$page['title'] = 'Upgraded';
$page['body'] = '<p style="text-align:center">Successfully upgraded from ' . $version . ' to <strong>' . VERSION . '</strong>.</p>';
@@ -62,6 +74,8 @@
break;
}
file_put_contents($config['has_installed'], VERSION);
+
+ sql_close();
die(Element('page.html', $page));