Skip to content

Commit f7b354d

Browse files
authored
Merge pull request #8206 from nextcloud/backport/8196/stable33
[stable33] perf: Decrease amount of filecache SQL call
2 parents ac09840 + c060aa8 commit f7b354d

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

lib/Service/WorkspaceService.php

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

1718
class WorkspaceService {
18-
private IL10N $l10n;
19-
2019
private const SUPPORTED_STATIC_FILENAMES = [
2120
'Readme.md',
2221
'README.md',
2322
'readme.md'
2423
];
2524

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

3030
public function getFile(Folder $folder): ?File {
3131
foreach ($this->getSupportedFilenames() as $filename) {
3232
try {
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-
}
33+
$file = $folder->get($filename);
34+
if ($file instanceof File) {
35+
return $file;
3936
}
40-
} catch (NotFoundException|StorageInvalidException) {
37+
} catch (NotFoundException|NotPermittedException|StorageInvalidException) {
4138
continue;
4239
}
4340
}

0 commit comments

Comments
 (0)