aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/Files/Node/LazyUserFolder.php18
-rw-r--r--lib/private/Files/Node/Root.php2
2 files changed, 17 insertions, 3 deletions
diff --git a/lib/private/Files/Node/LazyUserFolder.php b/lib/private/Files/Node/LazyUserFolder.php
index c85a356ddd3..81009532dbf 100644
--- a/lib/private/Files/Node/LazyUserFolder.php
+++ b/lib/private/Files/Node/LazyUserFolder.php
@@ -26,6 +26,7 @@ namespace OC\Files\Node;
use OCP\Files\FileInfo;
use OCP\Constants;
use OCP\Files\IRootFolder;
+use OCP\Files\Mount\IMountManager;
use OCP\Files\NotFoundException;
use OCP\IUser;
@@ -33,10 +34,12 @@ class LazyUserFolder extends LazyFolder {
private IRootFolder $root;
private IUser $user;
private string $path;
+ private IMountManager $mountManager;
- public function __construct(IRootFolder $rootFolder, IUser $user) {
+ public function __construct(IRootFolder $rootFolder, IUser $user, IMountManager $mountManager) {
$this->root = $rootFolder;
$this->user = $user;
+ $this->mountManager = $mountManager;
$this->path = '/' . $user->getUID() . '/files';
parent::__construct(function () use ($user) {
try {
@@ -61,9 +64,20 @@ class LazyUserFolder extends LazyFolder {
/**
* @param int $id
- * @return \OC\Files\Node\Node[]
+ * @return \OCP\Files\Node[]
*/
public function getById($id) {
return $this->root->getByIdInPath((int)$id, $this->getPath());
}
+
+ public function getMountPoint() {
+ if ($this->folder !== null) {
+ return $this->folder->getMountPoint();
+ }
+ $mountPoint = $this->mountManager->find('/' . $this->user->getUID());
+ if (is_null($mountPoint)) {
+ throw new \Exception("No mountpoint for user folder");
+ }
+ return $mountPoint;
+ }
}
diff --git a/lib/private/Files/Node/Root.php b/lib/private/Files/Node/Root.php
index 29cdbb987c3..e9fb14e5364 100644
--- a/lib/private/Files/Node/Root.php
+++ b/lib/private/Files/Node/Root.php
@@ -395,7 +395,7 @@ class Root extends Folder implements IRootFolder {
$folder = $this->newFolder('/' . $userId . '/files');
}
} else {
- $folder = new LazyUserFolder($this, $userObject);
+ $folder = new LazyUserFolder($this, $userObject, $this->mountManager);
}
$this->userFolderCache->set($userId, $folder);