aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Files/Config/MountProviderCollection.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/Files/Config/MountProviderCollection.php')
-rw-r--r--lib/private/Files/Config/MountProviderCollection.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/private/Files/Config/MountProviderCollection.php b/lib/private/Files/Config/MountProviderCollection.php
index 34db652290f..2b57ffe6e4c 100644
--- a/lib/private/Files/Config/MountProviderCollection.php
+++ b/lib/private/Files/Config/MountProviderCollection.php
@@ -30,6 +30,7 @@ use OC\Hooks\EmitterTrait;
use OCP\Files\Config\IHomeMountProvider;
use OCP\Files\Config\IMountProvider;
use OCP\Files\Config\IMountProviderCollection;
+use OCP\Files\Config\IRootMountProvider;
use OCP\Files\Config\IUserMountCache;
use OCP\Files\Mount\IMountManager;
use OCP\Files\Mount\IMountPoint;
@@ -49,6 +50,9 @@ class MountProviderCollection implements IMountProviderCollection, Emitter {
*/
private $providers = [];
+ /** @var \OCP\Files\Config\IRootMountProvider[] */
+ private $rootProviders = [];
+
/**
* @var \OCP\Files\Storage\IStorageFactory
*/
@@ -198,4 +202,19 @@ class MountProviderCollection implements IMountProviderCollection, Emitter {
public function getMountCache() {
return $this->mountCache;
}
+
+ public function registerRootProvider(IRootMountProvider $provider) {
+ $this->rootProviders[] = $provider;
+ }
+
+ public function getRootMounts(): array {
+ $loader = $this->loader;
+ $mounts = array_map(function (IRootMountProvider $provider) use ($loader) {
+ return $provider->getRootMounts($loader);
+ }, $this->rootProviders);
+ $mounts = array_reduce($mounts, function (array $mounts, array $providerMounts) {
+ return array_merge($mounts, $providerMounts);
+ }, []);
+ return $mounts;
+ }
}