Skip to content

Commit 57e96ae

Browse files
committed
Revert "perf: Decrease amount of filecache SQL call"
This reverts commit c060aa8.
1 parent e41e6cb commit 57e96ae

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

lib/Service/WorkspaceService.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,30 +11,33 @@
1111
use OCP\Files\File;
1212
use OCP\Files\Folder;
1313
use OCP\Files\NotFoundException;
14-
use OCP\Files\NotPermittedException;
1514
use OCP\Files\StorageInvalidException;
1615
use OCP\IL10N;
1716

1817
class WorkspaceService {
18+
private IL10N $l10n;
19+
1920
private const SUPPORTED_STATIC_FILENAMES = [
2021
'Readme.md',
2122
'README.md',
2223
'readme.md'
2324
];
2425

25-
public function __construct(
26-
private readonly IL10N $l10n,
27-
) {
26+
public function __construct(IL10N $l10n) {
27+
$this->l10n = $l10n;
2828
}
2929

3030
public function getFile(Folder $folder): ?File {
3131
foreach ($this->getSupportedFilenames() as $filename) {
3232
try {
33-
$file = $folder->get($filename);
34-
if ($file instanceof File) {
35-
return $file;
33+
$exists = $folder->getStorage()->getCache()->get($folder->getInternalPath() . '/' . $filename);
34+
if ($exists) {
35+
$file = $folder->get($filename);
36+
if ($file instanceof File) {
37+
return $file;
38+
}
3639
}
37-
} catch (NotFoundException|NotPermittedException|StorageInvalidException) {
40+
} catch (NotFoundException|StorageInvalidException) {
3841
continue;
3942
}
4043
}

0 commit comments

Comments
 (0)