aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorblizzz <blizzz@arthur-schiwon.de>2022-06-29 21:50:40 +0200
committerGitHub <noreply@github.com>2022-06-29 21:50:40 +0200
commit17f8aa7a50264c4160ccdd7c350cea524d9966e4 (patch)
treef502a5e4219eb9f6d729e24d6f2a8ea14ae263ef
parent36a336bebd396b18084f19569af39138f11813ba (diff)
parent9188fad1908045aa88537ad389942e474f96bc6d (diff)
downloadnextcloud-server-17f8aa7a50264c4160ccdd7c350cea524d9966e4.tar.gz
nextcloud-server-17f8aa7a50264c4160ccdd7c350cea524d9966e4.zip
Merge pull request #33067 from nextcloud/trashbin-skip-size-cache
use size from cache to determine whether to skip the trashbin
-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;
}