aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Cache/File.php
diff options
context:
space:
mode:
authorJoas Schilling <213943+nickvergessen@users.noreply.github.com>2023-02-21 07:36:43 +0100
committerGitHub <noreply@github.com>2023-02-21 07:36:43 +0100
commit98ed72b3ed7e81a75d9a323c70a5e7f5af265a23 (patch)
treea92d3ab78f2fa52969139448a8aa7c509ed97af5 /lib/private/Cache/File.php
parent93e703bbfc7c8ef654b7b0185474397ec1bbaa6b (diff)
downloadnextcloud-server-98ed72b3ed7e81a75d9a323c70a5e7f5af265a23.tar.gz
nextcloud-server-98ed72b3ed7e81a75d9a323c70a5e7f5af265a23.zip
Revert "fix(performance): Do not set up filesystem on every call"
Diffstat (limited to 'lib/private/Cache/File.php')
-rw-r--r--lib/private/Cache/File.php24
1 files changed, 7 insertions, 17 deletions
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,27 +35,11 @@ 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
@@ -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');