]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/ActivitySpam/ActivitySpamPlugin.php
Localisation updates from http://translatewiki.net.
[quix0rs-gnu-social.git] / plugins / ActivitySpam / ActivitySpamPlugin.php
index a905e72ccaf34605c03a9bf7ac0b8a6b6c3c83c9..e9c481e3bc7487adb3f3f72e002165c5fd1e1bb5 100644 (file)
@@ -65,6 +65,11 @@ class ActivitySpamPlugin extends Plugin
 
         $this->hideSpam = common_config('activityspam', 'hidespam');
 
+        // Let DB_DataObject find Spam_score
+
+        common_config_set('db', 'class_location', 
+                          common_config('db', 'class_location') .':'.dirname(__FILE__));
+
         return true;
     }
 
@@ -180,7 +185,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 +257,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) {