]> source.dussan.org Git - nextcloud-server.git/commitdiff
Delete files that exceed trashbin size immediately 24297/head
authorJulius Härtl <jus@bitgrid.net>
Wed, 23 Sep 2020 14:38:24 +0000 (16:38 +0200)
committerJulius Härtl <jus@bitgrid.net>
Mon, 23 Nov 2020 08:11:53 +0000 (09:11 +0100)
Signed-off-by: Julius Härtl <jus@bitgrid.net>
apps/files_trashbin/lib/Trashbin.php

index 7f83cbbc8a51c1a4ee2fd0ca0647e774445657d0..91f3cec21ee780d836fdba03b9503c724b6008a8 100644 (file)
@@ -304,6 +304,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 {