Okay here's a working Badbehavior module for Drupal 6.x (using the current bad-behavior 2.0.13) based completely on the work done by Eaton and luperry upgrading the 4.7 version to 5.x (so thank them, not me - this port was easy!)

Don't bother trying to upgrade from the previous version, I didn't bother writing any upgrade code - I mean, why bother? The logs are of no interest particularly and that's all you'd be upgrading... Just start from scratch again.

...Install instructions are the same as usual, download Bad Behavior and unzip it. Then move the bad-behavior folder from the unzipped folder ('Bad-Behavior' if memory serves me correct) into the module/badbehavior folder so you end up with;

modules/badbehavior;

LICENSE.txt
README.txt
bad-behavior/ (folder)
badbehavior.info
badbehavior.install
badbehavior.module

modules/badbehavior/bad-behavior;

admin.inc.php
banned.inc.php
...etc...
...all the rest of the bad behavior files...

Pobster

CommentFileSizeAuthor
#3 badbehavior.zip3.8 KBpobster
#2 badbehavior_1.zip3.59 KBpobster
badbehavior.zip3.27 KBpobster

Comments

pobster’s picture

edit: Use the release below instead. No sense in filling up this thread with old releases...

Pobster

pobster’s picture

StatusFileSize
new3.59 KB

Also... If you're particularly bothered about uninstall hooks removing entries from your variable table, change the uninstall hook in badbehavior.install to;

function badbehavior_uninstall() {
  drupal_uninstall_schema('badbehavior');
  db_query("DELETE FROM {variable} WHERE name LIKE 'badbehavior_%'");
  cache_clear_all('variables', 'cache');
}

Apologies, didn't think to put it in the code before... Not that it really matters I guess! Just for neatness!

Pobster
PS. I've also included a nice hook_requirements to check that badbehavior/bad-behavior actually exists and that it contains at least core.inc.php and version.inc.php and removed the watchdog error message from hook_init (as the requirements hook negates it) and finally, I've removed the unnecessary admin/modules#description from hook_help.

pobster’s picture

StatusFileSize
new3.8 KB

Okay I changed the code from hook_init to hook_boot, so now badbahavior is called on *every* page request regardless of whether it's cached or not. Sorry didn't think about doing this before as I don't use page caching myself...

Tested and working...

Pobster

wilco’s picture

I'll review this module and then roll a release into the CVS.

wilco’s picture

Version: 7.x-1.x-dev » 6.x-1.0-rc1
Status: Needs review » Closed (fixed)

I've gone through it and created a RC for this patch.

Closing this ticket.

pobster’s picture

Ah my bad, forgot about this http://drupal.org/node/140311

/**
  * Implementation of hook_menu().
  */
function badbehavior_menu() {
  $items = array();

  $items['admin/settings/badbehavior'] = array(
    'title' => 'Bad behavior',
    'description' => 'Configure automatic spam blocking for your site.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('badbehavior_settings'),
    'access arguments' => array('administer bad behavior')
  );
  $items['admin/reports/badbehavior'] = array(
    'title' => 'Bad behavior',
    'description' => 'Examine the spam blocking logs for your web site.',
    'page callback' => 'badbehavior_overview',
    'access arguments' => array('administer bad behavior')
  );
  $items['admin/reports/badbehavior/event'] = array(
    'title' => 'Details',
    'page callback' => 'badbehavior_event',
    'access arguments' => array('administer bad behavior'),
    'type' => MENU_CALLBACK);

  return $items;
}

Sorry!

Pobster
PS. Thanks for the credit in the README! ;o)

wilco’s picture

Hey Pobster,

Glad to give props to our peeps!

I'm reviewing the code you posted versus what exists in the module. Am I missing something, I can't seem to see any difference between them. Can you help shed some light on this?

-wilco

wilco’s picture

Status: Closed (fixed) » Needs review
pobster’s picture

Hiya!

In Drupal 6.x the t() calls are unnecessary in title and description for hook_menu items. The items are automatically passed through t() now - that was the only change though! :o)

Thanks,

Pobster

wilco’s picture

Wow! Can't believe I missed that one. Good one.

Thanks.

-wil

wilco’s picture

Status: Needs review » Closed (fixed)

Rolled up a new release.

Enjoy.

This ticket is now closed.