]> source.dussan.org Git - nextcloud-server.git/commitdiff
Adding a final fallback for findBinaryPath
authorOlivier Paroz <github@oparoz.com>
Tue, 14 Apr 2015 12:06:58 +0000 (14:06 +0200)
committerOlivier Paroz <github@oparoz.com>
Tue, 14 Apr 2015 12:06:58 +0000 (14:06 +0200)
lib/private/helper.php

index cb95dd49bebb39cceb574c0cc5e5714482267641..11311d7c55f0411d74f92ab9293802bca61a74ef 100644 (file)
@@ -931,7 +931,12 @@ class OC_Helper {
                        // Returns null if nothing is found
                        $result = $exeSniffer->find($program);
                        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';
                                exec($command, $output, $returnCode);
                                if (count($output) > 0) {