You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by pa...@apache.org on 2004/09/09 03:13:54 UTC

svn commit: rev 43555 - in spamassassin/trunk/lib/Mail/SpamAssassin: . BayesStore

Author: parker
Date: Wed Sep  8 18:13:53 2004
New Revision: 43555

Modified:
   spamassassin/trunk/lib/Mail/SpamAssassin/Bayes.pm
   spamassassin/trunk/lib/Mail/SpamAssassin/BayesStore/SQL.pm
Log:
Bug 3760: tok_touch_all produces invalid sql when called with no tokens

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Bayes.pm
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Bayes.pm	(original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Bayes.pm	Wed Sep  8 18:13:53 2004
@@ -1267,9 +1267,6 @@
     dbg ("bayes token '$raw_token' => $pw");
   }
 
-  # we don't really care about the return value here
-  $self->{store}->tok_touch_all(\@touch_tokens, $msgatime);
-
   if (!@sorted || (REQUIRE_SIGNIFICANT_TOKENS_TO_SCORE > 0 && 
 	$#sorted <= REQUIRE_SIGNIFICANT_TOKENS_TO_SCORE))
   {
@@ -1287,6 +1284,11 @@
   goto skip unless defined $score;
 
   dbg ("bayes: score = $score");
+
+  # no need to call tok_touch_all unless there were significant
+  # tokens and a score was returned
+  # we don't really care about the return value here
+  $self->{store}->tok_touch_all(\@touch_tokens, $msgatime);
 
   $permsgstatus->{bayes_nspam} = $ns;
   $permsgstatus->{bayes_nham} = $nn;

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/BayesStore/SQL.pm
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/BayesStore/SQL.pm	(original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/BayesStore/SQL.pm	Wed Sep  8 18:13:53 2004
@@ -1084,6 +1084,8 @@
 
   return 0 unless (defined($self->{_dbh}));
 
+  return 1 unless (scalar(@{$tokens}));
+
   my $sql = "UPDATE bayes_token SET atime = ? WHERE id = ? AND token IN (";
 
   my @bindings = ($atime, $self->{_userid});