Merge pull request #15597 from oparoz/another-fallback-for-findbinarypath

Adding a final fallback for findBinaryPath
This commit is contained in:
Thomas Müller 2015-04-15 00:16:56 +02:00
commit 70480423ff
1 changed files with 6 additions and 1 deletions

View File

@ -931,7 +931,12 @@ class OC_Helper {
// Returns null if nothing is found // Returns null if nothing is found
$result = $exeSniffer->find($program); $result = $exeSniffer->find($program);
if (empty($result)) { if (empty($result)) {
$paths = str_replace(':','/ ',getenv('PATH')); $paths = getenv('PATH');
if (empty($paths)) {
$paths = '/usr/local/bin /usr/bin /opt/bin /bin';
} else {
$paths = str_replace(':',' ',getenv('PATH'));
}
$command = 'find ' . $paths . ' -name ' . escapeshellarg($program) . ' 2> /dev/null'; $command = 'find ' . $paths . ' -name ' . escapeshellarg($program) . ' 2> /dev/null';
exec($command, $output, $returnCode); exec($command, $output, $returnCode);
if (count($output) > 0) { if (count($output) > 0) {