aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Comments
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/Comments')
-rw-r--r--lib/private/Comments/Manager.php24
1 files changed, 16 insertions, 8 deletions
diff --git a/lib/private/Comments/Manager.php b/lib/private/Comments/Manager.php
index 00cf323bfbf..c5fb4ebfe34 100644
--- a/lib/private/Comments/Manager.php
+++ b/lib/private/Comments/Manager.php
@@ -1031,6 +1031,7 @@ class Manager implements ICommentsManager {
->select('message_id')
->from('reactions')
->where($qb->expr()->eq('parent_id', $qb->createNamedParameter($parentId)))
+ ->orderBy('message_id', 'DESC')
->executeQuery();
$commentIds = [];
@@ -1106,22 +1107,29 @@ class Manager implements ICommentsManager {
if (!$commentIds) {
return [];
}
- $query = $this->dbConn->getQueryBuilder();
+ $chunks = array_chunk($commentIds, 500);
+
+ $query = $this->dbConn->getQueryBuilder();
$query->select('*')
->from('comments')
- ->where($query->expr()->in('id', $query->createNamedParameter($commentIds, IQueryBuilder::PARAM_STR_ARRAY)))
+ ->where($query->expr()->in('id', $query->createParameter('ids')))
->orderBy('creation_timestamp', 'DESC')
->addOrderBy('id', 'DESC');
$comments = [];
- $result = $query->executeQuery();
- while ($data = $result->fetch()) {
- $comment = $this->getCommentFromData($data);
- $this->cache($comment);
- $comments[] = $comment;
+ foreach ($chunks as $ids) {
+ $query->setParameter('ids', $ids, IQueryBuilder::PARAM_STR_ARRAY);
+
+ $result = $query->executeQuery();
+ while ($data = $result->fetch()) {
+ $comment = $this->getCommentFromData($data);
+ $this->cache($comment);
+ $comments[] = $comment;
+ }
+ $result->closeCursor();
}
- $result->closeCursor();
+
return $comments;
}