summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorLouis Chemineau <louis@chmn.me>2022-06-23 16:32:52 +0200
committerLouis (Rebase PR Action) <artonge@users.noreply.github.com>2022-07-26 12:17:46 +0000
commitf52506793083d44674586257eadb230d02b15bba (patch)
treee35095be933f48a86d43a86cb48175c645c3bf00 /apps
parent256ed34b7e4a3b151f7d94c5be22628e4872757a (diff)
downloadnextcloud-server-f52506793083d44674586257eadb230d02b15bba.tar.gz
nextcloud-server-f52506793083d44674586257eadb230d02b15bba.zip
Add argument to getSharesInFolder enable deep share lookup
Signed-off-by: Louis Chemineau <louis@chmn.me>
Diffstat (limited to 'apps')
-rw-r--r--apps/federatedfilesharing/lib/FederatedShareProvider.php11
-rw-r--r--apps/files_sharing/lib/Updater.php2
-rw-r--r--apps/sharebymail/lib/ShareByMailProvider.php12
3 files changed, 17 insertions, 8 deletions
diff --git a/apps/federatedfilesharing/lib/FederatedShareProvider.php b/apps/federatedfilesharing/lib/FederatedShareProvider.php
index 52b10cd9315..d504a3e2acc 100644
--- a/apps/federatedfilesharing/lib/FederatedShareProvider.php
+++ b/apps/federatedfilesharing/lib/FederatedShareProvider.php
@@ -638,7 +638,7 @@ class FederatedShareProvider implements IShareProvider {
}
- public function getSharesInFolder($userId, Folder $node, $reshares) {
+ public function getSharesInFolder($userId, Folder $node, $reshares, $shallow = true) {
$qb = $this->dbConnection->getQueryBuilder();
$qb->select('*')
->from('share', 's')
@@ -664,8 +664,13 @@ class FederatedShareProvider implements IShareProvider {
);
}
- $qb->innerJoin('s', 'filecache' ,'f', $qb->expr()->eq('s.file_source', 'f.fileid'));
- $qb->andWhere($qb->expr()->eq('f.parent', $qb->createNamedParameter($node->getId())));
+ $qb->innerJoin('s', 'filecache', 'f', $qb->expr()->eq('s.file_source', 'f.fileid'));
+
+ if ($shallow) {
+ $qb->andWhere($qb->expr()->eq('f.parent', $qb->createNamedParameter($node->getId())));
+ } else {
+ $qb->andWhere($qb->expr()->like('f.path', $qb->createNamedParameter($this->dbConnection->escapeLikeParameter($node->getInternalPath()) . '/%')));
+ }
$qb->orderBy('id');
diff --git a/apps/files_sharing/lib/Updater.php b/apps/files_sharing/lib/Updater.php
index 071d4d3cca9..59e06e60299 100644
--- a/apps/files_sharing/lib/Updater.php
+++ b/apps/files_sharing/lib/Updater.php
@@ -69,7 +69,7 @@ class Updater {
$shares = array_merge($shares, $shareManager->getSharesBy($userFolder->getOwner()->getUID(), IShare::TYPE_ROOM, $src, false, -1));
if ($src instanceof Folder) {
- $subShares = $shareManager->getSharesInFolderRecursive($userFolder->getOwner()->getUID(), $src, false);
+ $subShares = $shareManager->getSharesInFolder($userFolder->getOwner()->getUID(), $src, false, false);
foreach ($subShares as $subShare) {
$shares = array_merge($shares, array_values($subShare));
}
diff --git a/apps/sharebymail/lib/ShareByMailProvider.php b/apps/sharebymail/lib/ShareByMailProvider.php
index ee14e354c52..01dd3b428d1 100644
--- a/apps/sharebymail/lib/ShareByMailProvider.php
+++ b/apps/sharebymail/lib/ShareByMailProvider.php
@@ -75,7 +75,6 @@ use OCP\Share\IShareProvider;
* @package OCA\ShareByMail
*/
class ShareByMailProvider implements IShareProvider {
-
private IConfig $config;
/** @var IDBConnection */
@@ -1159,7 +1158,7 @@ class ShareByMailProvider implements IShareProvider {
return $data;
}
- public function getSharesInFolder($userId, Folder $node, $reshares) {
+ public function getSharesInFolder($userId, Folder $node, $reshares, $shallow = true) {
$qb = $this->dbConnection->getQueryBuilder();
$qb->select('*')
->from('share', 's')
@@ -1185,8 +1184,13 @@ class ShareByMailProvider implements IShareProvider {
);
}
- $qb->innerJoin('s', 'filecache' ,'f', $qb->expr()->eq('s.file_source', 'f.fileid'));
- $qb->andWhere($qb->expr()->eq('f.parent', $qb->createNamedParameter($node->getId())));
+ $qb->innerJoin('s', 'filecache', 'f', $qb->expr()->eq('s.file_source', 'f.fileid'));
+
+ if ($shallow) {
+ $qb->andWhere($qb->expr()->eq('f.parent', $qb->createNamedParameter($node->getId())));
+ } else {
+ $qb->andWhere($qb->expr()->like('f.path', $qb->createNamedParameter($this->dbConnection->escapeLikeParameter($node->getInternalPath()) . '/%')));
+ }
$qb->orderBy('id');