setDescription('Pause scheduler started tasks jobs'); } protected function doExecute(InputInterface $input, OutputInterface $output) { if (false === $this->container['phraseanet.configuration']['main']['task-manager']['enabled']) { throw new RuntimeException('The use of the task manager is disabled on this instance.'); } $ret = 0; $this->container['task-manager.status']->stop(); $output->writeln("Task manager configuration has been toggled on stop"); $info = $this->container['task-manager.live-information']->getManager(); if (TaskManagerStatus::STATUS_STARTED !== $info['actual']) { $output->writeln(sprintf('Be careful, task manager status is %s.', $info['actual'])); $ret = 1; } else { $output->writeln('Task manager is currently running, all tasks are currently paused as of this operation.'); } return $ret; } }