[pLog-svn] r7245 - plog/branches/lifetype-1.2/class/dao

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Wed Sep 23 13:15:46 EDT 2020


Author: jondaley
Date: 2020-09-23 13:15:46 -0400 (Wed, 23 Sep 2020)
New Revision: 7245

Modified:
   plog/branches/lifetype-1.2/class/dao/bayesiantokens.class.php
Log:
since the moderate plugin modifies comments outside the security pipeline (because the moderate plugin doesn't block comments, but just changes their status) has run, we can end up with tokens getting marked incorrectly as nonspam, and then end up trying to set a token to a negative number of occurrences, which crashes the database.  It would probably be nicer to have the security pipeline run again if the moderate plugin has made any changes, but that is harder, and probably not worth it.

Modified: plog/branches/lifetype-1.2/class/dao/bayesiantokens.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/dao/bayesiantokens.class.php	2020-07-15 11:58:11 UTC (rev 7244)
+++ plog/branches/lifetype-1.2/class/dao/bayesiantokens.class.php	2020-09-23 17:15:46 UTC (rev 7245)
@@ -211,7 +211,11 @@
             {
                 $id = $tk->getId();
                 $spamOccurrences = $tk->getSpamOccurrences() + $spamAddition;
+                if($spamOccurrences < 0)
+                    $spamOccurrences = 0;
                 $nonSpamOccurrences = $tk->getNonSpamOccurrences() + $nonSpamAddition;
+                if($nonSpamOccurrences < 0)
+                    $nonSpamOccurrences = 0;
                 
                 if ($spamOccurrences == 0 && $nonSpamOccurrences == 0)
                 {



More information about the pLog-svn mailing list