Add ip index to post tables for faster ?/IP/ (and flood detection, etc.)

This commit is contained in:
Michael Foster 2013-08-28 18:02:28 +10:00
parent fcb88b16cd
commit 5aaa6887f6
2 changed files with 7 additions and 2 deletions

View File

@ -1,7 +1,7 @@
<?php
// Installation/upgrade file
define('VERSION', 'v0.9.6-dev-12');
define('VERSION', 'v0.9.6-dev-13');
require 'inc/functions.php';
@ -364,6 +364,10 @@ if (file_exists($config['has_installed'])) {
CHANGE `file` `file` VARCHAR( 255 ) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL ;",
$board['uri'])) or error(db_error());
}
case 'v0.9.6-dev-12':
foreach ($boards as &$board) {
query(sprintf("ALTER TABLE ``posts_%s`` ADD INDEX `ip` (`ip`)", $board['uri'])) or error(db_error());
}
case false:
// Update version number
file_write($config['has_installed'], VERSION);

View File

@ -28,6 +28,7 @@ CREATE TABLE IF NOT EXISTS ``posts_{{ board }}`` (
UNIQUE KEY `id` (`id`),
KEY `thread_id` (`thread`,`id`),
KEY `time` (`time`),
FULLTEXT KEY `body` (`body`)
FULLTEXT KEY `body` (`body`),
KEY `ip` (`ip`),
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=1 ;