aboutsummaryrefslogtreecommitdiffstats
path: root/lib/filesystem.php
diff options
context:
space:
mode:
authorBart Visscher <bartv@thisnet.nl>2012-05-04 17:04:11 +0200
committerBart Visscher <bartv@thisnet.nl>2012-05-04 17:04:11 +0200
commit1e471562268ff62c59708b724c22930bc1d01d95 (patch)
tree5b5125ec41e865fa009d51b4293042f6572067f4 /lib/filesystem.php
parent71f9b1968e3d4decc4395db2a1555a872cbb2820 (diff)
parent07ff1e723ae4fa3a0297b168ef2262e01a0a5e50 (diff)
downloadnextcloud-server-1e471562268ff62c59708b724c22930bc1d01d95.tar.gz
nextcloud-server-1e471562268ff62c59708b724c22930bc1d01d95.zip
Merge branch 'master' into tasks
Diffstat (limited to 'lib/filesystem.php')
-rw-r--r--lib/filesystem.php49
1 files changed, 49 insertions, 0 deletions
diff --git a/lib/filesystem.php b/lib/filesystem.php
index dc678fba74c..cac7e8648ef 100644
--- a/lib/filesystem.php
+++ b/lib/filesystem.php
@@ -196,10 +196,58 @@ class OC_Filesystem{
return false;
}
self::$defaultInstance=new OC_FilesystemView($root);
+
+ //load custom mount config
+ if(is_file(OC::$SERVERROOT.'/config/mount.php')){
+ $mountConfig=include(OC::$SERVERROOT.'/config/mount.php');
+ if(isset($mountConfig['global'])){
+ foreach($mountConfig['global'] as $mountPoint=>$options){
+ self::mount($options['class'],$options['options'],$mountPoint);
+ }
+ }
+
+ if(isset($mountConfig['group'])){
+ foreach($mountConfig['group'] as $group=>$mounts){
+ if(OC_Group::inGroup(OC_User::getUser(),$group)){
+ foreach($mounts as $mountPoint=>$options){
+ $mountPoint=self::setUserVars($mountPoint);
+ foreach($options as &$option){
+ $option=self::setUserVars($option);
+ }
+ self::mount($options['class'],$options['options'],$mountPoint);
+ }
+ }
+ }
+ }
+
+ if(isset($mountConfig['user'])){
+ foreach($mountConfig['user'] as $user=>$mounts){
+ if($user==='all' or strtolower($user)===strtolower(OC_User::getUser())){
+ foreach($mounts as $mountPoint=>$options){
+ $mountPoint=self::setUserVars($mountPoint);
+ foreach($options as &$option){
+ $option=self::setUserVars($option);
+ }
+ self::mount($options['class'],$options['options'],$mountPoint);
+ }
+ }
+ }
+ }
+ }
+
self::$loaded=true;
}
/**
+ * fill in the correct values for $user, and $password placeholders
+ * @param string intput
+ * @return string
+ */
+ private static function setUserVars($input){
+ return str_replace('$user',OC_User::getUser(),$input);
+ }
+
+ /**
* get the default filesystem view
* @return OC_FilesystemView
*/
@@ -227,6 +275,7 @@ class OC_Filesystem{
if(class_exists($class)){
return new $class($arguments);
}else{
+ OC_Log::write('core','storage backend '.$class.' not found',OC_Log::ERROR);
return false;
}
}