3.x Spam module not compatible with trackback module

rkdesantos - July 12, 2008 - 05:25
Project:TrackBack
Version:6.x-1.x-dev
Component:Other
Category:feature request
Priority:normal
Assigned:thePanz
Status:active
Description

I'm getting the following errors in the log under "spam":

Unknown column 's.probability' in 'field list' query: SELECT tr.*, s.probability FROM trackback_received tr LEFT JOIN spam_tracker s ON s.source = 'trackback' AND tr.trid = s.id WHERE s.probability >= 70 ORDER BY created DESC LIMIT 0, 50 in /home/afana/public_html/drupal5/includes/database.mysql.inc on line 172.

I assume that some tables weren't created. Not clear to me if the problem is with this module or elsewhere since it ties to the trackback tables, too.

#1

rkdesantos - July 17, 2008 - 14:34

Also getting this apparently related error:

Unknown column 's.source' in 'on clause' query: SELECT COUNT(*) FROM trackback_received tr LEFT JOIN spam_tracker s ON s.source = 'trackback' AND tr.trid = s.id WHERE tr.status = 1  in /home/afana/public_html/drupal5/includes/database.mysql.inc on line 172.

#2

steko - July 23, 2008 - 13:53

Unknown column 'score' in 'field list' query: SELECT score FROM drupal_spam_tracker WHERE content_type = 'comment' AND content_id = 511 in /home/mhd-01/www.iosa.it/htdocs/www/includes/database.mysql.inc on line 172.

Similar problem here after last upgrade.

#3

Jeremy - July 25, 2008 - 00:54
Title:Spam module generating php errors» 3.x Spam module not compatible with trackback module

It looks like the trackback module has not been upgraded to support the 3.x version of the spam module. I'll leave this issue open here so people with this error find this issue. I also recommend someone file a bug against the trackback module, and include a link to that issue from here.

#4

rkdesantos - July 26, 2008 - 23:58
Version:5.x-3.0-alpha5» 5.x-3.0-alpha6

Issue opened in Trackback module queue: http://drupal.org/node/287620

#5

Jeremy - September 17, 2008 - 14:52
Status:active» by design

No further updates, and bug/feature request filed with appropriate module, closing.

#6

thePanz - December 9, 2008 - 18:12
Category:bug report» support request
Assigned to:Anonymous» thePanz
Status:by design» postponed (maintainer needs more info)

i'm in charge on TrackBack module. Jeremy: can you provide mor info about new Spam 3.x API changes?
Regards

#7

Jeremy - February 13, 2009 - 16:14

The entire module was re-written from the ground up. The best method of learning how to integrate is to review the files in the modules/ directory. In particular, review modules/spam_comment.inc which is probably the most like a trackback. The functions in that file need to be defined in the trackback module.

#8

rkdesantos - February 13, 2009 - 17:58

Still following and would still like to see this resolved.

#9

thePanz - February 13, 2009 - 19:53
Project:Spam» TrackBack
Version:5.x-3.0-alpha6» 6.x-1.x-dev
Component:Code» Other
Category:support request» feature request
Status:postponed (maintainer needs more info)» active

I'll give an eye to spam_comment.inc tomorrow.
I'll refer to 6.x version, 5.x will be backported.
Hope to have some alpha-testers for this integration!

(issue moved to TrackBack 6.x-1.x-dev)
Regards

#10

rkdesantos - February 17, 2009 - 02:16

I'll be happy to test the backport when available.

#11

rkdesantos - February 17, 2009 - 19:28

Did some work on this and apologies for not yet creating a patch as I've never done that before, but this should help everyone. These changes to the module for the 5.x version (1.64.2.24 2008/04/10 06:04:17) will get most of the errors fixed:

Compare: (<)\trackback\trackback.module_080410 (44133 bytes)
   with: (>)\trackback\trackback.module (44295 bytes)

183c183,184
<         db_query("DELETE FROM {spam_tracker} WHERE source='trackback' AND id=%d", $trackback->trid);
---
> // id to sid
>         db_query("DELETE FROM {spam_tracker} WHERE source='trackback' AND sid=%d", $trackback->trid);

357c358,359
<         db_query("DELETE FROM {spam_tracker} USING ({spam_tracker}, {trackback_received}) WHERE {spam_tracker}.source='trackback' AND {spam_tracker}.id={trackback_received}.trid AND {trackback_received}.nid=%d", $node->nid);
---
> //id to sid
>         db_query("DELETE FROM {spam_tracker} USING ({spam_tracker}, {trackback_received}) WHERE {spam_tracker}.source='trackback' AND {spam_tracker}.sid={trackback_received}.trid AND {trackback_received}.nid=%d", $node->nid);

574c576,577
<     $sql = 'SELECT tr.*, s.probability FROM {trackback_received} tr LEFT JOIN {spam_tracker} s ON s.source = \'trackback\' AND tr.trid = s.id WHERE '. ($type == 'spam' ? 's.probability >= '. $spam_threshold : 'tr.status = '. $status);
---
>         // s.probability to s.score, s.id to s.sid
>     $sql = 'SELECT tr.*, s.score FROM {trackback_received} tr LEFT JOIN {spam_tracker} s ON s.source = \'trackback\' AND tr.trid = s.sid WHERE '. ($type == 'spam' ? 's.score >= '. $spam_threshold : 'tr.status = '. $status);

637c640,641
<       $header[] = array('data' => t('Spam'), 'field' => 's.probability');
---
>     // s.probability to s.score
>       $header[] = array('data' => t('Spam'), 'field' => 's.score');

905,906c909,910
<
<   $p = db_fetch_object(db_query("SELECT probability FROM {spam_tracker} WHERE id = %d AND source = 'trackback'", $trackback->trid));
---
>     // probability to score, id to sid
>   $p = db_fetch_object(db_query("SELECT score FROM {spam_tracker} WHERE sid = %d AND source = 'trackback'", $trackback->trid));

1048c1052,1053
<   db_query("UPDATE {spam_tracker} SET probability=%d, timestamp=%d WHERE source='trackback' AND id=%d", $prob, time(), $tb->trid);
---
>       // probability to score, id to sid
>   db_query("UPDATE {spam_tracker} SET score=%d, timestamp=%d WHERE source='trackback' AND sid=%d", $prob, time(), $tb->trid);

You will also need to add the following back to the spam_tracker table:

  source varchar(64) NOT NULL default '', # node, comment, trackback, etc...
  KEY source (source),

This is obviously NOT the preferred way to resolve this but it does restore some functionality to the situation.

#12

thePanz - May 13, 2009 - 15:03
Status:active» postponed

AFAIK Spam module isn't D6 ready.. or I'm wrong? (setting Issue to Postponed fot this reason)
Could you please provide a standard Drupal patch for this issue?

Cheers

#13

rkdesantos - May 14, 2009 - 00:29

I gave it a go; the patch is against the Drupal 5 version. Someone else will need to do the database change. I hope the patch is close to what is required.

Yes, it appears the Spam D6 module is still in active development and hasn't stabilized yet but seems to be moving along.

AttachmentSize
trackback_spamfix.patch 3.7 KB

#14

gnassar - June 2, 2009 - 05:50
Status:postponed» active

Spam for D6 still has some bug fixes being ironed out, but AFAI understand it, the 3.0 API (which is what matters) is stable. That should be all that is necessary to develop integration.

Setting to active until we get a complete patch, preferably for the version originally stated.

#15

gnassar - June 2, 2009 - 05:59

...not that I'm unconcerned about the fact that the last CVS commit to Spam was four months ago. Just noting that it can probably be coded for at this point. And yes, it's a pain to go through the .inc files to get an idea of the API, but that makes its API just slightly worse documented than Views. I don't think Drupal modules have a good reputation for documenting their individual APIs anyway -- you go with what you have, sadly. So if this is going to be done, now's as good a time as any. And Trackback does need *some* sort of anti-spam solution, absolutely.

 
 

Drupal is a registered trademark of Dries Buytaert.