diff options
author | Robin Appelman <robin@icewind.nl> | 2022-02-23 18:11:46 +0100 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2022-03-04 16:29:50 +0100 |
commit | 5c0fe934988960ece3ac71d5a1dfc8df405413aa (patch) | |
tree | a4b4cded5a1876ba58651f87a385df16c2460f63 /lib/private/Files/Node/Root.php | |
parent | 15ff65c12fafbe1c4026fa6f734fb58fdbdcda11 (diff) | |
download | nextcloud-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/Node/Root.php')
-rw-r--r-- | lib/private/Files/Node/Root.php | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/lib/private/Files/Node/Root.php b/lib/private/Files/Node/Root.php index b5707c87543..6f47b49c66a 100644 --- a/lib/private/Files/Node/Root.php +++ b/lib/private/Files/Node/Root.php @@ -35,13 +35,17 @@ namespace OC\Files\Node; use OC\Cache\CappedMemoryCache; use OC\Files\Mount\Manager; use OC\Files\Mount\MountPoint; +use OC\Files\View; use OC\Hooks\PublicEmitter; use OC\User\NoUserException; +use OCP\EventDispatcher\IEventDispatcher; use OCP\Files\Config\IUserMountCache; +use OCP\Files\Events\Node\FilesystemTearedDownEvent; use OCP\Files\IRootFolder; use OCP\Files\NotFoundException; use OCP\Files\NotPermittedException; use OCP\ILogger; +use OCP\IUser; use OCP\IUserManager; /** @@ -64,35 +68,32 @@ use OCP\IUserManager; * @package OC\Files\Node */ class Root extends Folder implements IRootFolder { - /** @var Manager */ - private $mountManager; - /** @var PublicEmitter */ - private $emitter; - /** @var null|\OC\User\User */ - private $user; - /** @var CappedMemoryCache */ - private $userFolderCache; - /** @var IUserMountCache */ - private $userMountCache; - /** @var ILogger */ - private $logger; - /** @var IUserManager */ - private $userManager; + private Manager $mountManager; + private PublicEmitter $emitter; + private ?IUser $user; + private CappedMemoryCache $userFolderCache; + private IUserMountCache $userMountCache; + private ILogger $logger; + private IUserManager $userManager; + private IEventDispatcher $eventDispatcher; /** - * @param \OC\Files\Mount\Manager $manager - * @param \OC\Files\View $view - * @param \OC\User\User|null $user + * @param Manager $manager + * @param View $view + * @param IUser|null $user * @param IUserMountCache $userMountCache * @param ILogger $logger * @param IUserManager $userManager */ - public function __construct($manager, + public function __construct( + $manager, $view, $user, - IUserMountCache $userMountCache, - ILogger $logger, - IUserManager $userManager) { + IUserMountCache $userMountCache, + ILogger $logger, + IUserManager $userManager, + IEventDispatcher $eventDispatcher + ) { parent::__construct($this, $view, ''); $this->mountManager = $manager; $this->user = $user; @@ -101,6 +102,9 @@ class Root extends Folder implements IRootFolder { $this->userMountCache = $userMountCache; $this->logger = $logger; $this->userManager = $userManager; + $eventDispatcher->addListener(FilesystemTearedDownEvent::class, function () { + $this->userFolderCache = new CappedMemoryCache(); + }); } /** @@ -393,10 +397,6 @@ class Root extends Folder implements IRootFolder { return $this->userFolderCache->get($userId); } - public function clearCache() { - $this->userFolderCache = new CappedMemoryCache(); - } - public function getUserMountCache() { return $this->userMountCache; } |