mirror of
https://github.com/nextcloud/server.git
synced 2026-06-08 08:16:43 -04:00
Fix more than 1000 entries in queries exception in CardDavBackend
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
This commit is contained in:
parent
69d9c1d7c7
commit
2528a46dc2
1 changed files with 10 additions and 7 deletions
|
|
@ -1130,15 +1130,18 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
|||
return (int)$match['cardid'];
|
||||
}, $matches);
|
||||
|
||||
$query = $this->db->getQueryBuilder();
|
||||
$query->select('c.addressbookid', 'c.carddata', 'c.uri')
|
||||
->from($this->dbCardsTable, 'c')
|
||||
->where($query->expr()->in('c.id', $query->createNamedParameter($matches, IQueryBuilder::PARAM_INT_ARRAY)));
|
||||
$cards = [];
|
||||
foreach (array_chunk($matches, 1000) as $matche) {
|
||||
$query = $this->db->getQueryBuilder();
|
||||
$query->select('c.addressbookid', 'c.carddata', 'c.uri')
|
||||
->from($this->dbCardsTable, 'c')
|
||||
->where($query->expr()->in('c.id', $query->createNamedParameter($matche, IQueryBuilder::PARAM_INT_ARRAY)));
|
||||
|
||||
$result = $query->execute();
|
||||
$cards = $result->fetchAll();
|
||||
$result = $query->execute();
|
||||
$cards = array_merge($cards, $result->fetchAll());
|
||||
$result->closeCursor();
|
||||
}
|
||||
|
||||
$result->closeCursor();
|
||||
|
||||
return array_map(function ($array) {
|
||||
$array['addressbookid'] = (int) $array['addressbookid'];
|
||||
|
|
|
|||
Loading…
Reference in a new issue