diff --git a/lib/classes/module/console/taskrun.class.php b/lib/classes/module/console/taskrun.class.php index b52d1c8093..8554042bc9 100644 --- a/lib/classes/module/console/taskrun.class.php +++ b/lib/classes/module/console/taskrun.class.php @@ -145,7 +145,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..9cfce19a53 100755 --- a/lib/classes/task/Scheduler.class.php +++ b/lib/classes/task/Scheduler.class.php @@ -54,6 +54,7 @@ class task_Scheduler */ public function run() { + $appbox = appbox::get_instance(\bootstrap::getCore()); $registry = $appbox->get_registry(); @@ -71,6 +72,9 @@ class task_Scheduler } if (function_exists('pcntl_fork')) { + // avoid php when a task ends + pcntl_signal(SIGCHLD, SIG_IGN); + $this->method = self::METHOD_FORK; } diff --git a/lib/classes/task/period/cindexer.class.php b/lib/classes/task/period/cindexer.class.php index f6ea98a7de..2a4d13f512 100755 --- a/lib/classes/task/period/cindexer.class.php +++ b/lib/classes/task/period/cindexer.class.php @@ -187,7 +187,6 @@ class task_period_cindexer extends task_abstract parent.calccmd(); cmd password) { $args[] = '-p=' . $this->password; - $args_nopwd[] = '-p=******'; + $args_nopwd[] = '-p=xxxxxxx'; } if ($this->socket) { $args[] = '--socket=' . $this->socket; $args_nopwd[] = '--socket=' . $this->socket; } - if ($this->use_sbas) { - $args[] = '-o'; - $args_nopwd[] = '-o'; - } + $args[] = '-o'; + $args_nopwd[] = '-o'; if ($this->charset) { $args[] = '--default-character-set=' . $this->charset; $args_nopwd[] = '--default-character-set=' . $this->charset; @@ -460,9 +454,18 @@ class task_period_cindexer extends task_abstract $pipes = array(); - $this->log(sprintf('cmd=\'%s %s\'', $cmd, implode(' ', $args_nopwd))); + $logcmd = $cmd; + foreach ($args_nopwd as $arg) { + $logcmd .= ' ' . escapeshellarg($arg); + } - $process = proc_open($cmd . ' ' . implode(' ', $args), $descriptors, $pipes, $this->binpath, null, array('bypass_shell' => true)); + $this->log(sprintf('cmd=\'%s\'', escapeshellcmd($logcmd))); + + $execmd = $cmd; + foreach ($args as $arg) { + $execmd .= ' ' . escapeshellarg($arg); + } + $process = proc_open(escapeshellcmd($execmd), $descriptors, $pipes, $this->binpath, null, array('bypass_shell' => true)); $pid = NULL; if (is_resource($process)) {