summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorCôme Chilliet <91878298+come-nc@users.noreply.github.com>2023-03-13 22:10:47 +0100
committerGitHub <noreply@github.com>2023-03-13 22:10:47 +0100
commit71328107da996403e44c12586e1da8f26fa4d0f2 (patch)
tree18ba8807e3f353b1c6dffe39d5d069c026103b64 /lib
parente4504820a4e5af7b62568a07d245dc386d21d6bc (diff)
parent9b1d7794a826cd87d0dce77c9ba7691a71137e48 (diff)
downloadnextcloud-server-71328107da996403e44c12586e1da8f26fa4d0f2.tar.gz
nextcloud-server-71328107da996403e44c12586e1da8f26fa4d0f2.zip
Merge pull request #37029 from nextcloud/fix/chunk-objectids-in-systemtagobjectmapper
Add chunking in SystemTagObjectMapper::getTagIdsForObjects
Diffstat (limited to 'lib')
-rw-r--r--lib/private/SystemTag/SystemTagObjectMapper.php16
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/private/SystemTag/SystemTagObjectMapper.php b/lib/private/SystemTag/SystemTagObjectMapper.php
index 5a09a1754f2..b61a81a1fa7 100644
--- a/lib/private/SystemTag/SystemTagObjectMapper.php
+++ b/lib/private/SystemTag/SystemTagObjectMapper.php
@@ -77,23 +77,25 @@ class SystemTagObjectMapper implements ISystemTagObjectMapper {
->from(self::RELATION_TABLE)
->where($query->expr()->in('objectid', $query->createParameter('objectids')))
->andWhere($query->expr()->eq('objecttype', $query->createParameter('objecttype')))
- ->setParameter('objectids', $objIds, IQueryBuilder::PARAM_STR_ARRAY)
->setParameter('objecttype', $objectType)
->addOrderBy('objectid', 'ASC')
->addOrderBy('systemtagid', 'ASC');
-
+ $chunks = array_chunk($objIds, 900, false);
$mapping = [];
foreach ($objIds as $objId) {
$mapping[$objId] = [];
}
+ foreach ($chunks as $chunk) {
+ $query->setParameter('objectids', $chunk, IQueryBuilder::PARAM_STR_ARRAY);
+ $result = $query->executeQuery();
+ while ($row = $result->fetch()) {
+ $objectId = $row['objectid'];
+ $mapping[$objectId][] = $row['systemtagid'];
+ }
- $result = $query->execute();
- while ($row = $result->fetch()) {
- $objectId = $row['objectid'];
- $mapping[$objectId][] = $row['systemtagid'];
+ $result->closeCursor();
}
- $result->closeCursor();
return $mapping;
}