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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rkdesantos’s picture

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.

steko’s picture

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.

Jeremy’s picture

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.

rkdesantos’s picture

Version: 5.x-3.0-alpha5 » 5.x-3.0-alpha6

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

Jeremy’s picture

Status: Active » Closed (works as designed)

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

thePanz’s picture

Assigned: Unassigned » thePanz
Category: bug » support
Status: Closed (works as designed) » 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

Jeremy’s picture

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.

rkdesantos’s picture

Still following and would still like to see this resolved.

thePanz’s picture

Project: Spam » TrackBack
Version: 5.x-3.0-alpha6 » 6.x-1.x-dev
Component: Code » Other
Category: support » feature
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

rkdesantos’s picture

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

rkdesantos’s picture

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.

thePanz’s picture

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

rkdesantos’s picture

FileSize
3.7 KB

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.

gnassar’s picture

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.

gnassar’s picture

...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.

henmue’s picture

Hi everybody! I just checked the Spam and trackback modules, and both are now Drupal 6-compatible. I really need a working solution against trackback spam, so I had a look into the code.

I tried to combine the latest patch from this thread (http://drupal.org/node/281686#comment-1586730) with the current Trackback (6.x-1.2) and Spam (6.x-1.0). That did not work. It seems that the Spam module has evolved so much that the old trackback integration does not work anymore.

So, I would be willing to work on the code, but right now I'm a little bit clueless how to start. I ha dnot worked much with Drupal lately and there seems to be no real documentation of both the Spam API and the Trackback spam module integration. And to understand the whole thing by reading code and database schemes is very time-consuming.

Any ideas or hints how to progress from here?

Regards Henry

jockox3’s picture

Following - as I've never managed to get Trackback working successfully on my site and am getting these errors.

Noccy42’s picture

FileSize
1.44 KB

if your using Drupal 6.x and trackback 6.x-1.2 (other versions will probably work), try replacing the tracback.spam.inc file in the trackback module with the one I have attached bellow.

I have no idea how functional it is, neither modules api seems to be documented so it's pretty much just shooting in the dark, but it works for me with the limited testing I have done.

proindustries’s picture

Just dropped that into place, didn't help much. Going to look closer over the next day or so, hopefully will have a soln.

John

proindustries’s picture

Correction - after leaving the site alone for a few days, I returned to find it blocking trackback spam just fine. Guessing I forgot to clear the cache after applying the patch...so the patch looks good to me!

John

ij’s picture

Any progress for this issue?

thePanz’s picture

@ij: I'm planning a new rewrite of Trackback module as I commented here #351533-10: Split out a Pingback API module (Was: More Efficient Display of Pingbacks).
If you'd like to help or have any idea to share... you're welcome! :) I don't have much time right now, but I'm open to sponsorships or paid customizations.

Regards

mcurry’s picture

*subscribe*