Skip to content

Commit 736898e

Browse files
nickvergessenblizzz
authored andcommitted
Fix populating the array and closing the cursors
Signed-off-by: Joas Schilling <[email protected]>
1 parent edb3b0d commit 736898e

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

lib/private/Comments/Manager.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -654,16 +654,16 @@ public function getNumberOfUnreadCommentsForObjects(string $objectType, array $o
654654
$query->andWhere($query->expr()->eq('c.verb', $query->createNamedParameter($verb)));
655655
}
656656

657+
$unreadComments = array_fill_keys($objectIds, 0);
657658
foreach (array_chunk($objectIds, 1000) as $chunk) {
658659
$query->setParameter('ids', $chunk, IQueryBuilder::PARAM_INT_ARRAY);
659-
$result = $query->execute();
660660

661-
$unreadComments += array_fill_keys($objectIds, 0);
661+
$result = $query->executeQuery();
662662
while ($row = $result->fetch()) {
663663
$unreadComments[$row['object_id']] = (int) $row['num_comments'];
664664
}
665+
$result->closeCursor();
665666
}
666-
$result->closeCursor();
667667

668668
return $unreadComments;
669669
}

0 commit comments

Comments
 (0)