aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_trashbin/lib/Command
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_trashbin/lib/Command')
-rw-r--r--apps/files_trashbin/lib/Command/Expire.php1
-rw-r--r--apps/files_trashbin/lib/Command/ExpireTrash.php8
-rw-r--r--apps/files_trashbin/lib/Command/RestoreAllFiles.php1
3 files changed, 6 insertions, 4 deletions
diff --git a/apps/files_trashbin/lib/Command/Expire.php b/apps/files_trashbin/lib/Command/Expire.php
index 6c89b6d736c..73a42cd4749 100644
--- a/apps/files_trashbin/lib/Command/Expire.php
+++ b/apps/files_trashbin/lib/Command/Expire.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
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]);
}
diff --git a/apps/files_trashbin/lib/Command/RestoreAllFiles.php b/apps/files_trashbin/lib/Command/RestoreAllFiles.php
index cb4e7f97ecd..ce31f759c0e 100644
--- a/apps/files_trashbin/lib/Command/RestoreAllFiles.php
+++ b/apps/files_trashbin/lib/Command/RestoreAllFiles.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-only