Skip to content

Commit d25a563

Browse files
committed
chore: Use iterator in ExpireTrash command
Signed-off-by: Louis Chemineau <louis@chmn.me>
1 parent 4d1e0cd commit d25a563

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

apps/files_trashbin/lib/Command/ExpireTrash.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ class ExpireTrash extends Command {
3333
* @param IUserManager|null $userManager
3434
* @param Expiration|null $expiration
3535
*/
36-
public function __construct(?IUserManager $userManager = null,
36+
public function __construct(private LoggerInterface $logger,
37+
?IUserManager $userManager = null,
3738
?Expiration $expiration = null) {
3839
parent::__construct();
3940

@@ -74,10 +75,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int
7475
} else {
7576
$p = new ProgressBar($output);
7677
$p->start();
77-
$this->userManager->callForSeenUsers(function (IUser $user) use ($p) {
78+
79+
$users = $this->userManager->getSeenUsers();
80+
foreach ($users as $user) {
7881
$p->advance();
7982
$this->expireTrashForUser($user);
80-
});
83+
}
8184
$p->finish();
8285
$output->writeln('');
8386
}

0 commit comments

Comments
 (0)