DataObjects/Core_enum.php
[Pman.Core] / Prune.php
index 0ad41df..0c94d7c 100644 (file)
--- a/Prune.php
+++ b/Prune.php
@@ -11,7 +11,7 @@ require_once 'Pman.php';
 class Pman_Core_Prune extends Pman
 {
     //put your code here
-    static $cli_desc = "COre Prune -- remove old event data (6 months is normally a good idea).";
+    static $cli_desc = "Core Prune -- remove old event data (6 months is normally a good idea).";
     static $cli_opts = array(
         'months' => array(
             'desc' => 'How many months',
@@ -37,19 +37,34 @@ class Pman_Core_Prune extends Pman
     function get($m="", $opts)
     {
         
+        // prune irrelivant stuff..
+       
+        
+        
         $this->prune((int)$opts['months']);
     }
     
     function prune($inM)
     {
         // 40 seconds ? to delete 100K records..
-        //DB_DataObject::debugLevel(1);
+       // DB_DataObject::debugLevel(1);
         $f = DB_DataObject::Factory('reader_article');
         $f->query("
             DELETE FROM Events where 
                   event_when < NOW() - INTERVAL {$inM} MONTH
                   LIMIT 100000
         ");
+        
+        // notificication events occur alot - so we should trash them more frequently..
+        $f = DB_DataObject::Factory('reader_article');
+        $f->query("
+            DELETE FROM Events where 
+                  event_when < NOW() - INTERVAL 1 MONTH
+                  AND
+                  action IN ('NOTIFY')
+                  LIMIT 100000
+        ");
+        
         // pruning is for our press project - so we do not clean up dependant tables at present..
         
         if (function_exists('posix_getpwuid')) {