summaryrefslogtreecommitdiffstats
path: root/lib/private/Share20
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/Share20')
-rw-r--r--lib/private/Share20/DefaultShareProvider.php26
-rw-r--r--lib/private/Share20/Manager.php7
2 files changed, 33 insertions, 0 deletions
diff --git a/lib/private/Share20/DefaultShareProvider.php b/lib/private/Share20/DefaultShareProvider.php
index aea50dfcdb6..05b3094e6a2 100644
--- a/lib/private/Share20/DefaultShareProvider.php
+++ b/lib/private/Share20/DefaultShareProvider.php
@@ -1382,4 +1382,30 @@ class DefaultShareProvider implements IShareProvider {
}
}
+
+ public function getAllShares(): iterable {
+ $qb = $this->dbConn->getQueryBuilder();
+
+ $qb->select('*')
+ ->from('share')
+ ->where(
+ $qb->expr()->orX(
+ $qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share\IShare::TYPE_USER)),
+ $qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share\IShare::TYPE_GROUP)),
+ $qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share\IShare::TYPE_LINK))
+ )
+ );
+
+ $cursor = $qb->execute();
+ while($data = $cursor->fetch()) {
+ try {
+ $share = $this->createShare($data);
+ } catch (InvalidShare $e) {
+ continue;
+ }
+
+ yield $share;
+ }
+ $cursor->closeCursor();
+ }
}
diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php
index 2e8e6f9a3af..df537062e4a 100644
--- a/lib/private/Share20/Manager.php
+++ b/lib/private/Share20/Manager.php
@@ -1671,4 +1671,11 @@ class Manager implements IManager {
return true;
}
+ public function getAllShares(): iterable {
+ $providers = $this->factory->getAllProviders();
+
+ foreach ($providers as $provider) {
+ yield from $provider->getAllShares();
+ }
+ }
}