mirror of
https://github.com/nextcloud/server.git
synced 2026-06-10 17:23:59 -04:00
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>
This commit is contained in:
parent
477dae9e11
commit
9188fad190
1 changed files with 11 additions and 5 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue