diff options
author | Louis Chemineau <louis@chmn.me> | 2022-06-23 16:32:52 +0200 |
---|---|---|
committer | Louis (Rebase PR Action) <artonge@users.noreply.github.com> | 2022-07-26 12:17:46 +0000 |
commit | f52506793083d44674586257eadb230d02b15bba (patch) | |
tree | e35095be933f48a86d43a86cb48175c645c3bf00 /lib/private/Share20/Manager.php | |
parent | 256ed34b7e4a3b151f7d94c5be22628e4872757a (diff) | |
download | nextcloud-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 'lib/private/Share20/Manager.php')
-rw-r--r-- | lib/private/Share20/Manager.php | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php index fd1a27af8cf..46f256df54d 100644 --- a/lib/private/Share20/Manager.php +++ b/lib/private/Share20/Manager.php @@ -1303,11 +1303,11 @@ class Manager implements IManager { return $provider->move($share, $recipientId); } - public function getSharesInFolder($userId, Folder $node, $reshares = false) { + public function getSharesInFolder($userId, Folder $node, $reshares = false, $shallow = true) { $providers = $this->factory->getAllProviders(); - return array_reduce($providers, function ($shares, IShareProvider $provider) use ($userId, $node, $reshares) { - $newShares = $provider->getSharesInFolder($userId, $node, $reshares); + return array_reduce($providers, function ($shares, IShareProvider $provider) use ($userId, $node, $reshares, $shallow) { + $newShares = $provider->getSharesInFolder($userId, $node, $reshares, $shallow); foreach ($newShares as $fid => $data) { if (!isset($shares[$fid])) { $shares[$fid] = []; @@ -1319,24 +1319,6 @@ class Manager implements IManager { }, []); } - public function getSharesInFolderRecursive(string $userId, Folder $node, $reshares = false) { - $shares = $this->getSharesInFolder($userId, $node, $reshares); - - foreach ($node->getDirectoryListing() as $subnode) { - if (!$subnode instanceof Folder) { - continue; - } - - $subShares = $this->getSharesInFolderRecursive($userId, $subnode, $reshares); - - foreach ($subShares as $fileId => $subSharesForFile) { - $shares[$fileId] = array_merge($shares[$fileId] ?? [], $subSharesForFile); - } - } - - return $shares; - } - /** * @inheritdoc */ |