Skip to content

Commit 6c12a76

Browse files
fix(files_trashbin): report disabled expiration correctly
When trashbin_retention_obligation is set to disabled, trashbin:expire incorrectly reports the auto-expiration policy and exits with a failure status. Report that automatic expiration is disabled and exit successfully instead. Signed-off-by: Josh <josh.t.richards@gmail.com>
1 parent f5b08ba commit 6c12a76

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

‎apps/files_trashbin/lib/Command/ExpireTrash.php‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,14 @@ protected function configure(): void {
4949
protected function execute(InputInterface $input, OutputInterface $output): int {
5050
$minAge = $this->expiration->getMinAgeAsTimestamp();
5151
$maxAge = $this->expiration->getMaxAgeAsTimestamp();
52+
// Both minAge and maxAge resolve to `false` only when
53+
// Expiration::isEnabled() is false, i.e. the retention policy is "disabled".
5254
if ($minAge === false && $maxAge === false) {
53-
$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)');
54-
return 1;
55+
$output->writeln(
56+
'Trash bin expiration is disabled (trashbin_retention_obligation is set to "disabled"). '
57+
. 'No files or folders will be automatically expired by this command.'
58+
);
59+
return 0;
5560
}
5661

5762
$userIds = $input->getArgument('user_id');

0 commit comments

Comments
 (0)