| @@ 69-100 (lines=32) @@ | ||
| 66 | ); |
|
| 67 | } |
|
| 68 | ||
| 69 | protected function execute(InputInterface $input, OutputInterface $output) { |
|
| 70 | $users = $input->getArgument('user_id'); |
|
| 71 | if (!empty($users)) { |
|
| 72 | foreach ($users as $user) { |
|
| 73 | if ($this->userManager->userExists($user)) { |
|
| 74 | $output->writeln("Remove deleted files of <info>$user</info>"); |
|
| 75 | $this->removeDeletedFiles($user); |
|
| 76 | } else { |
|
| 77 | $output->writeln("<error>Unknown user $user</error>"); |
|
| 78 | } |
|
| 79 | } |
|
| 80 | } else { |
|
| 81 | $output->writeln('Remove all deleted files'); |
|
| 82 | foreach ($this->userManager->getBackends() as $backend) { |
|
| 83 | $name = get_class($backend); |
|
| 84 | if ($backend instanceof IUserBackend) { |
|
| 85 | $name = $backend->getBackendName(); |
|
| 86 | } |
|
| 87 | $output->writeln("Remove deleted files for users on backend <info>$name</info>"); |
|
| 88 | $limit = 500; |
|
| 89 | $offset = 0; |
|
| 90 | do { |
|
| 91 | $users = $backend->getUsers('', $limit, $offset); |
|
| 92 | foreach ($users as $user) { |
|
| 93 | $output->writeln(" <info>$user</info>"); |
|
| 94 | $this->removeDeletedFiles($user); |
|
| 95 | } |
|
| 96 | $offset += $limit; |
|
| 97 | } while (count($users) >= $limit); |
|
| 98 | } |
|
| 99 | } |
|
| 100 | } |
|
| 101 | ||
| 102 | /** |
|
| 103 | * remove deleted files for the given user |
|
| @@ 64-99 (lines=36) @@ | ||
| 61 | } |
|
| 62 | ||
| 63 | ||
| 64 | protected function execute(InputInterface $input, OutputInterface $output) { |
|
| 65 | ||
| 66 | $users = $input->getArgument('user_id'); |
|
| 67 | if (!empty($users)) { |
|
| 68 | foreach ($users as $user) { |
|
| 69 | if ($this->userManager->userExists($user)) { |
|
| 70 | $output->writeln("Delete versions of <info>$user</info>"); |
|
| 71 | $this->deleteVersions($user); |
|
| 72 | } else { |
|
| 73 | $output->writeln("<error>Unknown user $user</error>"); |
|
| 74 | } |
|
| 75 | } |
|
| 76 | } else { |
|
| 77 | $output->writeln('Delete all versions'); |
|
| 78 | foreach ($this->userManager->getBackends() as $backend) { |
|
| 79 | $name = get_class($backend); |
|
| 80 | ||
| 81 | if ($backend instanceof IUserBackend) { |
|
| 82 | $name = $backend->getBackendName(); |
|
| 83 | } |
|
| 84 | ||
| 85 | $output->writeln("Delete versions for users on backend <info>$name</info>"); |
|
| 86 | ||
| 87 | $limit = 500; |
|
| 88 | $offset = 0; |
|
| 89 | do { |
|
| 90 | $users = $backend->getUsers('', $limit, $offset); |
|
| 91 | foreach ($users as $user) { |
|
| 92 | $output->writeln(" <info>$user</info>"); |
|
| 93 | $this->deleteVersions($user); |
|
| 94 | } |
|
| 95 | $offset += $limit; |
|
| 96 | } while (count($users) >= $limit); |
|
| 97 | } |
|
| 98 | } |
|
| 99 | } |
|
| 100 | ||
| 101 | ||
| 102 | /** |
|