aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2020-11-23 21:06:33 +0100
committerGitHub <noreply@github.com>2020-11-23 21:06:33 +0100
commite3750105896281735c141d61859b11b24b34d6aa (patch)
tree0a006044f6b129060b319025e97ef8f86ebac1d9
parentfcaa75858cfbadf15671c0674c9f250c4ec5b481 (diff)
parente241f14f24bbefdcf972d1d4ec7d8ea5fb0122f2 (diff)
downloadnextcloud-server-e3750105896281735c141d61859b11b24b34d6aa.tar.gz
nextcloud-server-e3750105896281735c141d61859b11b24b34d6aa.zip
Merge pull request #24297 from nextcloud/backport/stable20/23023
[stable20] Delete files that exceed trashbin size immediately
-rw-r--r--apps/files_trashbin/lib/Trashbin.php8
1 files changed, 8 insertions, 0 deletions
diff --git a/apps/files_trashbin/lib/Trashbin.php b/apps/files_trashbin/lib/Trashbin.php
index 7f83cbbc8a5..91f3cec21ee 100644
--- a/apps/files_trashbin/lib/Trashbin.php
+++ b/apps/files_trashbin/lib/Trashbin.php
@@ -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 {