Closed (fixed)
Project:
Mollom
Version:
6.x-1.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
17 Feb 2010 at 01:48 UTC
Updated:
24 Apr 2014 at 17:13 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
dries commentedThere is an upgrade path so no forms should be left unprotected -- did you run update.php?
Comment #2
else commentedI run update.php but mollom doesn't recognize the guestbook, this night I got about 8 entries with spam
Comment #3
dries commentedGuestbook module will need to be updated to work with the latest version of the Mollom module. Best to create an issue in the guestbook module issue queue.
Comment #4
sunI'm the maintainer of Guestbook module, but I do not know of any integration with Mollom. Is it possible that some other kind of guestbook was meant here?
Comment #5
else commentedI'm using the last version from http://drupal.org/project/guestbook, and indeed there was integration with Mollom 1.10 but this integration is lost with the new version Mollom 1.11. I made a new issue under Guestbook module issue queue http://drupal.org/node/717040
Comment #6
sunAs far as I can see, the changes for Mollom module to support Guestbook module were never committed.
Since Mollom module now allows integration with any form, we can continue over in #717040: Mollom support
Comment #7
fax8 commented@Dries sure, I *obviously* run update.php .. Unfortunately it seems that mollom_update_6105() has a bug.. See below...
@sun This is not related to the Guestbook module but all modules whose forms were protected by mollom. This is *critical* as I've been able to reproduce and track down the bug (see below). Consequences of this bug are that *all* forms previously protected by mollom are left unprotected after db update to 6.x-1.11
The reason for this mess (it actually took me 2 hours to troubleshoot this one.. ) is a bad bug in mollom_update_6105() ...
After the mollom_form table creation, implemented in
For each protected form there is a call to mollom_form_save() which calls drupal_write_record() to add the form to be protected into mollom_form table.
Unfortunately there is a problem here: as the table has been just created the drupal_get_schema() call in drupal_write_record() will fail as the DB schema has been loaded before and cached.
This will result in leaving the mollom_form table empty as each insertion has failed. Consequence of this is that ALL forms will remain unprotected. This can really be a pain in the axx for big drupal sites using mollom as it could easily generate huge load of spam.
This bug is easily fixed by changing the db_create_table() code above to:
The call to drupal_get_schema('mollom_form', TRUE) will result in drupal recreating the schema for the mollom_form (and cache it) so that it subsequent calls to drupal_write_record() will succeed.
I would have liked to submit a patch for this.. unfortunately I'm not sure how to proceed..
Simply fixing mollom_update_6105() as suggested above won't work for already upgraded to 1.11 websites..
They'll be simply out of luck as the protected forms infos have been lost: not inserted in the mollom_form table and not anymore in the variables. (Thanks to variable_del() in mollom_update_6105())
Now, IMHO.. two questions arise:
- Has this upgrade path been ever tested? Looks no to me..
- Why the hell db_create_table doesn't add the newly created table schema to the cached one? (Or invalidate the cached one?)
p.s.: Can I work @ acquia/mollom now? ;-)
Comment #8
dave reidAgreed. I had this problem with an XML sitemap upgrade and had to manually refresh the schema. Patches for both D7 and D6 for review.
Comment #9
sunHm. Technically, update.php should already do this before executing any updates...?
Comment #10
dave reidIt doesn't. :( Ran into this same thing with an XML sitemap upgrade wanting to use drupal_write_record() after a change to a table.
Comment #11
sunI really wonder why the update worked for me then. :-/ But anyway, if this fixes the bug, we need to get it in asap.
Comment #12
dries commentedCommitted to CVS HEAD. I can try to roll a bugfix release tonight (in 12 hours or so).
Comment #13
dries commentedThanks fax8! Good debugging.
Comment #14
fax8 commentedAfter some thinking about this, I would say that this patches are kind of workarounds rather that fixes..
I would say that the bugged code is logically correct. The problem is that one would expect db_create_table() to invalidate/refresh cached schema and that subsequent calls to drupal_get_schema() would contain the newly created table.
I'm asking to modify db_create_table() to add a call to drupal_get_schema('table', TRUE) so that the cached table schema would be invalidated.
Please keep an eye on http://drupal.org/node/717902
Comment #15
sahuni commentedHello,
there is still the problem of guestbook not pretected with mollom new version 612
Comment #16
sun@sahuni: As mentioned earlier in this issue, Guestbook was never officially supported by Mollom module. Adding support for Mollom is being tackled in #717040: Mollom support currently.
Comment #17
sahuni commentedYes thanks
I added a patch from http://drupal.org/node/717040 in guestbook module and it's ok for current version