b2evolution Antispam Recheck Cronjob

By popular demand, I’ll tell you all how I managed to get my server to recheck all my not-yet-rechecked spam keywords.

Before you go any further, you’ll have to do EdB’s antispam recheck hacks, since we’ll be making use of those.

Read on for the how-to.

The requirements are the same as last time:

  1. No log-in required
  2. Server-Side

Here’s the script that I created. It’s just a stripped-down version of the regular b2antispam.php file. It goes through a loop rechecking each of the antispam strings that haven’t yet been rechecked. Of course, if you didn’t do EdB’s antispam recheck hacks, this won’t work. Don’t say I didn’t warn ya.

Here’s the file. Save b2antispam_recheck.php, and upload to your admin directory:

Special Note:

You may have problems, depending on how you implemented EdB’s hack, with this line, kinda near the top:

WHERE aspm_checked = 'no'") )

Basically, this bit is trying to grab all the antispam strings that haven’t been rechecked yet. If you used “gotit” and “needs”, then you’d replace “no” with “needs”. I just used EdB’s first draft, where he used “yes” and “no”.

Next, set up a cron on your server, with this sort of command line. (Check with your host for the specifics on this)

0 */6 * * * /usr/local/bin/php /home/my_username/public_html/admin/b2antispam_recheck.php

If you want to keep it to one script, and you’ve already done my auto-polling script, then you could just add this line to the bottom of b2antispam_poll.php instead of adding another cron job:

include dirname(__FILE__) . '/b2antispam_recheck.php';

That would have the added advantage of rechecking right after polling for updates.

3 Responses to “b2evolution Antispam Recheck Cronjob”

  1. On July 25th, 2005 at 16:49:36, EdB Said:

    Hi Isaac. Just a note regarding the “no or needs” issue you pointed out. Twice in you code you use “aspm_checked=’yes’”, so anyone who is using the “needs” version will have to replace ‘yes’ with ‘gotit’.

    I already added your ’spammers-be-gone’ bit to my conf/hacks file, and today I will use your cronable antispam updater & rechecker. That should be pretty good protection against the known bad guys - especially when I go offline for a month at a time…

    Thanks!!!

  2. On August 15th, 2005 at 21:33:26, taupehat Said:

    Hmm. Thank you wordpress for smart-quoting all the code there. It’s pretty awful, as I have to manually edit the whole thing, or write a script to do so. Which would be silly, since it’s a small code snippet.

    On the other hand, thanks for the hack!

  3. On August 16th, 2005 at 09:17:48, Isaac Said:

    Thank you wordpress for smart-quoting all the code there.

    Yeah, sorry about that. I’m in the process of moving these code samples into my download folder. This one is fixed now.

Leave a Reply

Comments are moderated like crazy using a variety of plugins. There is a very high likelihood that your comment won't show up right away, especially if you have never commented here before, but it was not deleted.

Please be patient, and do not post your comment more than once. It will show up once it is approved.

You must be logged in to post a comment.