mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-09 19:13:26 +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'));
|
||||
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -39,7 +39,7 @@ class module_console_aboutLicense extends Command
|
||||
{
|
||||
$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->run($output, true);
|
||||
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -24,6 +24,7 @@ use Symfony\Component\Console\Command\Command;
|
||||
|
||||
class module_console_schedulerState extends Command
|
||||
{
|
||||
|
||||
public function __construct($name = null)
|
||||
{
|
||||
parent::__construct($name);
|
||||
@@ -35,28 +36,32 @@ class module_console_schedulerState extends Command
|
||||
|
||||
public function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
if(!setup::is_installed())
|
||||
if ( ! setup::is_installed())
|
||||
{
|
||||
throw new RuntimeException('Phraseanet is not set up');
|
||||
}
|
||||
|
||||
require_once dirname(__FILE__) . '/../../../../lib/bootstrap.php';
|
||||
|
||||
$appbox = appbox::get_instance();
|
||||
$appbox = appbox::get_instance();
|
||||
$task_manager = new task_manager($appbox);
|
||||
|
||||
$state = $task_manager->get_scheduler_state();
|
||||
|
||||
if ($state['schedstatus'] == 'started')
|
||||
{
|
||||
$output->writeln(sprintf(
|
||||
'Scheduler is %s on pid %d'
|
||||
, $state['schedstatus']
|
||||
, $state['schedpid']
|
||||
));
|
||||
'Scheduler is %s on pid %d'
|
||||
, $state['schedstatus']
|
||||
, $state['schedpid']
|
||||
));
|
||||
}
|
||||
else
|
||||
{
|
||||
$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);
|
||||
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -61,7 +61,7 @@ class module_console_systemBackupDB extends Command
|
||||
$this->dump_base($databox, $input, $output);
|
||||
}
|
||||
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected function dump_base(base $base, InputInterface $input, OutputInterface $output)
|
||||
|
@@ -93,7 +93,7 @@ class module_console_systemClearCache extends Command
|
||||
|
||||
$output->write('Finished !', true);
|
||||
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -82,7 +82,7 @@ class module_console_systemConfigCheck extends Command
|
||||
|
||||
$output->write('Finished !', true);
|
||||
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected function processConstraints(Setup_ConstraintsIterator $constraints, OutputInterface &$output)
|
||||
|
@@ -65,7 +65,7 @@ class module_console_systemMailCheck extends Command
|
||||
|
||||
$output->write('Finished !', true);
|
||||
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected function manage_group($email, $users, $output, $appbox)
|
||||
|
@@ -118,7 +118,7 @@ class module_console_systemTemplateGenerator extends Command
|
||||
|
||||
$output->writeln("");
|
||||
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -114,7 +114,7 @@ class module_console_systemUpgrade extends Command
|
||||
}
|
||||
$output->write('Finished !', true);
|
||||
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -37,34 +37,36 @@ class module_console_tasklist extends Command
|
||||
|
||||
public function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
if(!setup::is_installed())
|
||||
if ( ! setup::is_installed())
|
||||
{
|
||||
throw new RuntimeException('Phraseanet is not set up');
|
||||
}
|
||||
|
||||
require_once dirname(__FILE__) . '/../../../../lib/bootstrap.php';
|
||||
|
||||
$appbox = appbox::get_instance();
|
||||
$appbox = appbox::get_instance();
|
||||
$task_manager = new task_manager($appbox);
|
||||
$tasks = $task_manager->get_tasks();
|
||||
$tasks = $task_manager->get_tasks();
|
||||
|
||||
if(count($tasks) === 0)
|
||||
$output->writeln ('No tasks on your install !');
|
||||
if (count($tasks) === 0)
|
||||
{
|
||||
$output->writeln('No tasks detected');
|
||||
}
|
||||
|
||||
foreach($tasks as $task)
|
||||
foreach ($tasks as $task)
|
||||
{
|
||||
$this->print_task($task, $output);
|
||||
}
|
||||
|
||||
return $this;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -55,19 +55,24 @@ class module_console_taskrun extends Command
|
||||
$task_id = (int) $input->getArgument('task_id');
|
||||
|
||||
if ($task_id <= 0 || strlen($task_id) !== strlen($input->getArgument('task_id')))
|
||||
{
|
||||
throw new \RuntimeException('Argument must be an Id.');
|
||||
}
|
||||
|
||||
$appbox = appbox::get_instance();
|
||||
$task_manager = new task_manager($appbox);
|
||||
$task = $task_manager->get_task($task_id);
|
||||
|
||||
$runner = task_abstract::RUNNER_SCHEDULER;
|
||||
|
||||
if ($input->getOption('runner') === task_abstract::RUNNER_MANUAL)
|
||||
{
|
||||
$runner = task_abstract::RUNNER_MANUAL;
|
||||
}
|
||||
|
||||
$task->run($runner);
|
||||
|
||||
return $this;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user