summaryrefslogtreecommitdiff
path: root/install.php
diff options
context:
space:
mode:
Diffstat (limited to 'install.php')
-rw-r--r--install.php57
1 files changed, 56 insertions, 1 deletions
diff --git a/install.php b/install.php
index 639a90c9..69be6300 100644
--- a/install.php
+++ b/install.php
@@ -1,7 +1,7 @@
<?php
// Installation/upgrade file
-define('VERSION', 'v0.9.6-dev-20');
+define('VERSION', 'v0.9.6-dev-21');
require 'inc/functions.php';
@@ -412,6 +412,61 @@ if (file_exists($config['has_installed'])) {
query("UPDATE ``mods`` SET `type` = 20 WHERE `type` = 1") or error(db_error());
query("UPDATE ``mods`` SET `type` = 30 WHERE `type` = 2") or error(db_error());
query("ALTER TABLE ``mods`` CHANGE `type` `type` smallint(1) NOT NULL") or error(db_error());
+ case 'v0.9.6-dev-20':
+ query("CREATE TABLE IF NOT EXISTS `bans_new_temp` (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `ipstart` varbinary(16) NOT NULL,
+ `ipend` varbinary(16) DEFAULT NULL,
+ `created` int(10) unsigned NOT NULL,
+ `expires` int(10) unsigned DEFAULT NULL,
+ `board` varchar(58) DEFAULT NULL,
+ `creator` int(10) NOT NULL,
+ `reason` text,
+ `seen` tinyint(1) NOT NULL,
+ `post` blob,
+ PRIMARY KEY (`id`),
+ KEY `expires` (`expires`),
+ KEY `ipstart` (`ipstart`,`ipend`)
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=1") or error(db_error());
+ $listquery = query("SELECT * FROM ``bans`` ORDER BY `id`") or error(db_error());
+ while ($ban = $listquery->fetch(PDO::FETCH_ASSOC)) {
+ $query = prepare("INSERT INTO ``bans_new_temp`` VALUES
+ (NULL, :ipstart, :ipend, :created, :expires, :board, :creator, :reason, :seen, NULL)");
+
+ $range = Bans::parse_range($ban['ip']);
+ if ($range === false) {
+ // Invalid retard ban; just skip it.
+ continue;
+ }
+
+ $query->bindValue(':ipstart', $range[0]);
+ if ($range[1] !== false && $range[1] != $range[0])
+ $query->bindValue(':ipend', $range[1]);
+ else
+ $query->bindValue(':ipend', null, PDO::PARAM_NULL);
+
+ $query->bindValue(':created', $ban['set']);
+
+ if ($ban['expires'])
+ $query->bindValue(':expires', $ban['expires']);
+ else
+ $query->bindValue(':expires', null, PDO::PARAM_NULL);
+
+ if ($ban['board'])
+ $query->bindValue(':board', $ban['board']);
+ else
+ $query->bindValue(':board', null, PDO::PARAM_NULL);
+
+ $query->bindValue(':creator', $ban['mod']);
+
+ if ($ban['reason'])
+ $query->bindValue(':reason', $ban['reason']);
+ else
+ $query->bindValue(':reason', null, PDO::PARAM_NULL);
+
+ $query->bindValue(':seen', $ban['seen']);
+ $query->execute() or error(db_error($query));
+ }
case false:
// Update version number
file_write($config['has_installed'], VERSION);