return ['remote' => $remote];
}
+
+ public function getAllShares(): iterable {
+ $qb = $this->dbConnection->getQueryBuilder();
+
+ $qb->select('*')
+ ->from('share')
+ ->where(
+ $qb->expr()->orX(
+ $qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share\IShare::TYPE_REMOTE)),
+ $qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share\IShare::TYPE_REMOTE_GROUP))
+ )
+ );
+
+ $cursor = $qb->execute();
+ while($data = $cursor->fetch()) {
+ try {
+ $share = $this->createShareObject($data);
+ } catch (InvalidShare $e) {
+ continue;
+ } catch (ShareNotFound $e) {
+ continue;
+ }
+
+ yield $share;
+ }
+ $cursor->closeCursor();
+ }
}
return ['public' => $mail];
}
+ public function getAllShares(): iterable {
+ $qb = $this->dbConnection->getQueryBuilder();
+
+ $qb->select('*')
+ ->from('share')
+ ->where(
+ $qb->expr()->orX(
+ $qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share\IShare::TYPE_EMAIL))
+ )
+ );
+
+ $cursor = $qb->execute();
+ while($data = $cursor->fetch()) {
+ try {
+ $share = $this->createShareObject($data);
+ } catch (InvalidShare $e) {
+ continue;
+ } catch (ShareNotFound $e) {
+ continue;
+ }
+
+ yield $share;
+ }
+ $cursor->closeCursor();
+ }
}
}
}
+
+ 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();
+ }
}
return true;
}
+ public function getAllShares(): iterable {
+ $providers = $this->factory->getAllProviders();
+
+ foreach ($providers as $provider) {
+ yield from $provider->getAllShares();
+ }
+ }
}
*/
public function shareProviderExists($shareType);
+ /**
+ * @Internal
+ *
+ * Get all the shares as iterable to reduce memory overhead
+ * Note, since this opens up database cursors the iterable should
+ * be fully itterated.
+ *
+ * @return iterable
+ */
+ public function getAllShares(): iterable;
+
}
* @since 12
*/
public function getAccessList($nodes, $currentAccess);
+
+ /**
+ * Get all the shares in this provider returned as iterable to reduce memory
+ * overhead
+ *
+ * @return iterable
+ */
+ public function getAllShares(): iterable;
}