summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRobin McCorkell <rmccorkell@karoshi.org.uk>2015-01-09 13:13:02 +0000
committerRobin McCorkell <rmccorkell@karoshi.org.uk>2015-01-09 13:18:00 +0000
commitc29138311614cba8bc4699a0afa485aefe621b6b (patch)
tree292371ba732ad9ba6438f1c3c58e067b0d452e01 /lib
parent17dd5d0816e500d0818a07bc9ca72b52abce40b3 (diff)
downloadnextcloud-server-c29138311614cba8bc4699a0afa485aefe621b6b.tar.gz
nextcloud-server-c29138311614cba8bc4699a0afa485aefe621b6b.zip
Memcache binary executable searching
It's slow, this makes it fast!
Diffstat (limited to 'lib')
-rw-r--r--lib/private/helper.php10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/private/helper.php b/lib/private/helper.php
index 8e9b7d3b6f3..86cc0850bc3 100644
--- a/lib/private/helper.php
+++ b/lib/private/helper.php
@@ -882,13 +882,19 @@ class OC_Helper {
* @return null|string
*/
public static function findBinaryPath($program) {
+ $memcache = \OC::$server->getMemCacheFactory()->create('findBinaryPath');
+ if ($memcache->hasKey($program)) {
+ return $memcache->get($program);
+ }
+ $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) {
- return escapeshellcmd($output[0]);
+ $result = escapeshellcmd($output[0]);
}
}
- return null;
+ $memcache->set($program, $result, 3600);
+ return $result;
}
/**