diff options
-rw-r--r-- | lib/Db/MessageMapper.php | 12 | ||||
-rw-r--r-- | tests/psalm-baseline.xml | 1 |
2 files changed, 10 insertions, 3 deletions
diff --git a/lib/Db/MessageMapper.php b/lib/Db/MessageMapper.php index 246284c8f..75a6c0af7 100644 --- a/lib/Db/MessageMapper.php +++ b/lib/Db/MessageMapper.php @@ -175,10 +175,18 @@ class MessageMapper extends QBMapper { ->from($this->getTableName()) ->where( $query->expr()->eq('mailbox_id', $query->createNamedParameter($mailbox->getId(), IQueryBuilder::PARAM_INT), IQueryBuilder::PARAM_INT), - $query->expr()->in('id', $query->createNamedParameter($ids, IQueryBuilder::PARAM_INT_ARRAY), IQueryBuilder::PARAM_INT_ARRAY) + $query->expr()->in('id', $query->createParameter('ids'), IQueryBuilder::PARAM_INT_ARRAY) ); - return $this->findUids($query); + $chunks = array_chunk($ids, 1000); + + $results = []; + foreach ($chunks as $chunk) { + $query->setParameter('ids', $chunk, IQueryBuilder::PARAM_INT_ARRAY); + $results[] = $this->findUids($query); + } + + return array_merge(...$results); } /** diff --git a/tests/psalm-baseline.xml b/tests/psalm-baseline.xml index 162a9b659..7f7a470e1 100644 --- a/tests/psalm-baseline.xml +++ b/tests/psalm-baseline.xml @@ -119,7 +119,6 @@ <code>$qb2->createNamedParameter($ids, IQueryBuilder::PARAM_INT_ARRAY)</code> <code>$qb2->createNamedParameter(array_keys($indexedMessages), IQueryBuilder::PARAM_INT_ARRAY)</code> <code>$qb4->createNamedParameter($ids, IQueryBuilder::PARAM_INT_ARRAY)</code> - <code>$query->createNamedParameter($ids, IQueryBuilder::PARAM_INT_ARRAY)</code> <code>$query->createNamedParameter($uids, IQueryBuilder::PARAM_INT_ARRAY)</code> </ImplicitToStringCast> </file> |