This commit is contained in:
Romain Neutron
2012-04-26 00:55:53 +02:00
parent edbfff226e
commit ade22295ad
631 changed files with 92375 additions and 101763 deletions

View File

@@ -25,54 +25,46 @@ use Symfony\Component\Console\Command\Command;
class module_console_schedulerState extends Command
{
public function __construct($name = null)
{
parent::__construct($name);
$this->setDescription('Get scheduler state');
return $this;
}
public function execute(InputInterface $input, OutputInterface $output)
{
if (!setup::is_installed())
public function __construct($name = null)
{
$output->writeln('Phraseanet is not set up');
parent::__construct($name);
return 1;
$this->setDescription('Get scheduler state');
return $this;
}
require_once __DIR__ . '/../../../../lib/bootstrap.php';
try
public function execute(InputInterface $input, OutputInterface $output)
{
$appbox = appbox::get_instance(\bootstrap::getCore());
$task_manager = new task_manager($appbox);
if ( ! setup::is_installed()) {
$output->writeln('Phraseanet is not set up');
$state = $task_manager->get_scheduler_state();
return 1;
}
if ($state['status'] == 'started')
{
$output->writeln(sprintf(
require_once __DIR__ . '/../../../../lib/bootstrap.php';
try {
$appbox = appbox::get_instance(\bootstrap::getCore());
$task_manager = new task_manager($appbox);
$state = $task_manager->get_scheduler_state();
if ($state['status'] == 'started') {
$output->writeln(sprintf(
'Scheduler is %s on pid %d'
, $state['schedstatus']
, $state['schedpid']
));
}
else
{
$output->writeln(sprintf('Scheduler is %s', $state['status']));
}
));
} else {
$output->writeln(sprintf('Scheduler is %s', $state['status']));
}
return 0;
return 0;
} catch (\Exception $e) {
return 1;
}
return 0;
}
catch(\Exception $e)
{
return 1;
}
return 0;
}
}