Skip to content
Closed
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 cce393f4505fb176b3d8aaabc7e6c491b7163deb
22 changes: 14 additions & 8 deletions lib/private/Files/Cache/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -584,10 +584,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 @@ -599,10 +602,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