Page 1 of 1

Bug in spam-plugin (no spamblocklog-table)

Posted: Sun Aug 12, 2007 10:42 am
by Boris
On a fresh install of the anti-spamplugin I missed the table ${prefix}_spamblocklog so I had a look into it and found a bug.

function checkScheme:

Code: Select all

$version = $this->get_config('version', '1.1');

if ($version != '1.0') {
    // [install spamhtaccess-table]
} elseif ($version != $maxVersion) {
    // [install spamblocklog-table]
    // [install spamhtaccess-table]
    // [set version = maxversion]
This means, that a fresh install will set $version to '1.1' and the following if does check for 1.0 (while it possible should check for <1.0) and a new version is never set.


A simple fix:

Code: Select all

$ svn diff
Index: serendipity_event_spamblock.php
===================================================================
--- serendipity_event_spamblock.php     (revision 1841)
+++ serendipity_event_spamblock.php     (working copy)
@@ -571,7 +571,7 @@

         $version = $this->get_config('version', '1.1');

-        if ($version != '1.0') {
+        if (version_compare($version, '1.0', '<')) {
             $q   = "CREATE TABLE {$serendipity['dbPrefix']}spamblock_htaccess (
                           timestamp int(10) {UNSIGNED} default null,
                           ip varchar(15))";
This created the right table for me too (possibly because 'version' was never set before).

Posted: Sun Aug 12, 2007 11:14 am
by Boris
Another thing that comes to my mind regarding spamblocklog:

All comments which are not recognized as spam by Akismet are classified as API_ERROR in line 522. I think that's irritating as I expect, that my API-Call failed. Perhaps another (describtive) log-type would be nice here.

Posted: Mon Aug 13, 2007 10:07 am
by garvinhicking
Hi!

Thanks a lot, committed to the SVN. I slightly reworked the DB creation routine to make more sense. ;)

REgards,
Garvin