| @@ 70-99 (lines=30) @@ | ||
| 67 | ); |
|
| 68 | } |
|
| 69 | ||
| 70 | protected function execute(InputInterface $input, OutputInterface $output) { |
|
| 71 | ||
| 72 | $maxAge = $this->expiration->getMaxAgeAsTimestamp(); |
|
| 73 | if (!$maxAge) { |
|
| 74 | $output->writeln("No expiry configured."); |
|
| 75 | return; |
|
| 76 | } |
|
| 77 | ||
| 78 | $users = $input->getArgument('user_id'); |
|
| 79 | if (!empty($users)) { |
|
| 80 | foreach ($users as $user) { |
|
| 81 | if ($this->userManager->userExists($user)) { |
|
| 82 | $output->writeln("Remove deleted files of <info>$user</info>"); |
|
| 83 | $userObject = $this->userManager->get($user); |
|
| 84 | $this->expireTrashForUser($userObject); |
|
| 85 | } else { |
|
| 86 | $output->writeln("<error>Unknown user $user</error>"); |
|
| 87 | } |
|
| 88 | } |
|
| 89 | } else { |
|
| 90 | $p = new ProgressBar($output); |
|
| 91 | $p->start(); |
|
| 92 | $this->callForAllUsers(function(IUser $user) use ($p) { |
|
| 93 | $p->advance(); |
|
| 94 | $this->expireTrashForUser($user); |
|
| 95 | }); |
|
| 96 | $p->finish(); |
|
| 97 | $output->writeln(''); |
|
| 98 | } |
|
| 99 | } |
|
| 100 | ||
| 101 | function expireTrashForUser(IUser $user) { |
|
| 102 | $uid = $user->getUID(); |
|
| @@ 69-98 (lines=30) @@ | ||
| 66 | ); |
|
| 67 | } |
|
| 68 | ||
| 69 | protected function execute(InputInterface $input, OutputInterface $output) { |
|
| 70 | ||
| 71 | $maxAge = $this->expiration->getMaxAgeAsTimestamp(); |
|
| 72 | if (!$maxAge) { |
|
| 73 | $output->writeln("No expiry configured."); |
|
| 74 | return; |
|
| 75 | } |
|
| 76 | ||
| 77 | $users = $input->getArgument('user_id'); |
|
| 78 | if (!empty($users)) { |
|
| 79 | foreach ($users as $user) { |
|
| 80 | if ($this->userManager->userExists($user)) { |
|
| 81 | $output->writeln("Remove deleted files of <info>$user</info>"); |
|
| 82 | $userObject = $this->userManager->get($user); |
|
| 83 | $this->expireVersionsForUser($userObject); |
|
| 84 | } else { |
|
| 85 | $output->writeln("<error>Unknown user $user</error>"); |
|
| 86 | } |
|
| 87 | } |
|
| 88 | } else { |
|
| 89 | $p = new ProgressBar($output); |
|
| 90 | $p->start(); |
|
| 91 | $this->callForAllUsers(function(IUser $user) use ($p) { |
|
| 92 | $p->advance(); |
|
| 93 | $this->expireVersionsForUser($user); |
|
| 94 | }); |
|
| 95 | $p->finish(); |
|
| 96 | $output->writeln(''); |
|
| 97 | } |
|
| 98 | } |
|
| 99 | ||
| 100 | function expireVersionsForUser(IUser $user) { |
|
| 101 | $uid = $user->getUID(); |
|