summaryrefslogtreecommitdiffstats
path: root/lib/private/helper.php
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2015-04-02 18:54:03 +0200
committerLukas Reschke <lukas@owncloud.com>2015-04-02 18:54:03 +0200
commitfa079a5959f1c67b1b6bd7b9d4aa98763b817394 (patch)
treebe2680736fceb5b66e42536cf7d3c408aeaa1640 /lib/private/helper.php
parent9f58097e4dc6fce20ba8995a9f82951d4dc3a80e (diff)
parent0f01de9f7e3a17afa769680f25f73ddef15b1ec0 (diff)
downloadnextcloud-server-fa079a5959f1c67b1b6bd7b9d4aa98763b817394.tar.gz
nextcloud-server-fa079a5959f1c67b1b6bd7b9d4aa98763b817394.zip
Merge pull request #12314 from oparoz/patch-3
Make findBinaryPath compatible with open_basedir
Diffstat (limited to 'lib/private/helper.php')
-rw-r--r--lib/private/helper.php29
1 files changed, 18 insertions, 11 deletions
diff --git a/lib/private/helper.php b/lib/private/helper.php
index 9d7e86658b6..c5fcd27f2b7 100644
--- a/lib/private/helper.php
+++ b/lib/private/helper.php
@@ -2,29 +2,28 @@
/**
* @author Arthur Schiwon <blizzz@owncloud.com>
* @author Bart Visscher <bartv@thisnet.nl>
- * @author Björn Schießle <schiessle@owncloud.com>
- * @author Christopher Schäpers <kondou@ts.unde.re>
+ * @author Björn Schießle <schiessle@owncloud.com>
+ * @author Christopher Schäpers <kondou@ts.unde.re>
* @author Fabian Henze <flyser42@gmx.de>
* @author Felix Moeller <mail@felixmoeller.de>
- * @author François Kubler <francois@kubler.org>
+ * @author François Kubler <francois@kubler.org>
* @author Frank Karlitschek <frank@owncloud.org>
* @author Georg Ehrke <georg@owncloud.com>
- * @author Georg Ehrke <georg@ownCloud.com>
* @author Jakob Sack <mail@jakobsack.de>
* @author Jan-Christoph Borchardt <hey@jancborchardt.net>
* @author Joas Schilling <nickvergessen@owncloud.com>
- * @author Jörn Friedrich Dreyer <jfd@butonic.de>
+ * @author Jörn Friedrich Dreyer <jfd@butonic.de>
* @author Lukas Reschke <lukas@owncloud.com>
* @author Michael Gapczynski <GapczynskiM@gmail.com>
* @author Morris Jobke <hey@morrisjobke.de>
- * @author Olivier Paroz <github@oparoz.com>
+ * @author Olivier Paroz <owncloud@interfasys.ch>
* @author Owen Winkler <a_github@midnightcircus.com>
* @author Pellaeon Lin <nfsmwlin@gmail.com>
* @author Robin Appelman <icewind@owncloud.com>
* @author Robin McCorkell <rmccorkell@karoshi.org.uk>
* @author Roeland Jago Douma <roeland@famdouma.nl>
- * @author Simon Könnecke <simonkoennecke@gmail.com>
- * @author Thomas Müller <thomas.mueller@tmit.eu>
+ * @author Simon Könnecke <simonkoennecke@gmail.com>
+ * @author Thomas Müller <thomas.mueller@tmit.eu>
* @author Thomas Tanghus <thomas@tanghus.net>
* @author Valerio Ponte <valerio.ponte@gmail.com>
* @author Vincent Petry <pvince81@owncloud.com>
@@ -45,6 +44,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
+use Symfony\Component\Process\ExecutableFinder;
/**
* Collection of useful functions
@@ -926,9 +926,16 @@ class OC_Helper {
}
$result = null;
if (!\OC_Util::runningOnWindows() && self::is_function_enabled('exec')) {
- exec('command -v ' . escapeshellarg($program) . ' 2> /dev/null', $output, $returnCode);
- if ($returnCode === 0 && count($output) > 0) {
- $result = escapeshellcmd($output[0]);
+ $exeSniffer = new ExecutableFinder();
+ // Returns null if nothing is found
+ $result = $exeSniffer->find($program);
+ if (empty($result)) {
+ $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]);
+ }
}
}
$memcache->set($program, $result, 3600);