Skip to content

Commit

Permalink
Merge pull request #24296 from nextcloud/backport/stable19/23023
Browse files Browse the repository at this point in the history
[stable19] Delete files that exceed trashbin size immediately
  • Loading branch information
MorrisJobke authored Nov 23, 2020
2 parents 2a7c990 + 1a607b2 commit 5870bd2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions apps/files_trashbin/lib/Trashbin.php
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,14 @@ public static function move2trash($file_path, $ownerOnly = false) {
$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 {
Expand Down

0 comments on commit 5870bd2

Please sign in to comment.