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-02-17 01:25:24 +0400
committerThomas Steur <thomas.steur@googlemail.com>2014-02-17 01:25:24 +0400
commit4bd49a734642d6f554191e87c0afb10b45a50a44 (patch)
tree96b8ed3fdc1abb771f105edb2e606b62ec28d07a /core/CliMulti.php
parent9ea9b0fd70651664c1aea3ebfc6ef52033b69586 (diff)
check whether the command ps is executable which is not the case if there is no access to proc/version, see http://forum.piwik.org/read.php?2,111608
Diffstat (limited to 'core/CliMulti.php')
-rw-r--r--core/CliMulti.php27
1 files changed, 21 insertions, 6 deletions
diff --git a/core/CliMulti.php b/core/CliMulti.php
index c24c307bd1..3239061661 100644
--- a/core/CliMulti.php
+++ b/core/CliMulti.php
@@ -194,16 +194,22 @@ class CliMulti {
return PHP_BINARY;
}
- $bin = shell_exec('which php');
+ $bin = '';
+
+ if (!empty($_SERVER['_']) && Common::isPhpCliMode()) {
+ $bin = $this->getPhpCommandIfValid($_SERVER['_']);
+ }
+
+ if (empty($bin) && !empty($_SERVER['argv'][0]) && Common::isPhpCliMode()) {
+ $bin = $this->getPhpCommandIfValid($_SERVER['argv'][0]);
+ }
if (empty($bin)) {
- $bin = shell_exec('which php5');
+ $bin = shell_exec('which php');
}
- if (empty($bin) && defined('PHP_BINDIR') && Common::isPhpCliMode() && !empty($_SERVER['_']) && is_executable($_SERVER['_'])) {
- if (0 === strpos($_SERVER['_'], PHP_BINDIR)) {
- $bin = $_SERVER['_'];
- }
+ if (empty($bin)) {
+ $bin = shell_exec('which php5');
}
if (!empty($bin)) {
@@ -252,4 +258,13 @@ class CliMulti {
return $url;
}
+
+ private function getPhpCommandIfValid($path)
+ {
+ if (!empty($path) && is_executable($path)) {
+ if (0 === strpos($path, PHP_BINDIR) && false === strpos($path, 'phpunit')) {
+ return $path;
+ }
+ }
+ }
}