diff options
author | Brice Maron <brice@bmaron.net> | 2012-06-14 21:00:02 +0000 |
---|---|---|
committer | Brice Maron <brice@bmaron.net> | 2012-06-14 21:00:02 +0000 |
commit | 6da5a2fdd4e8a19ab993b4a1f7de7e45b8922a16 (patch) | |
tree | d98a0cf88baf7a1b2f5329090a60b575dcdf3e83 /lib/app.php | |
parent | dd98afc56c4356a06fb5afef39da916a97bae90b (diff) | |
download | nextcloud-server-6da5a2fdd4e8a19ab993b4a1f7de7e45b8922a16.tar.gz nextcloud-server-6da5a2fdd4e8a19ab993b4a1f7de7e45b8922a16.zip |
Add possibility to choose the installation folder
Diffstat (limited to 'lib/app.php')
-rwxr-xr-x | lib/app.php | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/lib/app.php b/lib/app.php index 79a0a2e0534..ca7a022f893 100755 --- a/lib/app.php +++ b/lib/app.php @@ -323,16 +323,38 @@ class OC_App{ } /** + * Get the path where to install apps + */ + public static function getInstallPath() { + if(OC_Config::getValue('appstoreenabled', true)==false) { + return false; + } + + foreach(OC::$APPSROOTS as $dir) { + if(isset($dir['writable']) && $dir['writable']===true) + return $dir['path']; + } + + OC_Log::write('core','No application directories are marked as writable.',OC_Log::ERROR); + return null; + } + + + protected static function findAppInDirectories($appid) { + foreach(OC::$APPSROOTS as $dir) { + if(file_exists($dir['path'].'/'.$appid)) { + return $dir; + } + } + } + /** * Get the directory for the given app. * If the app is defined in multiple directory, the first one is taken. (false if not found) */ public static function getAppPath($appid) { - foreach(OC::$APPSROOTS as $dir) { - if(file_exists($dir['path'].'/'.$appid)) { - return $dir['path'].'/'.$appid; - } + if( ($dir = self::findAppInDirectories($appid)) != false) { + return $dir['path'].'/'.$appid; } - return false; } /** @@ -340,12 +362,9 @@ class OC_App{ * If the app is defined in multiple directory, the first one is taken. (false if not found) */ public static function getAppWebPath($appid) { - foreach(OC::$APPSROOTS as $dir) { - if(file_exists($dir['path'].'/'.$appid)) { - return $dir['url'].'/'.$appid; - } + if( ($dir = self::findAppInDirectories($appid)) != false) { + return $dir['url'].'/'.$appid; } - return false; } /** |