Author: tkoomzaaskz
Date: 2010-09-07 00:50:46 +0200 (Tue, 07 Sep 2010)
New Revision: 30841

Modified:
   
plugins/sfTaskLoggerPlugin/branches/1.2/lib/task/sfTaskLoggerPurgeRunningTask.class.php
Log:
[task logger] logging comments in doctrine purge

Modified: 
plugins/sfTaskLoggerPlugin/branches/1.2/lib/task/sfTaskLoggerPurgeRunningTask.class.php
===================================================================
--- 
plugins/sfTaskLoggerPlugin/branches/1.2/lib/task/sfTaskLoggerPurgeRunningTask.class.php
     2010-09-06 14:12:12 UTC (rev 30840)
+++ 
plugins/sfTaskLoggerPlugin/branches/1.2/lib/task/sfTaskLoggerPurgeRunningTask.class.php
     2010-09-06 22:50:46 UTC (rev 30841)
@@ -58,7 +58,6 @@
       $purge_count = $this->purge($this->opts['task']);
       $this->task->setCountProcessed($purge_count);
       $this->printAndLog('>  '. $purge_count. ' record(s) updated.');
-      $this->task->setComments($this->task->getComments().'Purged by 
task-logger:purge on '.date('Y-m-d').'.');
       $this->task->setErrorCode(self::ERROR_CODE_SUCCESS);
       $this->setOk();
     }
@@ -85,13 +84,25 @@
   protected function purgeDoctrine($task)
   {
     $q = Doctrine_Query::create()
-      ->update('tlTask tt')
-      ->set('tt.is_running', 0)
+      ->from('tlTask tt')
       ->where('tt.task = ?', $task)
       ->andWhere('tt.is_running = ?', 1)
+      ->andWhere('tt.id != ?', $this->task->getId())
     ;
 
-    return $q->execute();
+    $results = $q->execute();
+    foreach($results as $task) {
+      $task->setIsRunning(0);
+      $task->setComments(
+        $task->getComments() .
+        ' Purged by task-logger:purge [task id: ' .
+        $this->task->getId() .
+        '] on ' . date('Y-m-d') . '.'
+      );
+      $task->save();
+    }
+
+    return $results->count();
   }
 
   /**

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-svn?hl=en.

Reply via email to