From 7d455d8de5c49fa83839357bdda4ecc6917dd9e0 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 4 Nov 2019 11:14:05 +0100 Subject: [PATCH] Update share provider with the missing method Signed-off-by: Joas Schilling --- lib/Share/RoomShareProvider.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/lib/Share/RoomShareProvider.php b/lib/Share/RoomShareProvider.php index 86aa89d7d..17228d07a 100644 --- a/lib/Share/RoomShareProvider.php +++ b/lib/Share/RoomShareProvider.php @@ -1118,4 +1118,30 @@ class RoomShareProvider implements IShareProvider { } } + /** + * Get all the shares in this provider returned as iterable to reduce memory + * overhead + * + * @return iterable + * @since 18.0.0 + */ + public function getAllShares(): iterable { + $qb = $this->dbConnection->getQueryBuilder(); + + $qb->select('*') + ->from('share') + ->where( + $qb->expr()->orX( + $qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_ROOM)) + ) + ); + + $cursor = $qb->execute(); + while($data = $cursor->fetch()) { + $share = $this->createShareObject($data); + + yield $share; + } + $cursor->closeCursor(); + } }