From 98ed72b3ed7e81a75d9a323c70a5e7f5af265a23 Mon Sep 17 00:00:00 2001 From: Joas Schilling <213943+nickvergessen@users.noreply.github.com> Date: Tue, 21 Feb 2023 07:36:43 +0100 Subject: Revert "fix(performance): Do not set up filesystem on every call" --- lib/private/Cache/File.php | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) (limited to 'lib/private/Cache/File.php') diff --git a/lib/private/Cache/File.php b/lib/private/Cache/File.php index 56200bda6fa..1f63e462bb5 100644 --- a/lib/private/Cache/File.php +++ b/lib/private/Cache/File.php @@ -35,26 +35,10 @@ use OCP\ICache; use OCP\Security\ISecureRandom; use Psr\Log\LoggerInterface; -/** - * @deprecated 26.0.0 - */ class File implements ICache { /** @var View */ protected $storage; - /** - * Set the cache storage for a user - */ - public function setUpStorage(string $userId) { - Filesystem::initMountPoints($userId); - $rootView = new View(); - if (!$rootView->file_exists('/' . $userId . '/cache')) { - $rootView->mkdir('/' . $userId . '/cache'); - } - $this->storage = new View('/' . $userId . '/cache'); - return $this->storage; - } - /** * Returns the cache storage for the logged in user * @@ -67,8 +51,14 @@ class File implements ICache { return $this->storage; } if (\OC::$server->getUserSession()->isLoggedIn()) { + $rootView = new View(); $user = \OC::$server->getUserSession()->getUser(); - return $this->setUpStorage($user->getUID()); + Filesystem::initMountPoints($user->getUID()); + if (!$rootView->file_exists('/' . $user->getUID() . '/cache')) { + $rootView->mkdir('/' . $user->getUID() . '/cache'); + } + $this->storage = new View('/' . $user->getUID() . '/cache'); + return $this->storage; } else { \OC::$server->get(LoggerInterface::class)->error('Can\'t get cache storage, user not logged in', ['app' => 'core']); throw new \OC\ForbiddenException('Can\t get cache storage, user not logged in'); -- cgit v1.2.3