DataObjects/Core_enum.php
[Pman.Core] / Notify.php
index 14fc01a..a35770a 100644 (file)
@@ -172,13 +172,14 @@ class Pman_Core_Notify extends Pman
      
         //DB_DataObject::debugLevel(1);
         $w = DB_DataObject::factory($this->table);
+        $total = 0;
         
         if (!empty($opts['old'])) {
             // show old and new...
             
             $w->orderBy('act_when DESC'); // latest first
             $w->limit($opts['limit']); // we can run 
-            
+            $total = min($w->count(), $opts['limit']);
         } else {   
             // standard
             
@@ -191,8 +192,8 @@ class Pman_Core_Notify extends Pman
             }
     
             $w->orderBy('act_when ASC'); // oldest first.
-            
-            $this->logecho("QUEUE is {$w->count()} only runing " . ((int) $opts['limit']));
+            $total = min($w->count(), $opts['limit']);
+            $this->logecho("QUEUE is {$w->count()} only running " . ((int) $opts['limit']));
             
             $w->limit($opts['limit']); // we can run 1000 ...
         }
@@ -207,10 +208,9 @@ class Pman_Core_Notify extends Pman
         $ar = array(); // $w->fetchAll();
         
         if (!empty($opts['list'])) {
-            if (empty($ar)) {
-                die("Nothing in Queue\n");
-            }
-            foreach($ar as $w) {
+            
+            
+            while ($w->fetch()) { 
                 $o = $w->object();
                 
                 
@@ -226,9 +226,10 @@ class Pman_Core_Notify extends Pman
         while (true) {
             if ($w->fetch()) {
                 $ar[] = clone($w);
+                $total--;
             }
             
-            $this->logecho("BATCH SIZE: ".  count($ar) );
+            $this->logecho("BATCH SIZE: ".  (count($ar) + $total) );
             
             if (empty($ar)) {
                 $this->logecho("COMPLETED MAIN QUEUE - running delated");