summaryrefslogtreecommitdiffstats
path: root/apps/files_trashbin/lib
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2022-06-29 17:53:22 +0200
committerRobin Appelman <robin@icewind.nl>2022-06-29 18:24:34 +0200
commit9188fad1908045aa88537ad389942e474f96bc6d (patch)
tree1e7a3ab866bfc0582182560b746868dab77176da /apps/files_trashbin/lib
parent477dae9e1192203f460ae63e6744779fb813defd (diff)
downloadnextcloud-server-9188fad1908045aa88537ad389942e474f96bc6d.tar.gz
nextcloud-server-9188fad1908045aa88537ad389942e474f96bc6d.zip
use size from cache to determine whether to skip the trashbin
this way large folders also get skipped Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'apps/files_trashbin/lib')
-rw-r--r--apps/files_trashbin/lib/Trashbin.php16
1 files changed, 11 insertions, 5 deletions
diff --git a/apps/files_trashbin/lib/Trashbin.php b/apps/files_trashbin/lib/Trashbin.php
index 72072a2588c..d449a136016 100644
--- a/apps/files_trashbin/lib/Trashbin.php
+++ b/apps/files_trashbin/lib/Trashbin.php
@@ -255,8 +255,15 @@ class Trashbin {
}
$ownerView = new View('/' . $owner);
+
// file has been deleted in between
- if (is_null($ownerPath) || $ownerPath === '' || !$ownerView->file_exists('/files/' . $ownerPath)) {
+ if (is_null($ownerPath) || $ownerPath === '') {
+ return true;
+ }
+
+ $sourceInfo = $ownerView->getFileInfo('/files/' . $ownerPath);
+
+ if ($sourceInfo === false) {
return true;
}
@@ -297,9 +304,8 @@ class Trashbin {
}
}
- /** @var \OC\Files\Storage\Storage $sourceStorage */
- [$sourceStorage, $sourceInternalPath] = $ownerView->resolvePath('/files/' . $ownerPath);
-
+ $sourceStorage = $sourceInfo->getStorage();
+ $sourceInternalPath = $sourceInfo->getInternalPath();
if ($trashStorage->file_exists($trashInternalPath)) {
$trashStorage->unlink($trashInternalPath);
@@ -309,7 +315,7 @@ class Trashbin {
$systemTrashbinSize = (int)$config->getAppValue('files_trashbin', 'trashbin_size', '-1');
$userTrashbinSize = (int)$config->getUserValue($owner, 'files_trashbin', 'trashbin_size', '-1');
$configuredTrashbinSize = ($userTrashbinSize < 0) ? $systemTrashbinSize : $userTrashbinSize;
- if ($configuredTrashbinSize >= 0 && $sourceStorage->filesize($sourceInternalPath) >= $configuredTrashbinSize) {
+ if ($configuredTrashbinSize >= 0 && $sourceInfo->getSize() >= $configuredTrashbinSize) {
return false;
}