if (!empty($notice)) {
- $score = Spam_score::staticGet('notice_id', $notice->id);
+ $score = $this->getScore($notice);
if (empty($score)) {
$this->debug("No score for notice " . $notice->id);
_m('Test notices against the Activity Spam service.'));
return true;
}
+
+ function getScore($notice)
+ {
+ $score = Spam_score::staticGet('notice_id', $notice->id);
+
+ if (!empty($score)) {
+ return $score;
+ }
+
+ $result = $this->filter->test($notice);
+
+ $score = Spam_score::saveNew($notice, $result);
+
+ return $score;
+ }
}