Skip to content
Merged
Changes from 1 commit
Commits
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
Next Next commit
Limit parameter count per query in Cache.removeChildren
Signed-off-by: Sijmen Schoon <[email protected]>
  • Loading branch information
vijfhoek authored and backportbot[bot] committed Nov 1, 2021
commit ec3b1ccd91ed7b29818b79863638a1f5b7302e8a
22 changes: 14 additions & 8 deletions lib/private/Files/Cache/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -587,10 +587,13 @@ private function removeChildren(ICacheEntry $entry) {
return $cacheEntry->getId();
}, $children);

$query = $this->getQueryBuilder();
$query->delete('filecache_extended')
->where($query->expr()->in('fileid', $query->createNamedParameter($childIds, IQueryBuilder::PARAM_INT_ARRAY)));
$query->execute();
$childIdChunks = array_chunk($childIds, 2048);
foreach ($childIdChunks as $childIdChunk) {
$query = $this->getQueryBuilder();
$query->delete('filecache_extended')
->where($query->expr()->in('fileid', $query->createNamedParameter($childIdChunk, IQueryBuilder::PARAM_INT_ARRAY)));
$query->execute();
}

/** @var ICacheEntry[] $childFolders */
$childFolders = array_filter($children, function ($child) {
Expand All @@ -602,10 +605,13 @@ private function removeChildren(ICacheEntry $entry) {
}
}

$query = $this->getQueryBuilder();
$query->delete('filecache')
->whereParentIn($parentIds);
$query->execute();
$parentIdChunks = array_chunk($parentIds, 2048);
foreach ($parentIdChunks as $parentIdChunk) {
$query = $this->getQueryBuilder();
$query->delete('filecache')
->whereParentIn($parentIdChunk);
$query->execute();
}
}

/**
Expand Down