diff options
author | Robin Appelman <robin@icewind.nl> | 2025-04-07 18:12:42 +0200 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2025-04-07 19:35:41 +0200 |
commit | c89e3c2f74d6f0bf253dddc18a4a4d305821cbe7 (patch) | |
tree | 77ae38024de782c713f8e0f9ff2a45f64f75b9d5 /lib/private/Cache | |
parent | 084487bdd5ac052fc831509780ce2ffe5517eb41 (diff) | |
download | nextcloud-server-files-cache-node.tar.gz nextcloud-server-files-cache-node.zip |
feat: move file cache to a background jobfiles-cache-node
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/private/Cache')
-rw-r--r-- | lib/private/Cache/File.php | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/private/Cache/File.php b/lib/private/Cache/File.php index 99b14e92787..e8c436636ab 100644 --- a/lib/private/Cache/File.php +++ b/lib/private/Cache/File.php @@ -28,12 +28,14 @@ class File implements ICache { * @throws \OC\ForbiddenException * @throws \OC\User\NoUserException */ - protected function getStorage() { + protected function getStorage(?IUser $user = null): Folder { if ($this->storage !== null) { return $this->storage; } - $session = Server::get(IUserSession::class); - $user = $session->getUser(); + if (!$user) { + $session = Server::get(IUserSession::class); + $user = $session->getUser(); + } $rootFolder = Server::get(IRootFolder::class); if ($user) { $userId = $user->getUID(); @@ -156,8 +158,8 @@ class File implements ICache { * Runs GC * @throws \OC\ForbiddenException */ - public function gc() { - $storage = $this->getStorage(); + public function gc(?IUser $user = null) { + $storage = $this->getStorage($user); // extra hour safety, in case of stray part chunks that take longer to write, // because touch() is only called after the chunk was finished |