You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by mm...@apache.org on 2009/09/16 17:41:02 UTC

svn commit: r815844 - in /spamassassin/trunk/lib/Mail/SpamAssassin: AutoWhitelist.pm DBBasedAddrList.pm Plugin/AWL.pm SQLBasedAddrList.pm

Author: mmartinec
Date: Wed Sep 16 15:41:01 2009
New Revision: 815844

URL: http://svn.apache.org/viewvc?rev=815844&view=rev
Log:
AWL: drop unused code for assessing signer reputation:
the extra load on SQL for dynamic queries is not worth it,
as the reputation changes very little after a while,
so it is cheaper to collect if offline from an AWL
database once in a while and prepare some scoring rules

Modified:
    spamassassin/trunk/lib/Mail/SpamAssassin/AutoWhitelist.pm
    spamassassin/trunk/lib/Mail/SpamAssassin/DBBasedAddrList.pm
    spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/AWL.pm
    spamassassin/trunk/lib/Mail/SpamAssassin/SQLBasedAddrList.pm

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/AutoWhitelist.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/AutoWhitelist.pm?rev=815844&r1=815843&r2=815844&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/AutoWhitelist.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/AutoWhitelist.pm Wed Sep 16 15:41:01 2009
@@ -164,23 +164,6 @@
 
 ###########################################################################
 
-=item $meanscore = awl->check_signer_reputation($addr, $signedby);
-
-This method will return a mean score of all messages signed by the
-given signing identity, or undef if no such entries exist.
-
-=cut
-
-sub check_signer_reputation {
-  my ($self, $addr, $signedby) = @_;
-
-  return undef if !defined $self->{checker};
-  return undef if !$self->{checker}->UNIVERSAL::can("get_signer_reputation");
-  return $self->{checker}->get_signer_reputation($addr, $signedby);
-}
-
-###########################################################################
-
 =item awl->count();
 
 This method will return the count of messages used in determining the

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/DBBasedAddrList.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/DBBasedAddrList.pm?rev=815844&r1=815843&r2=815844&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/DBBasedAddrList.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/DBBasedAddrList.pm Wed Sep 16 15:41:01 2009
@@ -130,13 +130,6 @@
 
 ###########################################################################
 
-sub get_signer_reputation {
-  my ($self, $addr, $signedby) = @_;
-  return undef;
-}
-
-###########################################################################
-
 sub add_score {
     my($self, $entry, $score) = @_;
 

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/AWL.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/AWL.pm?rev=815844&r1=815843&r2=815844&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/AWL.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/AWL.pm Wed Sep 16 15:41:01 2009
@@ -382,14 +382,6 @@
       my $delta = 0;
       my $signeravg;
 
-    ### commented out to avoid additional load on a SQL server for now;
-    ### the average score (reputation) is still there and is accessible offline
-    #
-    # if (defined $signedby) {
-    #   my $timer = $self->{main}->time_method("check_awl_reput");
-    #   $signeravg = $whitelist->check_signer_reputation($from, $signedby);
-    # }
-    
       dbg("auto-whitelist: AWL active, pre-score: %s, autolearn score: %s, ".
 	  "mean: %s%s, IP: %s, address: %s %s",
           $pms->{score}, $awlpoints,

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/SQLBasedAddrList.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/SQLBasedAddrList.pm?rev=815844&r1=815843&r2=815844&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/SQLBasedAddrList.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/SQLBasedAddrList.pm Wed Sep 16 15:41:01 2009
@@ -261,42 +261,6 @@
   return $entry;
 }
 
-=head2 get_signer_reputation
-
-=cut
-
-sub get_signer_reputation {
-  my ($self, $addr, $signedby) = @_;
-
-  my $signer_avg_score;
-  if ($self->{_with_awl_signer} && defined $signedby && $signedby ne '') {
-    my $sql = "SELECT sum(totscore), sum(count) FROM awl";
-    my @signedby = split(' ', lc $signedby);
-    if (@signedby == 1) {
-      $sql .= " WHERE signedby = ?";
-    } elsif (@signedby > 1) {
-      $sql .= " WHERE signedby IN (" . join(',', ('?') x @signedby) . ")";
-    }
-    my $sth = $self->{dbh}->prepare($sql);
-    my $rc = $sth->execute(@signedby);
-    if (!$rc) { # there was an error, but try to go on
-      my $err = $self->{dbh}->errstr;
-      dbg("auto-whitelist: sql-based get_signer_reputation: SQL error: $err");
-    }
-    else {
-      my $aryref = $sth->fetchrow_arrayref();
-      my($totscore,$totcount) = !defined($aryref) ? (0,0) : @$aryref;
-      if (defined $totcount && $totcount > 0) {
-        $signer_avg_score = $totscore/$totcount;
-        dbg("auto-whitelist: sql-based signer avg score %.3f",
-            $signer_avg_score);
-      }
-      $sth->finish();
-    }
-  }
-  return $signer_avg_score;
-}
-
 =head2 add_score
 
 public instance (\%) add_score (\% $entry, Integer $score)