aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_trashbin/lib/Command/ExpireTrash.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_trashbin/lib/Command/ExpireTrash.php')
-rw-r--r--apps/files_trashbin/lib/Command/ExpireTrash.php8
1 files changed, 4 insertions, 4 deletions
diff --git a/apps/files_trashbin/lib/Command/ExpireTrash.php b/apps/files_trashbin/lib/Command/ExpireTrash.php
index de1c2ab09b4..422d8379984 100644
--- a/apps/files_trashbin/lib/Command/ExpireTrash.php
+++ b/apps/files_trashbin/lib/Command/ExpireTrash.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud GmbH.
@@ -8,7 +9,6 @@ namespace OCA\Files_Trashbin\Command;
use OC\Files\View;
use OCA\Files_Trashbin\Expiration;
-use OCA\Files_Trashbin\Helper;
use OCA\Files_Trashbin\Trashbin;
use OCP\IUser;
use OCP\IUserManager;
@@ -45,8 +45,9 @@ class ExpireTrash extends Command {
}
protected function execute(InputInterface $input, OutputInterface $output): int {
+ $minAge = $this->expiration->getMinAgeAsTimestamp();
$maxAge = $this->expiration->getMaxAgeAsTimestamp();
- if (!$maxAge) {
+ if ($minAge === false && $maxAge === false) {
$output->writeln('Auto expiration is configured - keeps files and folders in the trash bin for 30 days and automatically deletes anytime after that if space is needed (note: files may not be deleted if space is not needed)');
return 1;
}
@@ -84,8 +85,7 @@ class ExpireTrash extends Command {
if (!$this->setupFS($uid)) {
return;
}
- $dirContent = Helper::getTrashFiles('/', $uid, 'mtime');
- Trashbin::deleteExpiredFiles($dirContent, $uid);
+ Trashbin::expire($uid);
} catch (\Throwable $e) {
$this->logger->error('Error while expiring trashbin for user ' . $user->getUID(), ['exception' => $e]);
}