diff options
author | Morris Jobke <hey@morrisjobke.de> | 2015-06-16 16:02:30 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2015-07-03 11:11:58 +0200 |
commit | 3e97ca3b9637a44ffd366838164461bda65e889f (patch) | |
tree | 08a3dc169eea3e0eb516051c77d6aa31bd66748c /lib/private/files/node | |
parent | f70791653cefc40f640e48dcad489237b750d85c (diff) | |
download | nextcloud-server-3e97ca3b9637a44ffd366838164461bda65e889f.tar.gz nextcloud-server-3e97ca3b9637a44ffd366838164461bda65e889f.zip |
Add getUserFolder to IRootFolder
* untangle DI of user specific folders
* allows to autodetect the dependency
Diffstat (limited to 'lib/private/files/node')
-rw-r--r-- | lib/private/files/node/root.php | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/private/files/node/root.php b/lib/private/files/node/root.php index 7ffb3674a8f..4df926748de 100644 --- a/lib/private/files/node/root.php +++ b/lib/private/files/node/root.php @@ -323,4 +323,33 @@ class Root extends Folder implements IRootFolder { public function getName() { return ''; } + + /** + * Returns a view to user's files folder + * + * @param String $userId user ID + * @return \OCP\Files\Folder + */ + public function getUserFolder($userId) { + \OC\Files\Filesystem::initMountPoints($userId); + $dir = '/' . $userId; + $folder = null; + + if (!$this->nodeExists($dir)) { + $folder = $this->newFolder($dir); + } else { + $folder = $this->get($dir); + } + + $dir = '/files'; + if (!$folder->nodeExists($dir)) { + $folder = $folder->newFolder($dir); + \OC_Util::copySkeleton($userId, $folder); + } else { + $folder = $folder->get($dir); + } + + return $folder; + + } } |