summaryrefslogtreecommitdiffstats
path: root/lib/private/helper.php
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2014-11-20 12:37:59 +0100
committerJoas Schilling <nickvergessen@gmx.de>2014-11-20 12:37:59 +0100
commit64421d76fdd8b718c3f0fccf94ba0028adc593b4 (patch)
tree421c49dbb2f8770d7a963d0fab0d1f4b8845d66b /lib/private/helper.php
parente32968cfcea295f21336c1cda0bbe8d7a107b1eb (diff)
downloadnextcloud-server-64421d76fdd8b718c3f0fccf94ba0028adc593b4.tar.gz
nextcloud-server-64421d76fdd8b718c3f0fccf94ba0028adc593b4.zip
Deduplicate function by moving it to the OC_Helper
Diffstat (limited to 'lib/private/helper.php')
-rw-r--r--lib/private/helper.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/private/helper.php b/lib/private/helper.php
index 5b1d31bfc59..be448b8ff9b 100644
--- a/lib/private/helper.php
+++ b/lib/private/helper.php
@@ -873,6 +873,23 @@ class OC_Helper {
}
/**
+ * Try to find a program
+ * Note: currently windows is not supported
+ *
+ * @param string $program
+ * @return null|string
+ */
+ public static function findBinaryPath($program) {
+ 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) {
+ return escapeshellcmd($output[0]);
+ }
+ }
+ return null;
+ }
+
+ /**
* Calculate the disc space for the given path
*
* @param string $path