aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2022-03-24 16:34:13 +0000
committerRobin Appelman <robin@icewind.nl>2022-03-24 17:41:37 +0100
commit881e107543948d75593360a606e8cc87c618a8f6 (patch)
tree1c93ad9120ebc5101b1ea70ad3648b75d1eb6539
parent1179873f33cebcd2132aa5f51da952412830b94e (diff)
downloadnextcloud-server-881e107543948d75593360a606e8cc87c618a8f6.tar.gz
nextcloud-server-881e107543948d75593360a606e8cc87c618a8f6.zip
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>
-rw-r--r--apps/files_external/lib/Service/StoragesService.php2
-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
4 files changed, 12 insertions, 11 deletions
diff --git a/apps/files_external/lib/Service/StoragesService.php b/apps/files_external/lib/Service/StoragesService.php
index 6d03590d345..489192dbdc2 100644
--- a/apps/files_external/lib/Service/StoragesService.php
+++ b/apps/files_external/lib/Service/StoragesService.php
@@ -349,7 +349,7 @@ abstract class StoragesService {
* @param string $mountType hook mount type param
* @param array $applicableArray array of applicable users/groups for which to trigger the hook
*/
- protected function triggerApplicableHooks($signal, $mountPoint, $mountType, $applicableArray) {
+ protected function triggerApplicableHooks($signal, $mountPoint, $mountType, $applicableArray): void {
$this->eventDispatcher->dispatchTyped(new InvalidateMountCacheEvent(null));
foreach ($applicableArray as $applicable) {
\OCP\Util::emitHook(
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