mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-11 20:13:28 +00:00
Add correct Exit status
This commit is contained in:
@@ -39,7 +39,7 @@ class module_console_aboutAuthors extends Command
|
|||||||
{
|
{
|
||||||
$output->writeln(file_get_contents(dirname(__FILE__) . '/../../../../AUTHORS'));
|
$output->writeln(file_get_contents(dirname(__FILE__) . '/../../../../AUTHORS'));
|
||||||
|
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -39,7 +39,7 @@ class module_console_aboutLicense extends Command
|
|||||||
{
|
{
|
||||||
$output->writeln(file_get_contents(dirname(__FILE__) . '/../../../../LICENSE'));
|
$output->writeln(file_get_contents(dirname(__FILE__) . '/../../../../LICENSE'));
|
||||||
|
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -50,7 +50,7 @@ class module_console_schedulerStart extends Command
|
|||||||
$scheduler = new task_Scheduler();
|
$scheduler = new task_Scheduler();
|
||||||
$scheduler->run($output, true);
|
$scheduler->run($output, true);
|
||||||
|
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -24,6 +24,7 @@ use Symfony\Component\Console\Command\Command;
|
|||||||
|
|
||||||
class module_console_schedulerState extends Command
|
class module_console_schedulerState extends Command
|
||||||
{
|
{
|
||||||
|
|
||||||
public function __construct($name = null)
|
public function __construct($name = null)
|
||||||
{
|
{
|
||||||
parent::__construct($name);
|
parent::__construct($name);
|
||||||
@@ -35,7 +36,7 @@ class module_console_schedulerState extends Command
|
|||||||
|
|
||||||
public function execute(InputInterface $input, OutputInterface $output)
|
public function execute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
if(!setup::is_installed())
|
if ( ! setup::is_installed())
|
||||||
{
|
{
|
||||||
throw new RuntimeException('Phraseanet is not set up');
|
throw new RuntimeException('Phraseanet is not set up');
|
||||||
}
|
}
|
||||||
@@ -48,15 +49,19 @@ class module_console_schedulerState extends Command
|
|||||||
$state = $task_manager->get_scheduler_state();
|
$state = $task_manager->get_scheduler_state();
|
||||||
|
|
||||||
if ($state['schedstatus'] == 'started')
|
if ($state['schedstatus'] == 'started')
|
||||||
|
{
|
||||||
$output->writeln(sprintf(
|
$output->writeln(sprintf(
|
||||||
'Scheduler is %s on pid %d'
|
'Scheduler is %s on pid %d'
|
||||||
, $state['schedstatus']
|
, $state['schedstatus']
|
||||||
, $state['schedpid']
|
, $state['schedpid']
|
||||||
));
|
));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
$output->writeln(sprintf('Scheduler is %s', $state['schedstatus']));
|
$output->writeln(sprintf('Scheduler is %s', $state['schedstatus']));
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -47,7 +47,7 @@ class module_console_schedulerStop extends Command
|
|||||||
|
|
||||||
$task_manager->set_sched_status(task_manager::STATUS_SCHED_TOSTOP);
|
$task_manager->set_sched_status(task_manager::STATUS_SCHED_TOSTOP);
|
||||||
|
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -61,7 +61,7 @@ class module_console_systemBackupDB extends Command
|
|||||||
$this->dump_base($databox, $input, $output);
|
$this->dump_base($databox, $input, $output);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function dump_base(base $base, InputInterface $input, OutputInterface $output)
|
protected function dump_base(base $base, InputInterface $input, OutputInterface $output)
|
||||||
|
@@ -93,7 +93,7 @@ class module_console_systemClearCache extends Command
|
|||||||
|
|
||||||
$output->write('Finished !', true);
|
$output->write('Finished !', true);
|
||||||
|
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -82,7 +82,7 @@ class module_console_systemConfigCheck extends Command
|
|||||||
|
|
||||||
$output->write('Finished !', true);
|
$output->write('Finished !', true);
|
||||||
|
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function processConstraints(Setup_ConstraintsIterator $constraints, OutputInterface &$output)
|
protected function processConstraints(Setup_ConstraintsIterator $constraints, OutputInterface &$output)
|
||||||
|
@@ -65,7 +65,7 @@ class module_console_systemMailCheck extends Command
|
|||||||
|
|
||||||
$output->write('Finished !', true);
|
$output->write('Finished !', true);
|
||||||
|
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function manage_group($email, $users, $output, $appbox)
|
protected function manage_group($email, $users, $output, $appbox)
|
||||||
|
@@ -118,7 +118,7 @@ class module_console_systemTemplateGenerator extends Command
|
|||||||
|
|
||||||
$output->writeln("");
|
$output->writeln("");
|
||||||
|
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -114,7 +114,7 @@ class module_console_systemUpgrade extends Command
|
|||||||
}
|
}
|
||||||
$output->write('Finished !', true);
|
$output->write('Finished !', true);
|
||||||
|
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -37,7 +37,7 @@ class module_console_tasklist extends Command
|
|||||||
|
|
||||||
public function execute(InputInterface $input, OutputInterface $output)
|
public function execute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
if(!setup::is_installed())
|
if ( ! setup::is_installed())
|
||||||
{
|
{
|
||||||
throw new RuntimeException('Phraseanet is not set up');
|
throw new RuntimeException('Phraseanet is not set up');
|
||||||
}
|
}
|
||||||
@@ -48,23 +48,25 @@ class module_console_tasklist extends Command
|
|||||||
$task_manager = new task_manager($appbox);
|
$task_manager = new task_manager($appbox);
|
||||||
$tasks = $task_manager->get_tasks();
|
$tasks = $task_manager->get_tasks();
|
||||||
|
|
||||||
if(count($tasks) === 0)
|
if (count($tasks) === 0)
|
||||||
$output->writeln ('No tasks on your install !');
|
{
|
||||||
|
$output->writeln('No tasks detected');
|
||||||
|
}
|
||||||
|
|
||||||
foreach($tasks as $task)
|
foreach ($tasks as $task)
|
||||||
{
|
{
|
||||||
$this->print_task($task, $output);
|
$this->print_task($task, $output);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected function print_task(task_abstract $task, OutputInterface &$output)
|
protected function print_task(task_abstract $task, OutputInterface &$output)
|
||||||
{
|
{
|
||||||
$message = $task->get_task_id()."\t".($task->get_status() )."\t".$task->get_title();
|
$message = $task->get_task_id() . "\t" . ($task->get_status() ) . "\t" . $task->get_title();
|
||||||
$output->writeln($message);
|
$output->writeln($message);
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -55,19 +55,24 @@ class module_console_taskrun extends Command
|
|||||||
$task_id = (int) $input->getArgument('task_id');
|
$task_id = (int) $input->getArgument('task_id');
|
||||||
|
|
||||||
if ($task_id <= 0 || strlen($task_id) !== strlen($input->getArgument('task_id')))
|
if ($task_id <= 0 || strlen($task_id) !== strlen($input->getArgument('task_id')))
|
||||||
|
{
|
||||||
throw new \RuntimeException('Argument must be an Id.');
|
throw new \RuntimeException('Argument must be an Id.');
|
||||||
|
}
|
||||||
|
|
||||||
$appbox = appbox::get_instance();
|
$appbox = appbox::get_instance();
|
||||||
$task_manager = new task_manager($appbox);
|
$task_manager = new task_manager($appbox);
|
||||||
$task = $task_manager->get_task($task_id);
|
$task = $task_manager->get_task($task_id);
|
||||||
|
|
||||||
$runner = task_abstract::RUNNER_SCHEDULER;
|
$runner = task_abstract::RUNNER_SCHEDULER;
|
||||||
|
|
||||||
if ($input->getOption('runner') === task_abstract::RUNNER_MANUAL)
|
if ($input->getOption('runner') === task_abstract::RUNNER_MANUAL)
|
||||||
|
{
|
||||||
$runner = task_abstract::RUNNER_MANUAL;
|
$runner = task_abstract::RUNNER_MANUAL;
|
||||||
|
}
|
||||||
|
|
||||||
$task->run($runner);
|
$task->run($runner);
|
||||||
|
|
||||||
return $this;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user