diff options
author | Anna Larch <anna@nextcloud.com> | 2023-02-07 15:55:55 +0100 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2023-02-17 19:18:37 +0100 |
commit | 5d4efb4d5fd8e4389856df5d94c3b92c7019e603 (patch) | |
tree | be191327ae1ad02a9db395dbf22c03a085b053ed /lib/private/Cache | |
parent | d6a3ebc79f405f5294803ce04386832e526e447b (diff) | |
download | nextcloud-server-5d4efb4d5fd8e4389856df5d94c3b92c7019e603.tar.gz nextcloud-server-5d4efb4d5fd8e4389856df5d94c3b92c7019e603.zip |
Do not set up filesystem on every call
Also remove old Oc_FileChunking logis that produced GC- collectable chunks
Signed-off-by: Anna Larch <anna@nextcloud.com>
Diffstat (limited to 'lib/private/Cache')
-rw-r--r-- | lib/private/Cache/File.php | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/lib/private/Cache/File.php b/lib/private/Cache/File.php index 1f63e462bb5..56200bda6fa 100644 --- a/lib/private/Cache/File.php +++ b/lib/private/Cache/File.php @@ -35,11 +35,27 @@ 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 * * @return \OC\Files\View cache storage @@ -51,14 +67,8 @@ class File implements ICache { return $this->storage; } if (\OC::$server->getUserSession()->isLoggedIn()) { - $rootView = new View(); $user = \OC::$server->getUserSession()->getUser(); - 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; + return $this->setUpStorage($user->getUID()); } 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'); |