Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/groupfolders.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2022-10-26 15:46:51 +0300
committerGitHub <noreply@github.com>2022-10-26 15:46:51 +0300
commit8b06c8752cd8a741f8bf36d1981141955077ad20 (patch)
tree96d6c3f413f44fa2908df0b8bd7179f519ae9339
parentf6e8e874d65ab2178e30a99cca62d167b978f0c8 (diff)
parentbf9bd050a19b144b59258f0546bce3ef33d88c06 (diff)
Merge pull request #2157 from nextcloud/backport/2154/stable23
[stable23] Move check if node exists earlier
-rw-r--r--lib/Trash/TrashBackend.php20
1 files changed, 12 insertions, 8 deletions
diff --git a/lib/Trash/TrashBackend.php b/lib/Trash/TrashBackend.php
index a1ec0604..c0edff6c 100644
--- a/lib/Trash/TrashBackend.php
+++ b/lib/Trash/TrashBackend.php
@@ -368,20 +368,24 @@ class TrashBackend implements ITrashBackend {
$nodes = []; // cache
foreach ($trashItems as $groupTrashItem) {
$nodeName = $groupTrashItem['name'] . '.d' . $groupTrashItem['deleted_time'];
- $nodes[$nodeName] = $node = $trashFolder->get($nodeName);
+ try {
+ $nodes[$nodeName] = $node = $trashFolder->get($nodeName);
+ } catch (NotFoundException $e) {
+ $this->trashManager->removeItem($folderId, $groupTrashItem['name'], $groupTrashItem['deleted_time']);
+ continue;
+ }
$sizeInTrash += $node->getSize();
}
foreach ($trashItems as $groupTrashItem) {
if ($expiration->isExpired($groupTrashItem['deleted_time'], $folder['quota'] > 0 && $folder['quota'] < ($folder['size'] + $sizeInTrash))) {
- try {
- $nodeName = $groupTrashItem['name'] . '.d' . $groupTrashItem['deleted_time'];
- $node = $nodes[$nodeName];
- $size += $node->getSize();
- $count += 1;
- } catch (NotFoundException $e) {
- $this->trashManager->removeItem($folderId, $groupTrashItem['name'], $groupTrashItem['deleted_time']);
+ $nodeName = $groupTrashItem['name'] . '.d' . $groupTrashItem['deleted_time'];
+ if (!isset($nodes[$nodeName])) {
continue;
}
+
+ $node = $nodes[$nodeName];
+ $size += $node->getSize();
+ $count += 1;
if ($node->getStorage()->unlink($node->getInternalPath()) === false) {
throw new \Exception('Failed to remove item from trashbin');
}