diff --git a/lib/classes/module/console/taskrun.class.php b/lib/classes/module/console/taskrun.class.php index f52ee7621e..e00298a2fc 100644 --- a/lib/classes/module/console/taskrun.class.php +++ b/lib/classes/module/console/taskrun.class.php @@ -143,7 +143,7 @@ class module_console_taskrun extends Command if (time() - $start > 0) { if ($this->shedulerPID) { - if ( ! posix_kill($this->shedulerPID, 0)) { + if (function_exists('posix_kill') && !posix_kill($this->shedulerPID, 0)) { if (method_exists($this->task, 'signal')) { $this->task->signal('SIGNAL_SCHEDULER_DIED'); } else { diff --git a/lib/classes/task/Scheduler.class.php b/lib/classes/task/Scheduler.class.php index 8df09ae8be..e3da9688b2 100755 --- a/lib/classes/task/Scheduler.class.php +++ b/lib/classes/task/Scheduler.class.php @@ -54,6 +54,11 @@ class task_Scheduler */ public function run() { + if (function_exists('pcntl_signal')) { + // avoid php when a task ends + pcntl_signal(SIGCHLD, SIG_IGN); + } + $appbox = appbox::get_instance(\bootstrap::getCore()); $registry = $appbox->get_registry(); diff --git a/lib/classes/task/abstract.class.php b/lib/classes/task/abstract.class.php index 5608a0be68..5017a566e0 100755 --- a/lib/classes/task/abstract.class.php +++ b/lib/classes/task/abstract.class.php @@ -334,7 +334,7 @@ abstract class task_abstract abstract public function help(); - public function __construct($taskid, Logger $logger) + public function __construct($taskid, Logger $logger = NULL) { $this->logger = $logger; diff --git a/lib/classes/task/manager.class.php b/lib/classes/task/manager.class.php index 34518472b1..454ed7f92e 100755 --- a/lib/classes/task/manager.class.php +++ b/lib/classes/task/manager.class.php @@ -73,9 +73,9 @@ class task_manager $core = \bootstrap::getCore(); - if ( ! $logger) { - $logger = $core['monolog']; - } +// if ( ! $logger) { +// $logger = $core['monolog']; +// } $sql = "SELECT task2.* FROM task2 ORDER BY task_id ASC"; $stmt = $this->appbox->get_connection()->prepare($sql); @@ -113,9 +113,9 @@ class task_manager { $core = \bootstrap::getCore(); - if ( ! $logger) { - $logger = $core['monolog']; - } +// if ( ! $logger) { +// $logger = $core['monolog']; +// } $tasks = $this->getTasks(false, $logger);