Badbehavior Module for Drupal 5.x attached

juerg - September 2, 2007 - 19:37
Project:Bad Behavior
Version:5.x-1.2-beta1
Component:Code
Category:task
Priority:normal
Assigned:wilco
Status:closed
Description

Drupal badbehavior module:
--------------------------

(2007-09-02 by Juerg Rohrer) I am not the maintainer of this module, I am just trying to help :-)

The attached module was created using
- The original badbehaviour module version 4.7.x-1.7-dev from http://drupal.org/node/30501
- The patch created by eaton see http://drupal.org/node/81577#comment-170144

The result is a version of badbehavior for Drupal 5.2x working with Bad Behavior version 2.0.10

Please note that you still have to download Bad-Behaviour from http://www.bad-behavior.ioerror.us/download/

Installing instructions:

1) Download Bad-Behavior version 2.0.10 from http://www.bad-behavior.ioerror.us/download/
2) Unpack bad-behaviour-2.0.10.zip in sites/all/modules ( unzip -a bad-behavior-2.0.10.zip ).
This will create a folder sites/all/modules/Bad-Behavior
3) Rename the attached file to badbehaviour-5.tar.gz (it was not possible to upload it with this extension)
4) Untar this Drupal module in sites/all/modules. This will add badbehavior.info , badbehavior.module,
LICENSE.txt as well as README-Drupal.txt to the folder /Bad-Behaviour

Enable the module as usual from the Drupal admin>>modules page.

If you can't get the directory structure right, I have also created one complete archive, which includes both the
Drupal module and badbehavior 2.0.10. It is available at http://timeforchange.org/badbehavior-drupal-5

For questions, please see the FAQ at http://www.bad-behavior.ioerror.us/faq/

Configuration and logs, see in the "old" README.txt

AttachmentSize
badbehavior-5.tar_.gz_.txt9.74 KB

#1

Anonymous - September 16, 2007 - 19:52
Status:fixed» closed

#2

juerg - December 7, 2007 - 22:20

Make sure to download the newest version of badbehavior from http://www.bad-behavior.ioerror.us/2007/12/06/bad-behavior-2011/ otherwise you get blocked out of your own site.

Version 2.0.10 is NOT working any more, you need version 2.0.11

Juerg

#3

westbywest - December 13, 2007 - 03:03

This module package still appears to be missing the file badbehavior.install, and the function badbehavior_install() containing necessary code to create DB tables.

Here is relevant code from bad-behavior/core.inc.php:

// Our log table structure
function bb2_table_structure($name)
{
        // It's not paranoia if they really are out to get you.
        $name_escaped = bb2_db_escape($name);
        return "CREATE TABLE IF NOT EXISTS `$name_escaped` (
                `id` INT(11) NOT NULL auto_increment,
                `ip` TEXT NOT NULL,
                `date` DATETIME NOT NULL default '0000-00-00 00:00:00',
                `request_method` TEXT NOT NULL,
                `request_uri` TEXT NOT NULL,
                `server_protocol` TEXT NOT NULL,
                `http_headers` TEXT NOT NULL,
                `user_agent` TEXT NOT NULL,
                `request_entity` TEXT NOT NULL,
                `key` TEXT NOT NULL,
                INDEX (`ip`(15)),
                INDEX (`user_agent`(10)),
                PRIMARY KEY (`id`) );"; // TODO: INDEX might need tuning
}

How difficult would it be to wrap this inside the file badbehavior.install correctly? (I.e. by "correctly" I mean so that it handles MySQL vs. PostgreSQL, unisntallation, etc.)

#4

westbywest - December 13, 2007 - 04:59

I've manged to fix this. The bad-behavior scripts (and not the associated Drupal module) did indeed create the necessary database table, but it didn't include the db_prefix in the table name, meaning the module couldn't find it.

I fixed this by replacing all instances of 'bad_behavior_log' with db_prefix_tables('{bad_behavior_log}') in the file badbehavior.module. Note that the single quotes should be *included* in those strings. Also note that I also had to delete the row named "badbehavior_db_installed" from the {variable} table to get the BB2 scripts to reinstall their log table.

This is really another reason why the file badbehavior.install is necessary, since you can define the function badbehavior_uninstall() to do these tasks for you.

I include my patched module file. Beware this is for Drupal 5.x and BB2, not Drupal v4.7!

AttachmentSize
badbehavior.module.gz2.55 KB

#5

RTH - February 8, 2008 - 08:06

Re #3 and #4: Inside badbehavior.module, there is a bb2_install function that indirectly calls bb2_table_structure. Doesn't this do what you ask for in #3? If not, what am I missing?

Thanks, Ron.

#6

wilco - April 7, 2008 - 14:23
Version:4.7.x-1.x-dev» HEAD
Status:closed» patch (code needs review)

Hello Folks!

With all the brilliant work done so far on this Drupal 5 module and the Drupal 6 version. I thought it would be appropriate to roll up a new version of the module with some install/uninstall hooks. Much of what pobster did has helped to clean up this edition of the module.

I hope it meets everyones needs and expectations.

#7

wilco - April 6, 2008 - 18:32
Version:HEAD» 5.x-1.2-beta1
Status:patch (code needs review)» fixed

I've taken the patch and reworked the module with some of the work done on the Drupal 6 version. I'm closing this ticket as I've released a BETA version of the module with all these points taken into consideration.

#8

wilco - April 6, 2008 - 18:33
Assigned to:Anonymous» wilco

#9

wilco - April 7, 2008 - 14:22

Apparently I did something wrong with my uploading tarballs -- instructions were lost in translation. So, I'm including the file here.

AttachmentSize
badbehavior-5.x-1.2-beta1.tar_.gz4.97 KB

#10

Anonymous (not verified) - April 21, 2008 - 14:23
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.