From ab053fe2ca8bb2be76d6af0d313f38d89540d768 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Thu, 26 Apr 2012 11:59:54 -0400 Subject: [PATCH] Don't always make spam_score writeable --- plugins/ActivitySpam/ActivitySpamPlugin.php | 33 +-------------------- 1 file changed, 1 insertion(+), 32 deletions(-) diff --git a/plugins/ActivitySpam/ActivitySpamPlugin.php b/plugins/ActivitySpam/ActivitySpamPlugin.php index a905e72cca..70e2c13d61 100644 --- a/plugins/ActivitySpam/ActivitySpamPlugin.php +++ b/plugins/ActivitySpam/ActivitySpamPlugin.php @@ -180,7 +180,7 @@ class ActivitySpamPlugin extends Plugin if (!empty($notice)) { - $score = $this->getScore($notice); + $score = Spam_score::staticGet('notice_id', $notice->id); if (empty($score)) { $this->debug("No score for notice " . $notice->id); @@ -252,37 +252,6 @@ class ActivitySpamPlugin extends Plugin return true; } - function getScore($notice) - { - $score = Spam_score::staticGet('notice_id', $notice->id); - - if (!empty($score)) { - return $score; - } - - try { - - $result = $this->filter->test($notice); - - $score = Spam_score::saveNew($notice, $result); - - $this->log(LOG_INFO, "Notice " . $notice->id . " has spam score " . $score->score); - - } catch (Exception $e) { - // Log but continue - $this->log(LOG_ERR, $e->getMessage()); - $score = null; - } - - return $score; - } - - function onStartReadWriteTables(&$alwaysRW, &$rwdb) { - $alwaysRW[] = 'spam_score'; - return true; - } - - function onEndNoticeInScope($notice, $profile, &$bResult) { if ($this->hideSpam) {