mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-13 13:03:20 +00:00
-
This commit is contained in:
@@ -29,6 +29,20 @@ class module_console_schedulerStart extends Command
|
||||
parent::__construct($name);
|
||||
|
||||
$this->setDescription('Start the scheduler');
|
||||
$this->addOption(
|
||||
'nolog'
|
||||
, NULL
|
||||
, 1 | InputOption::VALUE_NONE
|
||||
, 'do not log (scheduler) to logfile'
|
||||
, NULL
|
||||
);
|
||||
$this->addOption(
|
||||
'notasklog'
|
||||
, NULL
|
||||
, 1 | InputOption::VALUE_NONE
|
||||
, 'do not log (tasks) to logfiles'
|
||||
, NULL
|
||||
);
|
||||
$this->setHelp(
|
||||
"You should use launch the command and finish it with `&`"
|
||||
. " to return to the console\n\n"
|
||||
@@ -38,7 +52,7 @@ class module_console_schedulerStart extends Command
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function execute(InputInterface $input, OutputInterface $output)
|
||||
public function execute(InputInterface $zinput, OutputInterface $output)
|
||||
{
|
||||
if(!setup::is_installed())
|
||||
{
|
||||
@@ -48,7 +62,7 @@ class module_console_schedulerStart extends Command
|
||||
require_once dirname(__FILE__) . '/../../../../lib/bootstrap.php';
|
||||
|
||||
$scheduler = new task_Scheduler();
|
||||
$scheduler->run($output, true);
|
||||
$scheduler->run($zinput, $output); //, !$input->getOption('nolog'), !$input->getOption('notasklog'));
|
||||
|
||||
return;
|
||||
}
|
||||
|
@@ -43,10 +43,27 @@ class module_console_taskrun extends Command
|
||||
, 'The name of the runner (manual, scheduler...)'
|
||||
, task_abstract::RUNNER_MANUAL
|
||||
);
|
||||
$this->addOption(
|
||||
'nolog'
|
||||
, NULL
|
||||
, 1 | InputOption::VALUE_NONE
|
||||
, 'do not log to logfile'
|
||||
, NULL
|
||||
);
|
||||
$this->setDescription('Run task');
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
function sig_handler($signo)
|
||||
{
|
||||
if($this->task)
|
||||
{
|
||||
$this->task->log(sprintf("signal %s received", $signo));
|
||||
if($signo == SIGTERM)
|
||||
$this->task->set_running(false);
|
||||
}
|
||||
}
|
||||
|
||||
public function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
@@ -81,9 +98,12 @@ class module_console_taskrun extends Command
|
||||
|
||||
register_tick_function(array($this, 'tick_handler'), true);
|
||||
declare(ticks=1);
|
||||
pcntl_signal(SIGTERM, array($this, 'sig_handler'));
|
||||
|
||||
$this->task->run($runner, $input, $output);
|
||||
|
||||
$this->task->log(sprintf("%s [%d] taskrun : returned from 'run()', get_status()=%s \n", __FILE__, __LINE__, $this->task->get_status()));
|
||||
|
||||
$this->task->run($runner);
|
||||
printf("TASK QUIT\n");
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user