repository = $repository; $this->root = $root; $this->phpConf = $phpConf; $this->phpExec = $phpExec; } /** * {@inheritdoc} */ public function refresh() { return array_map(array($this, 'entityToTask'), $this->repository->findActiveTasks()); } public function entityToTask(TaskEntity $task) { $name = $task->getId() ; $arguments = array($this->phpExec); if ($this->phpConf) { $arguments[] = '-c'; $arguments[] = $this->phpConf; } $arguments[] = '-f'; $arguments[] = $this->root . '/bin/console'; $arguments[] = '--'; $arguments[] = '-q'; $arguments[] = 'task:run'; $arguments[] = $task->getId(); $arguments[] = '--listen-signal'; $arguments[] = '--max-duration'; $arguments[] = '1800'; $arguments[] = '--max-memory'; $arguments[] = 128 << 20; $builder = ProcessBuilder::create($arguments); $builder->setTimeout(0); return new Task($task, $name, $task->isSingleRun() ? 1 : INF, $builder->getProcess()); } }