From 4d0ef01cc09a23995ab611bf36703eba9b5c7773 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Mon, 3 Feb 2020 16:17:25 +0100 Subject: [PATCH] for the DB ot pick an index specify the object_type Signed-off-by: Arthur Schiwon --- lib/private/Comments/Manager.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/private/Comments/Manager.php b/lib/private/Comments/Manager.php index 024dd58b89..84ef3d92a4 100644 --- a/lib/private/Comments/Manager.php +++ b/lib/private/Comments/Manager.php @@ -600,11 +600,13 @@ class Manager implements ICommentsManager { $query = $qb->select('f.fileid') ->addSelect($qb->func()->count('c.id', 'num_ids')) ->from('filecache', 'f') - ->leftJoin('f', 'comments', 'c', $qb->expr()->eq( - 'f.fileid', $qb->expr()->castColumn('c.object_id', IQueryBuilder::PARAM_INT) + ->leftJoin('f', 'comments', 'c', $qb->expr()->andX( + $qb->expr()->eq('f.fileid', $qb->expr()->castColumn('c.object_id', IQueryBuilder::PARAM_INT)), + $qb->expr()->eq('c.object_type', $qb->createNamedParameter('files')) )) - ->leftJoin('c', 'comments_read_markers', 'm', $qb->expr()->eq( - 'c.object_id', 'm.object_id' + ->leftJoin('c', 'comments_read_markers', 'm', $qb->expr()->andX( + $qb->expr()->eq('c.object_id', 'm.object_id'), + $qb->expr()->eq('m.object_type', $qb->createNamedParameter('files')) )) ->where( $qb->expr()->andX(