Merge pull request #23023 from nextcloud/bugfix/noid/trashbin-size-delete-immediately

Delete files that exceed trashbin size immediately
This commit is contained in:
Roeland Jago Douma 2020-09-24 14:45:04 +02:00 committed by GitHub
commit 82ca70a580
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -285,6 +285,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;
}
$connection = \OC::$server->getDatabaseConnection();
$connection->beginTransaction();
$trashStorage->getUpdater()->renameFromStorage($sourceStorage, $sourceInternalPath, $trashInternalPath);