Merge with 3.7

This commit is contained in:
Romain Neutron
2012-10-04 12:49:01 +02:00
48 changed files with 353 additions and 89 deletions

View File

@@ -900,4 +900,18 @@ 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

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