mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
fix(FileAccess): Make getAncestorInStorage pass sharding tests
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
This commit is contained in:
parent
b158a77365
commit
3522a3375e
1 changed files with 3 additions and 6 deletions
|
|
@ -150,10 +150,8 @@ class FileAccess implements IFileAccess {
|
|||
// End to end encrypted files are descendants of a folder with encrypted=1
|
||||
// If the filecache table is sharded we need to check with a separate query if the parent is encrypted
|
||||
$rows = [];
|
||||
$i = 0;
|
||||
do {
|
||||
while ($i < 1000 && ($row = $files->fetch())) {
|
||||
$i++;
|
||||
while (count($rows) < 1000 && ($row = $files->fetch())) {
|
||||
$rows[] = $row;
|
||||
}
|
||||
$parents = array_map(function ($row) {
|
||||
|
|
@ -168,15 +166,14 @@ class FileAccess implements IFileAccess {
|
|||
$parentRows = $result->fetchAll();
|
||||
$result->closeCursor();
|
||||
|
||||
$parentEncryptedByFileId = array_column($parentRows, 'encrypted', 'fileid');
|
||||
$encryptedByFileId = array_column($parentRows, 'encrypted', 'fileid');
|
||||
foreach ($rows as $row) {
|
||||
if ($parentEncryptedByFileId[$row['fileid']] === 1) {
|
||||
if ($encryptedByFileId[$row['parent']]) {
|
||||
continue;
|
||||
}
|
||||
yield Cache::cacheEntryFromData($row, $this->mimeTypeLoader);
|
||||
}
|
||||
$rows = [];
|
||||
$i = 1;
|
||||
} while ($rows[] = $files->fetch());
|
||||
} else {
|
||||
while (
|
||||
|
|
|
|||
Loading…
Reference in a new issue