diff options
author | Sijmen Schoon <me@sijmenschoon.nl> | 2021-10-17 19:08:27 +0200 |
---|---|---|
committer | Sijmen Schoon <me@sijmenschoon.nl> | 2021-10-17 19:10:58 +0200 |
commit | c959bf2b426aa2e5ad53892d9685b9c33261aadf (patch) | |
tree | 4fd737c359b8eea558b3cc363a6b93b2ffe9c54f /lib | |
parent | 9a809df960baad5db1840509f9f6acd19b5b66c7 (diff) | |
download | nextcloud-server-c959bf2b426aa2e5ad53892d9685b9c33261aadf.tar.gz nextcloud-server-c959bf2b426aa2e5ad53892d9685b9c33261aadf.zip |
Limit parameter count per query in Cache.removeChildren
Signed-off-by: Sijmen Schoon <me@sijmenschoon.nl>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Files/Cache/Cache.php | 22 |
1 files changed, 14 insertions, 8 deletions
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(); + } } /** |