]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
always rw
authorEvan Prodromou <evan@status.net>
Mon, 19 Mar 2012 15:53:53 +0000 (11:53 -0400)
committerEvan Prodromou <evan@status.net>
Mon, 19 Mar 2012 15:53:53 +0000 (11:53 -0400)
ActivitySpamPlugin.php

index 5e13d3610f320440aa27e141a79e594b08f46b2a..fddad37028cb0d793433b59684c3b32ce707d02a 100644 (file)
@@ -257,10 +257,25 @@ class ActivitySpamPlugin extends Plugin
             return $score;
         }
 
-        $result = $this->filter->test($notice);
+        try {
+
+            $result = $this->filter->test($notice);
+
+            $score = Spam_score::saveNew($notice, $result);
+
+            $this->log(LOG_INFO, "Notice " . $notice->id . " has spam score " . $score->score);
 
-        $score = Spam_score::saveNew($notice, $result);
+        } 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;
+    }
 }