diff --git a/install.php b/install.php index 6971437a..95200459 100644 --- a/install.php +++ b/install.php @@ -1,7 +1,7 @@ = 50503) + return query($sql); + else + return query(str_replace('utf8mb4', 'utf8', $sql)); + } + $boards = listBoards(); switch ($version) { @@ -249,14 +258,6 @@ if (file_exists($config['has_installed'])) { } } case 'v0.9.6-dev-9': - sql_open(); - function __query($sql) { - if (mysql_version() >= 50503) - return query($sql); - else - return query(str_replace('utf8mb4', 'utf8', $sql)); - } - foreach ($boards as &$board) { __query(sprintf("ALTER TABLE `posts_%s` CHANGE `subject` `subject` VARCHAR(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, @@ -356,6 +357,13 @@ if (file_exists($config['has_installed'])) { CHANGE `boards` `boards` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;") or error(db_error()); query("ALTER TABLE `reports` CHANGE `board` `board` VARCHAR( 58 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;") or error(db_error()); + case 'v0.9.6-dev-11': + foreach ($boards as &$board) { + __query(sprintf("ALTER TABLE `posts_%s` + CHANGE `thumb` `thumb` VARCHAR( 255 ) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + CHANGE `file` `file` VARCHAR( 255 ) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL ;", + $board['uri'])) or error(db_error()); + } case false: // Update version number file_write($config['has_installed'], VERSION); diff --git a/templates/posts.sql b/templates/posts.sql index ca2ec304..4eef3a0d 100644 --- a/templates/posts.sql +++ b/templates/posts.sql @@ -10,10 +10,10 @@ CREATE TABLE IF NOT EXISTS ``posts_{{ board }}`` ( `body_nomarkup` text, `time` int(11) NOT NULL, `bump` int(11) DEFAULT NULL, - `thumb` varchar(50) DEFAULT NULL, + `thumb` varchar(255) DEFAULT NULL, `thumbwidth` int(11) DEFAULT NULL, `thumbheight` int(11) DEFAULT NULL, - `file` varchar(50) DEFAULT NULL, + `file` varchar(255) DEFAULT NULL, `filewidth` int(11) DEFAULT NULL, `fileheight` int(11) DEFAULT NULL, `filesize` int(11) DEFAULT NULL,