]> source.dussan.org Git - nextcloud-server.git/commitdiff
for the DB ot pick an index specify the object_type 19285/head
authorArthur Schiwon <blizzz@arthur-schiwon.de>
Mon, 3 Feb 2020 15:17:25 +0000 (16:17 +0100)
committerBackportbot <backportbot-noreply@rullzer.com>
Mon, 3 Feb 2020 20:26:17 +0000 (20:26 +0000)
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
lib/private/Comments/Manager.php

index e54218509dcc1bef52926f27c08f658dbecc4fac..1d48f626778cabea1aa0926a5c2fb38f546b122e 100644 (file)
@@ -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(