Process/FixMysqlCharset.php
[Pman.Core] / Notify.php
index 097e975..58bd363 100644 (file)
@@ -231,6 +231,10 @@ class Pman_Core_Notify extends Pman
         $w->autoJoin();
         $total = $w->find();
         
+        if (empty($total)) {
+            $this->logecho("Nothing In Queue - DONE");
+            exit;
+        }
         
         
         if (!empty($opts['list'])) {
@@ -330,6 +334,8 @@ class Pman_Core_Notify extends Pman
     function isBlacklisted($email)
     {
         // return current server id..
+        $ff = HTML_FlexyFramework::get();
+        //$this->logecho("CHECK BLACKLISTED - {$email}");
         if (empty($ff->Core_Notify['servers'])) {
             return false;
         }
@@ -341,15 +347,21 @@ class Pman_Core_Notify extends Pman
         // get the domain..
         $ea = explode('@',$email);
         $dom = strtolower(array_pop($ea));
+        
+        //$this->logecho("CHECK BLACKLISTED DOM - {$dom}");
         if (!in_array($dom, $ff->Core_Notify['servers'][gethostname()]['blacklisted'] )) {
             return false;
         }
+        //$this->logecho("RETURN BLACKLISTED TRUE");
         return array_search(gethostname(),array_keys($ff->Core_Notify['servers']));
     }
     
     // this sequentially distributes requeued emails.. - to other servers. (can exclude current one if we have that flagged.)
-    function updateServer($w, $exclude = -1)
+    function updateServer($ww, $exclude = -1)
     {
+        $w = DB_DataObject::factory($ww->tableName());
+        $w->get($ww->id);
+        
         $ff = HTML_FlexyFramework::get();
         static $num = 0;
         if (empty($ff->Core_Notify['servers'])) {
@@ -363,7 +375,7 @@ class Pman_Core_Notify extends Pman
         $pp = clone($w);
         $w->server_id = $num;
                     
-        $w->act_when = $w->sqlValue('NOW + INTERVAL 1 MINUTE');
+        $w->act_when = $w->sqlValue('NOW() + INTERVAL 1 MINUTE');
         $w->update($pp);
         
          
@@ -565,7 +577,7 @@ class Pman_Core_Notify extends Pman
                     //fclose($p['pipes'][1]);
                     fclose($p['pipes'][0]);
                     fclose($p['pipes'][2]);
-                    $this->logecho("TERMINATING: ({$p['pid']}) " . $p['cmd'] . " : " . file_get_contents($p['out']));
+                    $this->logecho("TERMINATING: ({$p['pid']}) {$p['email']} " . $p['cmd'] . " : " . file_get_contents($p['out']));
                     @unlink($p['out']);
                     
                     // schedule again
@@ -597,7 +609,7 @@ class Pman_Core_Notify extends Pman
             //    $pool[] = $p;
             //    continue;
             //}
-            $this->logecho("ENDED: ({$p['pid']}) " .  $p['cmd'] . " : " . file_get_contents($p['out']) );
+            $this->logecho("ENDED: ({$p['pid']}) {$p['email']} " .  $p['cmd'] . " : " . file_get_contents($p['out']) );
             @unlink($p['out']);
             // at this point we could pop onto the queue the 
             $this->popQueueDomain($p['email']);
@@ -678,4 +690,4 @@ class Pman_Core_Notify extends Pman
     {
         echo date("Y-m-d H:i:s - ") . $str . "\n";
     }
-}
\ No newline at end of file
+}