diff options
author | Julius Härtl <jus@bitgrid.net> | 2020-09-23 16:38:24 +0200 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2020-09-23 16:58:18 +0200 |
commit | 3c47aaa2b1cc7f6045784a12edbd36fa7925fe72 (patch) | |
tree | a4388fed1bde4f0780e4e314aa16a09308d12617 /apps | |
parent | 7d0602792280f88af6867db0131d1bf8984b2c2c (diff) | |
download | nextcloud-server-3c47aaa2b1cc7f6045784a12edbd36fa7925fe72.tar.gz nextcloud-server-3c47aaa2b1cc7f6045784a12edbd36fa7925fe72.zip |
Delete files that exceed trashbin size immediately
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_trashbin/lib/Trashbin.php | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/apps/files_trashbin/lib/Trashbin.php b/apps/files_trashbin/lib/Trashbin.php index 276cdf4e2d9..b1e1d0600b0 100644 --- a/apps/files_trashbin/lib/Trashbin.php +++ b/apps/files_trashbin/lib/Trashbin.php @@ -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); |