summaryrefslogtreecommitdiffstats
path: root/lib/private/Share20/Manager.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/Share20/Manager.php')
-rw-r--r--lib/private/Share20/Manager.php71
1 files changed, 28 insertions, 43 deletions
diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php
index 0dade2f7126..292b07d28d5 100644
--- a/lib/private/Share20/Manager.php
+++ b/lib/private/Share20/Manager.php
@@ -266,8 +266,8 @@ class Manager implements IManager {
// Check that read permissions are always set
// Link shares are allowed to have no read permissions to allow upload to hidden folders
- $noReadPermissionRequired = $share->getShareType() !== \OCP\Share::SHARE_TYPE_LINK
- || $share->getShareType() !== \OCP\Share::SHARE_TYPE_EMAIL;
+ $noReadPermissionRequired = $share->getShareType() === \OCP\Share::SHARE_TYPE_LINK
+ || $share->getShareType() === \OCP\Share::SHARE_TYPE_EMAIL;
if (!$noReadPermissionRequired &&
($share->getPermissions() & \OCP\Constants::PERMISSION_READ) === 0) {
throw new \InvalidArgumentException('Shares need at least read permissions');
@@ -936,59 +936,49 @@ class Manager implements IManager {
* Work around so we don't return expired shares but still follow
* proper pagination.
*/
- if ($shareType === \OCP\Share::SHARE_TYPE_LINK) {
- $shares2 = [];
- while(true) {
- $added = 0;
- foreach ($shares as $share) {
+ $shares2 = [];
- $added++;
- $shares2[] = $share;
+ while(true) {
+ $added = 0;
+ foreach ($shares as $share) {
- if (count($shares2) === $limit) {
- break;
- }
+ try {
+ $this->checkExpireDate($share);
+ } catch (ShareNotFound $e) {
+ //Ignore since this basically means the share is deleted
+ continue;
}
- if (count($shares2) === $limit) {
- break;
- }
+ $added++;
+ $shares2[] = $share;
- // If there was no limit on the select we are done
- if ($limit === -1) {
+ if (count($shares2) === $limit) {
break;
}
+ }
- $offset += $added;
-
- // Fetch again $limit shares
- $shares = $provider->getSharesBy($userId, $shareType, $path, $reshares, $limit, $offset);
+ if (count($shares2) === $limit) {
+ break;
+ }
- // No more shares means we are done
- if (empty($shares)) {
- break;
- }
+ // If there was no limit on the select we are done
+ if ($limit === -1) {
+ break;
}
- $shares = $shares2;
- }
+ $offset += $added;
+ // Fetch again $limit shares
+ $shares = $provider->getSharesBy($userId, $shareType, $path, $reshares, $limit, $offset);
- // remove all shares which are already expired
- foreach ($shares as $key => $share) {
- try {
- $this->checkExpireDate($share);
- } catch (ShareNotFound $e) {
- unset($shares[$key]);
- try {
- $this->deleteShare($share);
- } catch (NotFoundException $e) {
- //Ignore since this basically means the share is deleted
- }
+ // No more shares means we are done
+ if (empty($shares)) {
+ break;
}
}
+ $shares = $shares2;
return $shares;
}
@@ -1011,11 +1001,6 @@ class Manager implements IManager {
$this->checkExpireDate($share);
} catch (ShareNotFound $e) {
unset($shares[$key]);
- try {
- $this->deleteShare($share);
- } catch (NotFoundException $e) {
- //Ignore since this basically means the share is deleted
- }
}
}