aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Files/Mount
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2022-03-28 18:45:06 +0200
committerRobin Appelman <robin@icewind.nl>2022-04-04 14:57:56 +0200
commit99ac46d8f5de241b49e33e2c4fb874270f6860cc (patch)
tree4275e6e959229c742ee369fc0a439e4312c15816 /lib/private/Files/Mount
parent74c97e257132384be3d6e0978b847c9d6933928b (diff)
downloadnextcloud-server-99ac46d8f5de241b49e33e2c4fb874270f6860cc.tar.gz
nextcloud-server-99ac46d8f5de241b49e33e2c4fb874270f6860cc.zip
allow getting mounts by providers
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/private/Files/Mount')
-rw-r--r--lib/private/Files/Mount/Manager.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/private/Files/Mount/Manager.php b/lib/private/Files/Mount/Manager.php
index ecd97760f17..d0f5f3f5a52 100644
--- a/lib/private/Files/Mount/Manager.php
+++ b/lib/private/Files/Mount/Manager.php
@@ -204,4 +204,22 @@ class Manager implements IMountManager {
public function getSetupManager(): SetupManager {
return $this->setupManager;
}
+
+ /**
+ * Return all mounts in a path from a specific mount provider
+ *
+ * @param string $path
+ * @param string[] $mountProviders
+ * @return MountPoint[]
+ */
+ public function getMountsByMountProvider(string $path, array $mountProviders) {
+ $this->getSetupManager()->setupForProvider($path, $mountProviders);
+ if (in_array('', $mountProviders)) {
+ return $this->mounts;
+ } else {
+ return array_filter($this->mounts, function ($mount) use ($mountProviders) {
+ return in_array($mount->getMountProvider(), $mountProviders);
+ });
+ }
+ }
}