Merge pull request #24296 from nextcloud/backport/stable19/23023

[stable19] Delete files that exceed trashbin size immediately
This commit is contained in:
Morris Jobke 2020-11-23 21:07:46 +01:00 committed by GitHub
commit 5870bd2383
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -287,6 +287,14 @@ class Trashbin {
$trashStorage->unlink($trashInternalPath);
}
$config = \OC::$server->getConfig();
$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) {
return false;
}
$trashStorage->getUpdater()->renameFromStorage($sourceStorage, $sourceInternalPath, $trashInternalPath);
try {