Changeset 47

Show
Ignore:
Timestamp:
21.11.2006 16:26:13 (2 years ago)
Author:
jorge
Message:

Fixed small bug.
Added parameter to allow updates to already stored hashes when there is a match, allowing for image name changes, content type, word information as well as score. (experimental)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/devel/FuzzyOcr/Config.pm

    r45 r47  
    324324        default => 'Safe', 
    325325        type => $Mail::SpamAssassin::Conf::CONF_TYPE_STRING 
     326        }); 
     327 
     328    push (@cmds, { 
     329        setting => 'focr_mysql_update_hash', 
     330        default => 0, 
     331        type => $Mail::SpamAssassin::Conf::CONF_TYPE_BOOL 
    326332        }); 
    327333 
  • trunk/devel/FuzzyOcr/Hashing.pm

    r46 r47  
    230230            my @data = $ddb->selectrow_array($sql); 
    231231            if (scalar(@data)>0) { 
    232                 debuglog("Hash already in $db.$table updating..."); 
    233                 $sql  = "update $db.$table set "; 
    234                 $sql .= "basic='$img',"   unless ($data[1] eq $img); 
    235                 $sql .= "fname='$fname'," unless ($data[2] eq $fname);  
    236                 $sql .= "ctype='$ctype'," unless ($data[3] eq $ctype);  
    237                 $sql .= "ftype='$ftype'," unless ($data[4] == $ftype); 
    238                 $sql .= "score='$score'," unless ($data[8] == $score); 
    239                 $sql .= "dinfo='$dinfo'," unless ($data[9] == $dinfo); 
    240                 $sql  =~ s/,$//; 
    241                 $sql .= " where $table.key='$key'"; 
    242                 debuglog($sql); 
    243                 $ddb->do($sql); 
     232                if ($conf->{focr_mysql_update_hash}) { 
     233                    debuglog("Hash already in $db.$table updating..."); 
     234                    $sql  = "update $db.$table set "; 
     235                    $sql .= "basic='$img',"   unless ($data[1] eq $img); 
     236                    $sql .= "fname='$fname'," unless ($data[2] eq $fname);  
     237                    $sql .= "ctype='$ctype'," unless ($data[3] eq $ctype);  
     238                    $sql .= "ftype='$ftype'," unless ($data[4] == $ftype); 
     239                    $sql .= "score='$score'," unless ($data[8] == $score); 
     240                    $sql .= "dinfo='$dinfo'," unless ($data[9] eq $dinfo); 
     241                    $sql  =~ s/,$//; 
     242                    $sql .= " where $table.key='$key'"; 
     243                    debuglog($sql); 
     244                    $ddb->do($sql); 
     245                } else { 
     246                    debuglog("Hash already in $db.$table skipping..."); 
     247                } 
    244248            } else { 
    245249                $sql =