mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-08 10:34:34 +00:00
45 lines
1.3 KiB
PHP
45 lines
1.3 KiB
PHP
<?php
|
|
|
|
/*
|
|
* This file is part of Phraseanet
|
|
*
|
|
* (c) 2005-2013 Alchemy
|
|
*
|
|
* For the full copyright and license information, please view the LICENSE
|
|
* file that was distributed with this source code.
|
|
*/
|
|
|
|
namespace Alchemy\Phrasea\Command\Task;
|
|
|
|
use Alchemy\Phrasea\Command\Command;
|
|
use Alchemy\Phrasea\TaskManager\TaskManagerStatus;
|
|
use Symfony\Component\Console\Input\InputInterface;
|
|
use Symfony\Component\Console\Output\OutputInterface;
|
|
|
|
class SchedulerStart extends Command
|
|
{
|
|
public function __construct()
|
|
{
|
|
parent::__construct('task-manager:scheduler:start');
|
|
$this->setDescription('Starts Task-Manager scheduler');
|
|
}
|
|
|
|
protected function doExecute(InputInterface $input, OutputInterface $output)
|
|
{
|
|
$ret = 0;
|
|
|
|
$this->container['task-manager.status']->start();
|
|
$output->writeln("Task manager configuration has been toggled on start.");
|
|
|
|
$info = $this->container['task-manager.live-information']->getManager();
|
|
if (TaskManagerStatus::STATUS_STARTED !== $info['actual']) {
|
|
$output->writeln(sprintf('Task manager is currently <error>%s</error>, please consider start it.', $info['actual']));
|
|
$ret = 1;
|
|
} else {
|
|
$output->writeln('Task manager is currently <info>running</info>.');
|
|
}
|
|
|
|
return $ret;
|
|
}
|
|
}
|