Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
845b780
feat(IFileAccess#getByAncestorInStorage): Add new method to retrieve …
marcelklehr Mar 31, 2025
3eef614
feat(IFileAccess#getMounts): Add new method to retrieve all distinct …
marcelklehr Mar 31, 2025
611d83a
fix: Fix psalm issues
marcelklehr Mar 31, 2025
d8c6f8d
fix(FileAccess): Address review comments
marcelklehr Apr 1, 2025
5689af5
fix(FileAccess): Run cs:fix
marcelklehr Apr 1, 2025
d67c877
fix(FileAccess): Add tests
marcelklehr Apr 1, 2025
10cc430
fix(FileAccess#getByAncestorInStorage): Use a subquery to fix tests
marcelklehr Apr 3, 2025
34b3f75
fix(FileAccess#getDistinctMounts): Order results deterministically
marcelklehr Apr 4, 2025
3941622
fix(FileAccessTest): Make sure path_hash is not NULL
marcelklehr Apr 4, 2025
895160a
fix(FileAccessTest): Do not use LIMIT in subquery
marcelklehr Apr 4, 2025
26f6013
fix(FileAccessTest): Make it work on sharded instance
marcelklehr Apr 4, 2025
131125b
fix(FileAccessTest): Adress review comments
marcelklehr Apr 10, 2025
7e98698
fix(FileAccess*): Adress review comments
julien-nc May 28, 2025
28dc4a2
fix(FileAccess): exclude trashbin nodes on the oc_filecache query, th…
julien-nc Jun 2, 2025
a2aeec0
fix(FileAccess*): Adress review comments
julien-nc Jun 3, 2025
cb221c8
fix(FileAccess*): Change the way home dir root is found, remove the e…
julien-nc Jun 3, 2025
3a96f8e
fix(FileAccess*): fix tests
julien-nc Jun 3, 2025
43be97d
fix(FileAccess): Use one param for rewriting home dirs and excluding …
marcelklehr Jul 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(FileAccess*): Adress review comments
Signed-off-by: Julien Veyssier <[email protected]>
  • Loading branch information
julien-nc authored and marcelklehr committed Jul 15, 2025
commit a2aeec0f4b155e86c7dde2a580d542c58a86d50d
15 changes: 7 additions & 8 deletions lib/private/Files/Cache/FileAccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ public function getByFileIdsInStorage(array $fileIds, int $storageId): array {
public function getByAncestorInStorage(int $storageId, int $folderId, int $fileIdCursor = 0, int $maxResults = 100, array $mimeTypeIds = [], bool $endToEndEncrypted = true, bool $serverSideEncrypted = true): \Generator {
$qb = $this->getQuery();
$qb->select('path')
->from('filecache');
$qb->where($qb->expr()->eq('fileid', $qb->createNamedParameter($folderId, IQueryBuilder::PARAM_INT)));
->from('filecache')
->where($qb->expr()->eq('fileid', $qb->createNamedParameter($folderId, IQueryBuilder::PARAM_INT)));
$result = $qb->executeQuery();
/** @var array{path:string}|false $root */
$root = $result->fetch();
Expand All @@ -116,7 +116,7 @@ public function getByAncestorInStorage(int $storageId, int $folderId, int $fileI

$qb->selectDistinct('*')
->from('filecache', 'f')
->andWhere($qb->expr()->like('f.path', $qb->createNamedParameter($path . '%')))
->where($qb->expr()->like('f.path', $qb->createNamedParameter($this->connection->escapeLikeParameter($path) . '%')))
->andWhere($qb->expr()->eq('f.storage', $qb->createNamedParameter($storageId)))
->andWhere($qb->expr()->gt('f.fileid', $qb->createNamedParameter($fileIdCursor, IQueryBuilder::PARAM_INT)));

Expand Down Expand Up @@ -168,7 +168,6 @@ public function getDistinctMounts(array $mountProviders = [], bool $excludeTrash
$qb->orderBy('root_id', 'ASC');
$result = $qb->executeQuery();


while (
/** @var array{storage_id:int, root_id:int,mount_provider_class:string} $row */
$row = $result->fetch()
Expand All @@ -186,13 +185,13 @@ public function getDistinctMounts(array $mountProviders = [], bool $excludeTrash
$qb = $this->getQuery();
try {
$qb->select('fileid')
->from('filecache');
$qb->andWhere($qb->expr()->eq('storage', $qb->createNamedParameter($storageId, IQueryBuilder::PARAM_INT)))
->from('filecache')
->where($qb->expr()->eq('storage', $qb->createNamedParameter($storageId, IQueryBuilder::PARAM_INT)))
->andWhere($qb->expr()->eq('parent', $qb->createNamedParameter($rootId, IQueryBuilder::PARAM_INT)))
->andWhere($qb->expr()->eq('name', $qb->createNamedParameter('files')));
if ($excludeTrashbinMounts === true) {
$qb->andWhere($qb->expr()->notLike('path', $qb->createPositionalParameter('files_trashbin/%')))
->andWhere($qb->expr()->notLike('path', $qb->createPositionalParameter('__groupfolders/trash/%')));
$qb->andWhere($qb->expr()->notLike('path', $qb->createNamedParameter('files_trashbin/%')))
->andWhere($qb->expr()->notLike('path', $qb->createNamedParameter('__groupfolders/trash/%')));
}
/** @var array|false $root */
$root = $qb->executeQuery()->fetch();
Expand Down