diff options
author | hammer065 <26625945+hammer065@users.noreply.github.com> | 2021-11-11 02:21:45 +0300 |
---|---|---|
committer | hammer065 <26625945+hammer065@users.noreply.github.com> | 2021-11-11 02:30:50 +0300 |
commit | 6cc1cbf9da8521efe266363ea114b7d44d56b811 (patch) | |
tree | 251ab95351ee0764e20c0329f0accb755cfb14f8 | |
parent | b1318bf34a1ecff03c89223e3979c72dccff67d1 (diff) |
Added support for multiple --path options for preview:generate-all
Signed-off-by: hammer065 <26625945+hammer065@users.noreply.github.com>
-rw-r--r-- | lib/Command/Generate.php | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/Command/Generate.php b/lib/Command/Generate.php index c81b186..6a27edd 100644 --- a/lib/Command/Generate.php +++ b/lib/Command/Generate.php @@ -90,8 +90,8 @@ class Generate extends Command { )->addOption( 'path', 'p', - InputOption::VALUE_OPTIONAL, - 'limit scan to this path, eg. --path="/alice/files/Photos", the user_id is determined by the path and all user_id arguments are ignored' + InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, + 'limit scan to this path, eg. --path="/alice/files/Photos", the user_id is determined by the path and all user_id arguments are ignored, multiple usages allowed' ); } @@ -108,13 +108,15 @@ class Generate extends Command { $this->sizes = SizeHelper::calculateSizes($this->config); - $inputPath = $input->getOption('path'); - if ($inputPath) { - $inputPath = '/' . trim($inputPath, '/'); - [, $userId,] = explode('/', $inputPath, 3); - $user = $this->userManager->get($userId); - if ($user !== null) { - $this->generatePathPreviews($user, $inputPath); + $inputPaths = $input->getOption('path'); + if ($inputPaths) { + foreach ($inputPaths as $inputPath) { + $inputPath = '/' . trim($inputPath, '/'); + [, $userId,] = explode('/', $inputPath, 3); + $user = $this->userManager->get($userId); + if ($user !== null) { + $this->generatePathPreviews($user, $inputPath); + } } } else { $userIds = $input->getArgument('user_id'); |