Merge with 3.7

This commit is contained in:
Romain Neutron
2012-10-10 11:34:21 +02:00
30 changed files with 586 additions and 396 deletions

View File

@@ -53,7 +53,7 @@ class task_Scheduler
public function run()
{
//prevent scheduler to fail if GV_cli is not provided
if ( ! is_executable($this->dependencyContainer['phraseanet.registry']->get('GV_cli'))) {
if ( ! is_executable($this->dependencyContainer['phraseanet.registry']->get('php_binary'))) {
throw new \RuntimeException('PHP cli is not provided in registry');
}
@@ -214,7 +214,7 @@ class task_Scheduler
$taskPoll[$tkey] = array(
"task" => $task,
"current_status" => $status,
"cmd" => $this->dependencyContainer['phraseanet.registry']->get('GV_cli'),
"cmd" => $this->dependencyContainer['phraseanet.registry']->get('php_binary'),
"args" => array(
'-f',
$this->dependencyContainer['phraseanet.registry']->get('GV_RootPath') . 'bin/console',
@@ -325,7 +325,7 @@ class task_Scheduler
$descriptors[2] = array('file', $nullfile, 'a+');
$taskPoll[$tkey]["process"] = proc_open(
$taskPoll[$tkey]["cmd"] . ' ' . implode(' ', $taskPoll[$tkey]["args"])
escapeshellarg($taskPoll[$tkey]["cmd"]) . ' ' . implode(' ', array_map('escapeshellarg', $taskPoll[$tkey]["args"]))
, $descriptors
, $taskPoll[$tkey]["pipes"]
, $this->dependencyContainer['phraseanet.registry']->get('GV_RootPath') . "bin/"

View File

@@ -899,18 +899,4 @@ abstract class task_abstract
return $this;
}
/**
* Escape a shell command.
*
* As this function is buggy under windows, this method check the
* environment
*
* @param string $command
* @return string
*/
protected static function escapeShellCmd($command)
{
return defined('PHP_WINDOWS_VERSION_BUILD') ? escapeshellarg($command) : escapeshellcmd($command);
}
}

View File

@@ -472,17 +472,11 @@ class task_period_cindexer extends task_abstract
$pipes = array();
$logcmd = self::escapeShellCmd($cmd);
foreach ($args_nopwd as $arg) {
$logcmd .= ' ' . escapeshellarg($arg);
}
$logcmd = escapeshellarg($cmd).' '.implode(' ', array_map('escapeshellarg', $args_nopwd));
$execmd = escapeshellarg($cmd).' '.implode(' ', array_map('escapeshellarg', $args));
$this->log(sprintf('cmd=\'%s\'', self::escapeShellCmd($logcmd)));
$this->log(sprintf('cmd=\'%s\'', $logcmd));
$execmd = self::escapeShellCmd($cmd);
foreach ($args as $arg) {
$execmd .= ' ' . escapeshellarg($arg);
}
$process = proc_open($execmd, $descriptors, $pipes, $this->binpath, null, array('bypass_shell' => true));
$pid = NULL;