aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Files/Filesystem.php
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2022-02-23 18:11:46 +0100
committerRobin Appelman <robin@icewind.nl>2022-03-04 16:29:50 +0100
commit5c0fe934988960ece3ac71d5a1dfc8df405413aa (patch)
treea4b4cded5a1876ba58651f87a385df16c2460f63 /lib/private/Files/Filesystem.php
parent15ff65c12fafbe1c4026fa6f734fb58fdbdcda11 (diff)
downloadnextcloud-server-5c0fe934988960ece3ac71d5a1dfc8df405413aa.tar.gz
nextcloud-server-5c0fe934988960ece3ac71d5a1dfc8df405413aa.zip
move teardown logic to SetupManager
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/private/Files/Filesystem.php')
-rw-r--r--lib/private/Files/Filesystem.php22
1 files changed, 10 insertions, 12 deletions
diff --git a/lib/private/Files/Filesystem.php b/lib/private/Files/Filesystem.php
index e439b746bf6..0c444d5cd34 100644
--- a/lib/private/Files/Filesystem.php
+++ b/lib/private/Files/Filesystem.php
@@ -41,7 +41,9 @@ use OC\Cache\CappedMemoryCache;
use OC\Files\Config\MountProviderCollection;
use OC\Files\Mount\MountPoint;
use OC\Lockdown\Filesystem\NullStorage;
+use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\Config\IMountProvider;
+use OCP\Files\Events\Node\FilesystemTearedDownEvent;
use OCP\Files\NotFoundException;
use OCP\Files\Storage\IStorageFactory;
use OCP\ILogger;
@@ -332,6 +334,13 @@ class Filesystem {
}
self::getLoader();
self::$defaultInstance = new View($root);
+ /** @var IEventDispatcher $eventDispatcher */
+ $eventDispatcher = \OC::$server->get(IEventDispatcher::class);
+ $eventDispatcher->addListener(FilesystemTearedDownEvent::class, function () {
+ self::$defaultInstance = null;
+ self::$usersSetup = [];
+ self::$loaded = false;
+ });
if (!self::$mounts) {
self::$mounts = \OC::$server->getMountManager();
@@ -474,8 +483,7 @@ class Filesystem {
* tear down the filesystem, removing all storage providers
*/
public static function tearDown() {
- self::clearMounts();
- self::$defaultInstance = null;
+ \OC_Util::tearDownFS();
}
/**
@@ -493,16 +501,6 @@ class Filesystem {
}
/**
- * clear all mounts and storage backends
- */
- public static function clearMounts() {
- if (self::$mounts) {
- self::$usersSetup = [];
- self::$mounts->clear();
- }
- }
-
- /**
* mount an \OC\Files\Storage\Storage in our virtual filesystem
*
* @param \OC\Files\Storage\Storage|string $class