diff options
author | Joas Schilling <nickvergessen@owncloud.com> | 2016-03-23 11:13:59 +0100 |
---|---|---|
committer | Joas Schilling <nickvergessen@owncloud.com> | 2016-03-23 11:16:37 +0100 |
commit | aa95ac6bc811e6dca4e04410467b94b4f0170c99 (patch) | |
tree | abb7706353af9d5745ea9dd98f5f06eeea28becf /apps | |
parent | a9518580003361a9bcefd0ef47c9babbe299db50 (diff) | |
download | nextcloud-server-aa95ac6bc811e6dca4e04410467b94b4f0170c99.tar.gz nextcloud-server-aa95ac6bc811e6dca4e04410467b94b4f0170c99.zip |
Chunk the shareId query
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_sharing/lib/propagation/recipientpropagator.php | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/apps/files_sharing/lib/propagation/recipientpropagator.php b/apps/files_sharing/lib/propagation/recipientpropagator.php index 407664f31b7..86c22a93628 100644 --- a/apps/files_sharing/lib/propagation/recipientpropagator.php +++ b/apps/files_sharing/lib/propagation/recipientpropagator.php @@ -133,20 +133,25 @@ class RecipientPropagator { */ protected function getPropagationTimestampForShares(array $sharePropagations) { $sql = \OC::$server->getDatabaseConnection()->getQueryBuilder(); - $shareIds = array_keys($sharePropagations); + $allShareIds = array_keys($sharePropagations); + + $shareIdChunks = array_chunk($allShareIds, 50); $sql->select(['configkey', 'configvalue']) ->from('appconfig') ->where($sql->expr()->eq('appid', $sql->createParameter('appid'))) ->andWhere($sql->expr()->in('configkey', $sql->createParameter('shareids'))) - ->setParameter('appid', 'files_sharing', \PDO::PARAM_STR) - ->setParameter('shareids', $shareIds, Connection::PARAM_INT_ARRAY); - $result = $sql->execute(); + ->setParameter('appid', 'files_sharing', \PDO::PARAM_STR); + + foreach ($shareIdChunks as $shareIds) { + $sql->setParameter('shareids', $shareIds, Connection::PARAM_INT_ARRAY); + $result = $sql->execute(); - while ($row = $result->fetch()) { - $sharePropagations[(int) $row['configkey']] = $row['configvalue']; + while ($row = $result->fetch()) { + $sharePropagations[(int) $row['configkey']] = $row['configvalue']; + } + $result->closeCursor(); } - $result->closeCursor(); return $sharePropagations; } |