From bb1b42885ff910e42d6bd5093293c30205772943 Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Thu, 29 Jan 2026 15:56:15 +0100 Subject: [PATCH] Revert "perf: Decrease amount of filecache SQL call" This reverts commit c060aa826f831fdd7c1906c2be06931e0563ef2d. Signed-off-by: Carl Schwan --- lib/Service/WorkspaceService.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/Service/WorkspaceService.php b/lib/Service/WorkspaceService.php index 1f8191f7d56..40e4d439821 100644 --- a/lib/Service/WorkspaceService.php +++ b/lib/Service/WorkspaceService.php @@ -11,30 +11,33 @@ use OCP\Files\File; use OCP\Files\Folder; use OCP\Files\NotFoundException; -use OCP\Files\NotPermittedException; use OCP\Files\StorageInvalidException; use OCP\IL10N; class WorkspaceService { + private IL10N $l10n; + private const SUPPORTED_STATIC_FILENAMES = [ 'Readme.md', 'README.md', 'readme.md' ]; - public function __construct( - private readonly IL10N $l10n, - ) { + public function __construct(IL10N $l10n) { + $this->l10n = $l10n; } public function getFile(Folder $folder): ?File { foreach ($this->getSupportedFilenames() as $filename) { try { - $file = $folder->get($filename); - if ($file instanceof File) { - return $file; + $exists = $folder->getStorage()->getCache()->get($folder->getInternalPath() . '/' . $filename); + if ($exists) { + $file = $folder->get($filename); + if ($file instanceof File) { + return $file; + } } - } catch (NotFoundException|NotPermittedException|StorageInvalidException) { + } catch (NotFoundException|StorageInvalidException) { continue; } }