Bug in spam-plugin (no spamblocklog-table)

Found a bug? Tell us!!
Post Reply
Boris

Bug in spam-plugin (no spamblocklog-table)

Post 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).
Boris

Post 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.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

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

REgards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply