From 8d490b9880368a6fd5fcd65964e1f23e6ed350eb Mon Sep 17 00:00:00 2001 From: Michael Gapczynski Date: Wed, 29 Aug 2012 14:36:51 -0400 Subject: [PATCH] Fix shared storage working with user backend defined data directories --- apps/files_sharing/lib/sharedstorage.php | 3 ++- lib/util.php | 10 +--------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/apps/files_sharing/lib/sharedstorage.php b/apps/files_sharing/lib/sharedstorage.php index df5d4d20aed..6a2905b52c9 100644 --- a/apps/files_sharing/lib/sharedstorage.php +++ b/apps/files_sharing/lib/sharedstorage.php @@ -30,7 +30,6 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common { public function __construct($arguments) { $this->sharedFolder = $arguments['sharedFolder']; - OC_Util::setupFS4all(); } /** @@ -78,6 +77,8 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common { private function getSourcePath($target) { $file = $this->getFile($target); if (isset($file['path'])) { + $uid = substr($file['path'], 1, strpos($file['path'], '/', 1) - 1); + OC_Filesystem::mount('OC_Filestorage_Local', array('datadir' => OC_User::getHome($uid)), $uid); return $file['path']; } return false; diff --git a/lib/util.php b/lib/util.php index 24f80b93896..b77d6cb1b65 100755 --- a/lib/util.php +++ b/lib/util.php @@ -35,13 +35,11 @@ class OC_Util { $user_dir = '/'.$user.'/files'; $user_root = OC_User::getHome($user); $userdirectory = $user_root . '/files'; - OC_Filesystem::mount('OC_Filestorage_Local',array('datadir'=>$user_root), $user); if( !is_dir( $userdirectory )){ mkdir( $userdirectory, 0755, true ); } - OC_Filesystem::mount('OC_Filestorage_Local',array('datadir'=>$user_root), $user); - //jail the user into his "home" directory + OC_Filesystem::mount('OC_Filestorage_Local', array('datadir' => $user_root), $user); OC_Filesystem::init($user_dir); $quotaProxy=new OC_FileProxy_Quota(); OC_FileProxy::register($quotaProxy); @@ -59,12 +57,6 @@ class OC_Util { } } - public static function setupFS4all(){ - foreach(OC_User::getUsers() as $user){ - OC_Filesystem::mount('OC_Filestorage_Local',array('datadir'=>OC_User::getHome($singleuser)), $user); - } - } - public static function tearDownFS(){ OC_Filesystem::tearDown(); self::$fsSetup=false; -- 2.39.5