aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_external/lib/Config/ConfigAdapter.php
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2016-09-02 14:55:45 +0200
committerRobin Appelman <robin@icewind.nl>2016-09-05 14:34:20 +0200
commitb573c5b8f807eec913c494b0ec4a54f91ff143e6 (patch)
tree752a12323cd77859138cb9e8ba46e4b1acc2b919 /apps/files_external/lib/Config/ConfigAdapter.php
parent8741acf8a6dfb3919c43d3cee5a9c13f6c1e4b9f (diff)
downloadnextcloud-server-b573c5b8f807eec913c494b0ec4a54f91ff143e6.tar.gz
nextcloud-server-b573c5b8f807eec913c494b0ec4a54f91ff143e6.zip
get files_external mounts more efficiently
Diffstat (limited to 'apps/files_external/lib/Config/ConfigAdapter.php')
-rw-r--r--apps/files_external/lib/Config/ConfigAdapter.php49
1 files changed, 20 insertions, 29 deletions
diff --git a/apps/files_external/lib/Config/ConfigAdapter.php b/apps/files_external/lib/Config/ConfigAdapter.php
index 00366135ea4..5d8e30b6da6 100644
--- a/apps/files_external/lib/Config/ConfigAdapter.php
+++ b/apps/files_external/lib/Config/ConfigAdapter.php
@@ -126,7 +126,7 @@ class ConfigAdapter implements IMountProvider {
$this->userStoragesService->setUser($user);
$this->userGlobalStoragesService->setUser($user);
- foreach ($this->userGlobalStoragesService->getUniqueStorages() as $storage) {
+ foreach ($this->userGlobalStoragesService->getAllStoragesForUser() as $storage) {
try {
$this->prepareStorageConfig($storage, $user);
$impl = $this->constructStorage($storage);
@@ -147,35 +147,26 @@ class ConfigAdapter implements IMountProvider {
$impl = new FailedStorage(['exception' => $e]);
}
- $mount = new MountPoint(
- $impl,
- '/' . $user->getUID() . '/files' . $storage->getMountPoint(),
- null,
- $loader,
- $storage->getMountOptions(),
- $storage->getId()
- );
- $mounts[$storage->getMountPoint()] = $mount;
- }
-
- foreach ($this->userStoragesService->getStorages() as $storage) {
- try {
- $this->prepareStorageConfig($storage, $user);
- $impl = $this->constructStorage($storage);
- } catch (\Exception $e) {
- // propagate exception into filesystem
- $impl = new FailedStorage(['exception' => $e]);
+ if ($storage->getType() === StorageConfig::MOUNT_TYPE_PERSONAl) {
+ $mount = new PersonalMount(
+ $this->userStoragesService,
+ $storage->getId(),
+ $impl,
+ '/' . $user->getUID() . '/files' . $storage->getMountPoint(),
+ null,
+ $loader,
+ $storage->getMountOptions()
+ );
+ } else {
+ $mount = new MountPoint(
+ $impl,
+ '/' . $user->getUID() . '/files' . $storage->getMountPoint(),
+ null,
+ $loader,
+ $storage->getMountOptions(),
+ $storage->getId()
+ );
}
-
- $mount = new PersonalMount(
- $this->userStoragesService,
- $storage->getId(),
- $impl,
- '/' . $user->getUID() . '/files' . $storage->getMountPoint(),
- null,
- $loader,
- $storage->getMountOptions()
- );
$mounts[$storage->getMountPoint()] = $mount;
}