From c959bf2b426aa2e5ad53892d9685b9c33261aadf Mon Sep 17 00:00:00 2001 From: Sijmen Schoon <me@sijmenschoon.nl> Date: Sun, 17 Oct 2021 19:08:27 +0200 Subject: Limit parameter count per query in Cache.removeChildren Signed-off-by: Sijmen Schoon <me@sijmenschoon.nl> --- lib/private/Files/Cache/Cache.php | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'lib/private/Files') diff --git a/lib/private/Files/Cache/Cache.php b/lib/private/Files/Cache/Cache.php index aec97d1ad33..f471b5c7838 100644 --- a/lib/private/Files/Cache/Cache.php +++ b/lib/private/Files/Cache/Cache.php @@ -587,10 +587,13 @@ class Cache implements ICache { 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) { @@ -602,10 +605,13 @@ class Cache implements ICache { } } - $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(); + } } /** -- cgit v1.2.3