Skip to content

Commit 5870bd2

Browse files
authored
Merge pull request #24296 from nextcloud/backport/stable19/23023
[stable19] Delete files that exceed trashbin size immediately
2 parents 2a7c990 + 1a607b2 commit 5870bd2

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

apps/files_trashbin/lib/Trashbin.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,14 @@ public static function move2trash($file_path, $ownerOnly = false) {
287287
$trashStorage->unlink($trashInternalPath);
288288
}
289289

290+
$config = \OC::$server->getConfig();
291+
$systemTrashbinSize = (int)$config->getAppValue('files_trashbin', 'trashbin_size', '-1');
292+
$userTrashbinSize = (int)$config->getUserValue($owner, 'files_trashbin', 'trashbin_size', '-1');
293+
$configuredTrashbinSize = ($userTrashbinSize < 0) ? $systemTrashbinSize : $userTrashbinSize;
294+
if ($configuredTrashbinSize >= 0 && $sourceStorage->filesize($sourceInternalPath) >= $configuredTrashbinSize) {
295+
return false;
296+
}
297+
290298
$trashStorage->getUpdater()->renameFromStorage($sourceStorage, $sourceInternalPath, $trashInternalPath);
291299

292300
try {

0 commit comments

Comments
 (0)