return $ret;
}
- function checkScheme($maxVersion) {
+ function checkScheme() {
global $serendipity;
- $version = $this->get_config('version', '1.1');
-
- if ($version != '1.0') {
- $q = "CREATE TABLE {$serendipity['dbPrefix']}spamblock_htaccess (
- timestamp int(10) {UNSIGNED} default null,
- ip varchar(15))";
- $sql = serendipity_db_schema_import($q);
- } elseif ($version != $maxVersion) {
+ $dbversion = $this->get_config('dbversion', '1');
+
+ if ($dbversion == '1') {
$q = "CREATE TABLE {$serendipity['dbPrefix']}spamblocklog (
timestamp int(10) {UNSIGNED} default null,
type varchar(255),
ip varchar(15))";
$sql = serendipity_db_schema_import($q);
- $this->set_config('version', $maxVersion);
+ $q = "CREATE INDEX kshtaidx ON {$serendipity['dbPrefix']}spamblock_htaccess (timestamp);";
+ $sql = serendipity_db_schema_import($q);
+
+ $this->set_config('dbversion', '2');
}
return true;
case 'frontend_saveComment':
if (!is_array($eventData) || serendipity_db_bool($eventData['allow_comments'])) {
- if ($this->get_config('logtype', 'db') == 'db' && $this->get_config('version') != $bag->get('version')) {
- $this->checkScheme($bag->get('version'));
- }
+ $this->checkScheme();
$serendipity['csuccess'] = 'true';
$logfile = $this->logfile = $this->get_config('logfile', $serendipity['serendipityPath'] . 'spamblock.log');