summaryrefslogtreecommitdiffstats
path: root/apps/dav
diff options
context:
space:
mode:
Diffstat (limited to 'apps/dav')
-rw-r--r--apps/dav/lib/CardDAV/CardDavBackend.php26
1 files changed, 16 insertions, 10 deletions
diff --git a/apps/dav/lib/CardDAV/CardDavBackend.php b/apps/dav/lib/CardDAV/CardDavBackend.php
index b8491c08ff6..f7e0a017803 100644
--- a/apps/dav/lib/CardDAV/CardDavBackend.php
+++ b/apps/dav/lib/CardDAV/CardDavBackend.php
@@ -482,23 +482,29 @@ class CardDavBackend implements BackendInterface, SyncSupport {
* @return array
*/
function getMultipleCards($addressBookId, array $uris) {
+ if (empty($uris)) {
+ return [];
+ }
+
+ $chunks = array_chunk($uris, 100);
+ $cards = [];
+
$query = $this->db->getQueryBuilder();
$query->select(['id', 'uri', 'lastmodified', 'etag', 'size', 'carddata'])
->from('cards')
->where($query->expr()->eq('addressbookid', $query->createNamedParameter($addressBookId)))
- ->andWhere($query->expr()->in('uri', $query->createParameter('uri')))
- ->setParameter('uri', $uris, IQueryBuilder::PARAM_STR_ARRAY);
+ ->andWhere($query->expr()->in('uri', $query->createParameter('uri')));
- $cards = [];
+ foreach ($chunks as $uris) {
+ $query->setParameter('uri', $uris, IQueryBuilder::PARAM_STR_ARRAY);
+ $result = $query->execute();
- $result = $query->execute();
- while($row = $result->fetch()) {
- $row['etag'] = '"' . $row['etag'] . '"';
- $row['carddata'] = $this->readBlob($row['carddata']);
- $cards[] = $row;
+ while($row = $result->fetch()) {
+ $row['etag'] = '"' . $row['etag'] . '"';
+ $row['carddata'] = $this->readBlob($row['carddata']);
+ $cards[] = $row;
+ }
}
- $result->closeCursor();
-
return $cards;
}