Esempio n. 1
0
 public function getRunningTasks()
 {
     $running = array();
     $pattern = '|' . sprintf(preg_quote(self::PTRACK_PATH_TEMPLATE, '|'), "(?P<taskId>[^.]+)") . '|';
     foreach ($this->phpWrapper->glob(sprintf(self::PTRACK_PATH_TEMPLATE, '*')) as $socketPath) {
         $matches = array();
         if (preg_match($pattern, $socketPath, $matches) && isset($matches['taskId'])) {
             try {
                 $task = $this->getTaskStatus($matches['taskId']);
             } catch (\RuntimeException $ex) {
                 $this->log->exception($ex);
                 $this->phpWrapper->unlink($socketPath);
                 continue;
             }
             $running[$matches['taskId']] = $task;
         }
     }
     return $running;
 }