For Drupal databases that have a prefix, bad behavior does not seem to work. I have "www_" as db prefix. Bad behavior module creates a table called "bad_behavior_log" instead of "www_bad_behavior_log". And the Reports->Bad behavior is always empty.

I applied the following patch on my site to make it work.

Comments

dave reid’s picture

dave reid’s picture

dave reid’s picture

Status: Needs review » Fixed

Committed to CVS. Thanks!
http://drupal.org/cvs?commit=310026

Status: Fixed » Closed (fixed)

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

abaddon’s picture

i think this might be related http://drupal.org/node/414362 for the "And the Reports->Bad behavior is always empty." part

iva2k’s picture

Version: 6.x-1.0-rc2 » 7.x-2.x-dev
Status: Closed (fixed) » Needs review
StatusFileSize
new562 bytes

The problem still persists in 7.x-2.x-dev.

All logs are written to 'bad_behavior_log' table, and prefixed table remains empty.

Reviewing the code in the library and module, it looks like patch #0 has no effect. Function bb2_db_escape() which is invoked for $settings['log_table'] meticulously strips the {} curly braces and they are not passed further down to db_query().

Here's a patch that fixes this problem.

Please review and commit.

It won't copy log entries from old incorrect table to the intended one. If needed, run this SQL directly on your database (change PREFIX_ to your actual prefix):

INSERT INTO `PREFIX_bad_behavior_log` SELECT * FROM `bad_behavior_log`; DROP `bad_behavior_log`
gregarios’s picture

Have you tried completely uninstalling it then reinstalling the newest -dev version?

iva2k’s picture

@greagarios
I tried 7.x-2.x-dev and that's where I found the design problem (note the {} stripping on table names in 7.x-2.x-dev that I discoverd as a culprit). It's been a while now (I posted the patch in January).

Do you mean by your question that there is new code in 7.x-2.x-dev that addresses the problem differently? If yes, I'd appreciate if you make a determination as a maintainer if my patch is of any value, as I'm not working on Drupal right now and won't have time for another few months.

gregarios’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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