aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/helper.php
diff options
context:
space:
mode:
authorOlivier Paroz <github@oparoz.com>2015-03-02 22:15:07 +0100
committerOlivier Paroz <github@oparoz.com>2015-03-31 23:49:21 +0200
commit0f01de9f7e3a17afa769680f25f73ddef15b1ec0 (patch)
tree547c1610ce5243f482b9ac5512c521034a16352d /lib/private/helper.php
parent7c41c0c13f1a845fdcedd62218de490e8c01691b (diff)
downloadnextcloud-server-0f01de9f7e3a17afa769680f25f73ddef15b1ec0.tar.gz
nextcloud-server-0f01de9f7e3a17afa769680f25f73ddef15b1ec0.zip
Use getenv to get the paths for `find`
Diffstat (limited to 'lib/private/helper.php')
-rw-r--r--lib/private/helper.php7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/private/helper.php b/lib/private/helper.php
index 446a6199e2b..320cbb99618 100644
--- a/lib/private/helper.php
+++ b/lib/private/helper.php
@@ -925,9 +925,10 @@ class OC_Helper {
// Returns null if nothing is found
$result = $exeSniffer->find($program);
if (empty($result)) {
- // The order of the folders is important as we'll use the first command we find
- exec('find /usr/local/bin/ /usr/bin/ -name ' . escapeshellarg($program) . ' 2> /dev/null', $output, $returnCode);
- if ($returnCode === 0 && count($output) > 0) {
+ $paths = str_replace(':','/ ',getenv('PATH'));
+ $command = 'find ' . $paths . ' -name ' . escapeshellarg($program) . ' 2> /dev/null';
+ exec($command, $output, $returnCode);
+ if (count($output) > 0) {
$result = escapeshellcmd($output[0]);
}
}