Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Steur <thomas.steur@googlemail.com>2014-06-03 03:03:28 +0400
committerThomas Steur <thomas.steur@googlemail.com>2014-06-03 03:03:28 +0400
commit935c62aa0f698a2c19ce121bc7da79673d74447d (patch)
tree56c0486bc9d45f67c0444e696bbc3fa74ef8bf6a /core/CliMulti.php
parent1191256f25abfaf92b746151239c79ee84acb151 (diff)
refs #5007 try to find a non cgi and non fpm php binary
Diffstat (limited to 'core/CliMulti.php')
-rw-r--r--core/CliMulti.php25
1 files changed, 17 insertions, 8 deletions
diff --git a/core/CliMulti.php b/core/CliMulti.php
index 70218d5139..5b34faae25 100644
--- a/core/CliMulti.php
+++ b/core/CliMulti.php
@@ -206,7 +206,7 @@ class CliMulti {
private function findPhpBinary()
{
- if (defined('PHP_BINARY') && false === strpos(PHP_BINARY, 'fpm')) {
+ if (defined('PHP_BINARY') && $this->isValidPhpType(PHP_BINARY)) {
return PHP_BINARY;
}
@@ -220,17 +220,18 @@ class CliMulti {
$bin = $this->getPhpCommandIfValid($_SERVER['argv'][0]);
}
- if (empty($bin)) {
+ if (!$this->isValidPhpType($bin)) {
$bin = shell_exec('which php');
}
- if (empty($bin)) {
+ if (!$this->isValidPhpType($bin)) {
$bin = shell_exec('which php5');
}
- if (!empty($bin)) {
+ if ($this->isValidPhpType($bin)) {
return trim($bin);
}
+
return false;
}
@@ -238,10 +239,10 @@ class CliMulti {
{
$this->processes[] = new Process($cmdId);
- $url = $this->appendTestmodeParamToUrlIfNeeded($url);
- $query = UrlHelper::getQueryFromUrl($url, array('pid' => $cmdId));
+ $url = $this->appendTestmodeParamToUrlIfNeeded($url);
+ $query = UrlHelper::getQueryFromUrl($url, array('pid' => $cmdId));
$hostname = UrlHelper::getHostFromUrl($url);
- $command = $this->buildCommand($hostname, $query, $output->getPathToFile());
+ $command = $this->buildCommand($hostname, $query, $output->getPathToFile());
Log::debug($command);
shell_exec($command);
@@ -279,10 +280,18 @@ class CliMulti {
return $url;
}
+ private function isValidPhpType($path)
+ {
+ return !empty($path)
+ && false === strpos($path, 'fpm')
+ && false === strpos($path, 'cgi')
+ && false === strpos($path, 'phpunit');
+ }
+
private function getPhpCommandIfValid($path)
{
if (!empty($path) && is_executable($path)) {
- if (0 === strpos($path, PHP_BINDIR) && false === strpos($path, 'phpunit')) {
+ if (0 === strpos($path, PHP_BINDIR) && $this->isValidPhpType($path)) {
return $path;
}
}