DataObjects/Core_curr_rate.php
[Pman.Core] / Prune.php
index 9d1c103..e40a1f3 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',
@@ -46,23 +46,25 @@ class Pman_Core_Prune extends Pman
         //DB_DataObject::debugLevel(1);
         $f = DB_DataObject::Factory('reader_article');
         $f->query("
-            DELETE FROM reader_article where 
-                  fetched_dt < NOW() - INTERVAL {$inM} MONTH
-                  AND
-                  fetched
-                  AND
-                  views < 1
+            DELETE FROM Events where 
+                  event_when < NOW() - INTERVAL {$inM} MONTH
                   LIMIT 100000
         ");
         // pruning is for our press project - so we do not clean up dependant tables at present..
         
-        
+        if (function_exists('posix_getpwuid')) {
+            $uinfo = posix_getpwuid( posix_getuid () ); 
+         
+            $user = $uinfo['name'];
+        } else {
+            $user = getenv('USERNAME'); // windows.
+        }
         
         $ff = HTML_Flexyframework::get()->Pman;
         
         $y = date("Y");
         $m = date("m");
-        $rootDir = $ff['storedir'].'/rss';
+        $rootDir = $ff['storedir'].'/_events_/'.$user;
         
         $dirs = array_filter(glob($rootDir."/*"), 'is_dir');
         foreach($dirs as $d){