Alex Trofimov 12 tahun lalu
induk
melakukan
9d4caa6a7a

+ 1 - 2
install/sql/system.sql

@@ -1167,8 +1167,7 @@ CREATE TABLE `sys_cron_jobs` (
 
 INSERT INTO `sys_cron_jobs` (`name`, `time`, `class`, `file`, `eval`) VALUES
 ('cmd', '0 0 * * *', 'BxDolCronCmd', 'inc/classes/BxDolCronCmd.php', ''),
-('notifies', '*/10 * * * *', 'BxDolCronNotifies', 'inc/classes/BxDolCronNotifies.php', ''),
-('video_comments', '* * * * *', 'BxDolCronVideoComments', 'flash/modules/video_comments/inc/classes/BxDolCronVideoComments.php', '');
+('notifies', '*/10 * * * *', 'BxDolCronNotifies', 'inc/classes/BxDolCronNotifies.php', '');
 
 -- --------------------------------------------------------
 

+ 22 - 0
modules/boonex/antispam/classes/BxAntispamCronPruning.php

@@ -0,0 +1,22 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ * 
+ * @defgroup    Antispam Antispam
+ * @ingroup     DolphinModules
+ *
+ * @{
+ */
+
+bx_import('BxDolCron');
+
+class BxAntispamCronPruning extends BxDolCron 
+{
+    function processing() 
+    {
+        BxDolService::call('bx_antispam', 'pruning');
+    }
+}
+
+/** @} */

+ 1 - 1
modules/boonex/antispam/classes/BxAntispamIP.php

@@ -111,7 +111,7 @@ class BxAntispamIP extends BxDol
 
     /**
      * Clean up expired entries
-     * TODO: add to cron
+     * @return number of affected rows
      */
     public function pruning () 
     {

+ 9 - 0
modules/boonex/antispam/classes/BxAntispamModule.php

@@ -222,6 +222,15 @@ class BxAntispamModule extends BxDolModule
         return $o->blockIp($mixedIP, $iExpirationInSec, $sComment);
     }
 
+    /**
+     * @see BxAntispamIP::pruning
+     */
+    function servicePruning()
+    {
+        $o = bx_instance('BxAntispamIP', array(), $this->_aModule);
+        return $o->pruning();
+    }
+
     protected function getErrorMessageIpBlocked () 
     {
         bx_import('BxDolLanguages');

+ 4 - 0
modules/boonex/antispam/install/sql/disable.sql

@@ -37,3 +37,7 @@ DELETE FROM `sys_alerts_handlers` WHERE `id` = @iHandler;
 
 DELETE FROM `sys_email_templates` WHERE `Module` = 'bx_antispam';
 
+-- cron
+
+DELETE FROM `sys_cron_jobs` WHERE `name` LIKE 'bx_antispam%';
+

+ 5 - 0
modules/boonex/antispam/install/sql/enable.sql

@@ -198,3 +198,8 @@ INSERT INTO `sys_alerts` (`unit`, `action`, `handler_id`) VALUES
 INSERT INTO `sys_email_templates` (`Module`, `NameSystem`, `Name`, `Subject`, `Body`) VALUES
 ('bx_antispam', '_bx_antispam_spam_report_name', 'bx_antispam_spam_report', '_bx_antispam_spam_report_subject', '_bx_antispam_spam_report_body');
 
+-- cron
+
+INSERT INTO `sys_cron_jobs` (`name`, `time`, `class`, `file`, `eval`) VALUES
+('bx_antispam_pruning', '0 0 * * *', 'BxAntispamCronPruning', 'modules/boonex/antispam/classes/BxAntispamCronPruning.php', '');
+

+ 1 - 1
periodic/cron.php

@@ -134,7 +134,7 @@ function runJob($aJob)
     }
 }
 
-$oDb = new BxDolDb();
+$oDb = BxDolDb::getInstance();
 $aJobs = $oDb->fromCache('sys_cron_jobs', 'getAll', 'SELECT * FROM `sys_cron_jobs`');
 
 $aDate = getdate(time());