summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@owncloud.com>2016-03-23 11:13:59 +0100
committerJoas Schilling <nickvergessen@owncloud.com>2016-03-23 11:16:37 +0100
commitaa95ac6bc811e6dca4e04410467b94b4f0170c99 (patch)
treeabb7706353af9d5745ea9dd98f5f06eeea28becf /apps
parenta9518580003361a9bcefd0ef47c9babbe299db50 (diff)
downloadnextcloud-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.php19
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;
}