Closed (fixed)
Project:
Bad Behavior
Version:
5.x-2.0-beta1
Component:
User interface
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
30 Aug 2006 at 20:30 UTC
Updated:
9 Apr 2008 at 01:57 UTC
Jump to comment: Most recent file
Comments
Comment #1
luperry commentedComment #2
luperry commentedfixed up a minor typo.
Comment #3
luperry commentedmore tweaks
Comment #4
luperry commentedoptimization on database structure installation
Comment #5
pobster commentedI was just thinking about updating this module myself! Nice work! :o)
One thing though it doesn't seem to degrade gracefully... I have the previous module installed and when I patch it - the logs vanish although saying that, the module doesn't appear to write to the logs anyway?
Pobster
Comment #6
pobster commentedAh my mistake - YES the logs get written to, but the page displaying them is always blank...
Pobster
Comment #7
pobster commentedAh okay - it *does* work after all ;o) But when you tick the verbose logging it doesn't change anything (as the query is hard coded to ignore entries with a key of '00000000'). Why not use;
Pobster
Comment #8
luperry commentedAh. you are right.
this should fix it.
Comment #9
dkruglyak commentedCould you commit to CVS or at least post a patched module file?
I also wonder if anyone tested BB2 with IE 7: http://drupal.org/node/82567
Comment #10
luperry commentedI'm not the maintainer of this module, so I can't commit it to the cvs.
here is the patched module.
Comment #11
moggy commentedwhen checking the bad behavior logs (verbose disabled) I've getting an empty table with the following error being recorded in the logs
Unknown column 'w.key' in 'where clause' query: SELECT w.* FROM bad_behavior_log w WHERE w.key != '00000000' ORDER BY w.date DESC LIMIT 0, 50 in /var/www/Drupal-47/includes/database.mysql.inc on line 120.Comment #12
luperry commentedthe database structure is different in BB2, drop your old bad_behavior_log table and let it re-create a new one.
Comment #13
crozilla commented> drop your old bad_behavior_log table and let it re-create a new one.
Okay, I did the first part, but the second part didn't happen. How do I create 'bad_behavior_log' manually?
Thanks in advance.
Comment #14
luperry commentedyou don't create it manually, it'll automatically create it for you.
Comment #15
luperry commentedComment #16
tkgafs commentedThanks for doing this port it works well on my 4.7.4 system using bad-behavior files 2.0.6
please note however the installation instructions at the top are not that clear
when I first tried this I was getting lots of errors in the logs saying
The third-party bad-behavior files are not installed. Please consult badbehavior/README.txt for details
what I had done wrongly was to put the folder structure Bad-Behavior/bad-behavior inside my badbehavior module [which is what I thought was meant at the start]
so the 3rd party files where placed at modules/badbehavior/Bad-Behavior/bad-behavior where the system could not find them
this was wrong I should have extracted the folder bad-behavior from the Bad-Behavior folder and placed it in
modules/badbehavior/bad-behavior
the other problem I had was that once I had dropped the bad-behavior-log table the system would not recreate it
what I ended up doing was installing the devel module and using that to re-install the badbehavior module
tkgafs
Comment #17
luperry commentedI'm not the official maintainer of this module, this is provided for your convenience only.
it would be up to the official maintainer to fix up the documetations and do a proper port.
but I thought the database part is pretty obvious.
Comment #18
tkgafs commentedHopefully somebody can point out what my problem is here
I have installed this bb2 port of bad-behavior into my drupal 4.7.4 install and its working perfectly
My system is running on MySQL v 3.23.56
I have dumped my database using mysqldump -user user --password=password dbname > dbname.sql
but if I try and reload the database from the sql dump it fails on the CREATE TABLE bad_behavior_log
with the following error
ERROR 1064 at line 11916: You have an error in your SQL syntax near 'NOT NULL,
PRIMARY KEY (id),
KEY ip (ip(15)),
KEY user_agent (user_agent(1' at line 11
the create table [which is line 11916] in the dump file is as follows
CREATE TABLE bad_behavior_log (
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,
PRIMARY KEY (id),
KEY ip (ip(15)),
KEY user_agent (user_agent(10))
) TYPE=MyISAM;
the create table command in the bb2 code in core.inc.php is
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
}
I dont know mysql very well but I'm stumped as to what the error could be as 1064 usually an error in the syntax
but this is a dump and reload on the same system, surely mysqldump would get the syntax correct !!
I have also tried adding the --opt option to the mysqldump command but it makes no difference
If I remove the badbehavior_log table from the backup the rest of the dump reloads quite happily
any advice gratefully received
Tkgafs
Comment #19
tkgafs commentedafter a bit of research it would appear the line key text NOT NULL, is the problem
I am puzzled if this is a problem why I didnt see any errors when the module was first installed
tkgafs
Comment #20
eaton commentedThe attached patch file will update BadBehavior for use with Drupal 5 and Bad-Behavior 2.0.x.
Enjoy...
Comment #21
scroogie commentedOh great Eaton, gonna try that out hopefully tomorrow. Did anyone else already test that patch? I completely trust Eatons magnificient Skills, its just that im wondering why it didnt get commited yet.
Comment #22
eaton commentedWell, I haven't had too much time to test it; I was still getting spammed pretty hard and ended up porting Akismet shortly after. But to the best of my knowledge it does work. ;-)
Comment #23
juerg commentedI just wanted to mention that the patched module for Drupal 4.7.4 (http://drupal.org/files/issues/badbehavior_0.module) does not respect table prefixes when creating the table.
Assuming the table prefixes are set to "pre1-" then the module creates table bad_bevavior_log instead of pre1-bad_bevahior_log (probably missing {} around the table name). If you create the table manually, then it seems to work OK, however.
Juerg
Comment #24
mcurry commentedRestoring original issue title.
Comment #25
pjb commentedI've tested the BB2 + Drupal 5 patch submitted in #20 and it seems to work fine. Couple of things:
1) The menu hook on line 28 should probably be changed to admin/settings/badbehavior vs. admin/content/badbehavior
2) I think there are README.txt updates necessary; the original version states that the module file should be placed into the bad-behavior directory that is created when you unzip the file from ioerror.us but now we do the opposite and put that directory into the Drupal module directory per luperry's directions from the original patch.
Thanks for the patch Eaton, that's some great work and much appreciated! :)
Comment #26
p_palmer commentedHi Eaton,
Can you confirm which of these to go with as the dates are the same, but the code different (I guess you were enjoyin festive times)...
1) Comment #20 above pointing to http://drupal.org/files/issues/badbehavior-2_5.patch
or your comment (The attached patch updates the Bad Behavior module to the happy world of Drupal 5) here
2) http://drupal.org/node/105065 to patch http://drupal.org/files/issues/badbehavior_5.patch
I am using dru 5.1
Good work, and thanks in advance :)
Comment #27
jbc commentedI’ve installed badbehaviour v. 2.0.10 and utilised it with the drupal module which has been patched to work with this version (under BB2 Port post)
However, I am getting messages saying that major search engines msnbot and googlebot are being banned, eg:
_______________________________
IP Addr 66.249.72.228
Hostname crawl-66-249-72-228.googlebot.com (whois)
Date 2007-05-18 19:47:16
Request type GET
URI /node/923/print
Protocol HTTP/1.1
User Agent Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)
Headers GET /node/923/print HTTP/1.1 Host: www.eternalpurpose.org.uk Connection: Keep-alive Accept: */* From: googlebot(at)googlebot.com User-Agent: Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html) Accept-Encoding: gzip
Request Entity
Denied Reason User-Agent claimed to be Googlebot, claim appears to be false.
Explanation An invalid request was received. You claimed to be a major search engine, but you do not appear to actually be a major search engine.
Response 403
_______________________________
Can you advise on this? I’m keen to get bb working again with my drupal instal, having had good results with it a year ago.
Comment #28
singpolyma commentedCan someone post the patched module for BB2 and Drupal5
Comment #29
pears447 commentedI would also very much appreciate a complete zip file for BB2 on Drupal 5. I have a site that I am trying to get live in a few days, and would like to include this module...
Many thanks.
Comment #30
juerg commentedI have uploaded a patched module, see here: http://drupal.org/node/172552
Please make sure you follow the installing instructions given in the above node and in the README-Drupal.txt
Comment #31
willfe commentedJust an FYI to anyone having trouble getting this thing to create the "new" table structure when upgrading an existing Drupal 4.x site to Drupal 5.x and trying to use the new (patched) BB2 module in their site: you need to *drop* the old bad_behavior_log table entirely (or at least rename it if you want to retain the logs stored in it) before you even *try* to set up the new module.
The module doesn't follow the "Drupal way" of performing an upgrade; it presumes it's a new installation and makes a couple little gaffes when that's not the case. Specifically, the module doesn't use Drupal's database schema upgrade handling -- it just tells Drupal it's using "schema version 0" and never changes that. It also doesn't try to migrate the old table to the new one -- the only place where a "CREATE TABLE bleh bleh..." is attempted is on the settings page for the "Bad behavior" module, and that only happens when you *save* settings. Also, the "CREATE TABLE" blurb is written as "CREATE TABLE IF NOT EXISTS" (which is fine/safe) but also only happens if the module hasn't already stored a configuration variable that says "yes, I've already (tried to) create the table!"
In effect, if you don't remove the old table before your first attempt to install the module, it never again tries to create the new table even if you delete it after installation. First, I intend to snag the module and fix this (it shouldn't be *too* painful -- at worst, it needs to rename the table and create the new one automatically during installation; at best, it can do ALTER TABLE commands and try to migrate the old data -- either way this needs to be done in badbehavior.install, which doesn't exist right now), but second (and more importantly), here's how to fix this problem if you bump into it :) :
These instructions assume you've gotten a 4.x site upgraded to 5.x, and you've tried to install the Bad Behavior module, and it's wedged (can't log stuff and can't show the log) because it thinks it's created the new table but really hasn't. You'll need access to your databases; I show MySQL client commands here, but you can also do this trickery via PHPMyAdmin or similar if you haven't got a client (or aren't comfortable with command-line stuff).
- or -
If your site is getting *any* kind of traffic at all, you should immediately begin seeing entries turning up in the log (site admin -> "Bad behavior" (under "Logs" this time)).
Comment #32
wilco commentedPlease use and download the D5 latest release.
This issue is now closed.