Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2022-03-24 19:34:13 +0300
committerRobin Appelman <robin@icewind.nl>2022-03-24 19:41:37 +0300
commit881e107543948d75593360a606e8cc87c618a8f6 (patch)
tree1c93ad9120ebc5101b1ea70ad3648b75d1eb6539 /lib
parent1179873f33cebcd2132aa5f51da952412830b94e (diff)
Apply suggestions from code review
Co-authored-by: Louis <6653109+artonge@users.noreply.github.com> Co-authored-by: Côme Chilliet <91878298+come-nc@users.noreply.github.com> Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Files/Config/MountProviderCollection.php15
-rw-r--r--lib/private/Files/SetupManager.php4
-rw-r--r--lib/public/Files/Config/IMountProviderCollection.php2
3 files changed, 11 insertions, 10 deletions
diff --git a/lib/private/Files/Config/MountProviderCollection.php b/lib/private/Files/Config/MountProviderCollection.php
index a3c20bdbfbb..f88ffe2561d 100644
--- a/lib/private/Files/Config/MountProviderCollection.php
+++ b/lib/private/Files/Config/MountProviderCollection.php
@@ -79,7 +79,7 @@ class MountProviderCollection implements IMountProviderCollection, Emitter {
* @param IMountProvider[] $providers
* @return IMountPoint[]
*/
- private function getMountsForFromProviders(IUser $user, array $providers): array {
+ private function getUserMountsForProviders(IUser $user, array $providers): array {
$loader = $this->loader;
$mounts = array_map(function (IMountProvider $provider) use ($user, $loader) {
return $provider->getMountsForUser($user, $loader);
@@ -94,14 +94,15 @@ class MountProviderCollection implements IMountProviderCollection, Emitter {
}
public function getMountsForUser(IUser $user): array {
- return $this->getMountsForFromProviders($user, $this->providers);
+ return $this->getUserMountsForProviders($user, $this->providers);
}
- public function getMountsFromProvider(IUser $user, string $mountProviderClass): array {
- $providers = array_filter($this->providers, function (IMountProvider $mountProvider) use ($mountProviderClass) {
- return get_class($mountProvider) === $mountProviderClass;
- });
- return $this->getMountsForFromProviders($user, $providers);
+ public function getUserMountsForProviderClass(IUser $user, string $mountProviderClass): array {
+ $providers = array_filter(
+ $this->providers,
+ fn (IMountProvider $mountProvider) => (get_class($mountProvider) === $mountProviderClass)
+ );
+ return $this->getUserMountsForProviders($user, $providers);
}
public function addMountForUser(IUser $user, IMountManager $mountManager, callable $providerFilter = null) {
diff --git a/lib/private/Files/SetupManager.php b/lib/private/Files/SetupManager.php
index cb39ec90245..da50983da32 100644
--- a/lib/private/Files/SetupManager.php
+++ b/lib/private/Files/SetupManager.php
@@ -381,7 +381,7 @@ class SetupManager {
$setupProviders[] = $cachedMount->getMountProvider();
$currentProviders[] = $cachedMount->getMountProvider();
if ($cachedMount->getMountProvider()) {
- $mounts = $this->mountProviderCollection->getMountsFromProvider($user, $cachedMount->getMountProvider());
+ $mounts = $this->mountProviderCollection->getUserMountsForProviderClass($user, $cachedMount->getMountProvider());
} else {
$this->logger->debug("mount at " . $cachedMount->getMountPoint() . " has no provider set, performing full setup");
$this->setupForUser($user);
@@ -396,7 +396,7 @@ class SetupManager {
$setupProviders[] = $cachedMount->getMountProvider();
$currentProviders[] = $cachedMount->getMountProvider();
if ($cachedMount->getMountProvider()) {
- $mounts = array_merge($mounts, $this->mountProviderCollection->getMountsFromProvider($user, $cachedMount->getMountProvider()));
+ $mounts = array_merge($mounts, $this->mountProviderCollection->getUserMountsForProviderClass($user, $cachedMount->getMountProvider()));
} else {
$this->logger->debug("mount at " . $cachedMount->getMountPoint() . " has no provider set, performing full setup");
$this->setupForUser($user);
diff --git a/lib/public/Files/Config/IMountProviderCollection.php b/lib/public/Files/Config/IMountProviderCollection.php
index 8a98c614a42..5894d06a388 100644
--- a/lib/public/Files/Config/IMountProviderCollection.php
+++ b/lib/public/Files/Config/IMountProviderCollection.php
@@ -46,7 +46,7 @@ interface IMountProviderCollection {
* @return \OCP\Files\Mount\IMountPoint[]
* @since 24.0.0
*/
- public function getMountsFromProvider(IUser $user, string $mountProviderClass);
+ public function getUserMountsForProviderClass(IUser $user, string $mountProviderClass);
/**
* Get the configured home mount for this user