-
Notifications
You must be signed in to change notification settings - Fork 88
/
Copy pathExpireGroupTrash.php
37 lines (30 loc) Β· 1.02 KB
/
ExpireGroupTrash.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\GroupFolders\Command\ExpireGroup;
use OCA\Files_Trashbin\Expiration;
use OCA\GroupFolders\Trash\TrashBackend;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class ExpireGroupTrash extends ExpireGroupBase {
public function __construct(
private readonly TrashBackend $trashBackend,
private readonly Expiration $expiration,
) {
parent::__construct();
}
protected function configure(): void {
$this
->setName('groupfolders:expire')
->setDescription('Trigger expiration of the trashbin for files stored in group folders');
parent::configure();
}
protected function execute(InputInterface $input, OutputInterface $output): int {
[$count, $size] = $this->trashBackend->expire($this->expiration);
$output->writeln("<info>Removed $count expired trashbin items</info>");
return 0;
}
}