Differential D20614 Diff 49179 src/applications/files/management/PhabricatorFilesManagementRebuildWorkflow.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/files/management/PhabricatorFilesManagementRebuildWorkflow.php
| <?php | <?php | ||||
| final class PhabricatorFilesManagementRebuildWorkflow | final class PhabricatorFilesManagementRebuildWorkflow | ||||
| extends PhabricatorFilesManagementWorkflow { | extends PhabricatorFilesManagementWorkflow { | ||||
| protected function didConstruct() { | protected function didConstruct() { | ||||
| $this | $arguments = $this->newIteratorArguments(); | ||||
| ->setName('rebuild') | |||||
| ->setSynopsis(pht('Rebuild metadata of old files.')) | $arguments[] = array( | ||||
| ->setArguments( | |||||
| array( | |||||
| array( | |||||
| 'name' => 'all', | |||||
| 'help' => pht('Update all files.'), | |||||
| ), | |||||
| array( | |||||
| 'name' => 'dry-run', | 'name' => 'dry-run', | ||||
| 'help' => pht('Show what would be updated.'), | 'help' => pht('Show what would be updated.'), | ||||
| ), | ); | ||||
| array( | |||||
| $arguments[] = array( | |||||
| 'name' => 'rebuild-mime', | 'name' => 'rebuild-mime', | ||||
| 'help' => pht('Rebuild MIME information.'), | 'help' => pht('Rebuild MIME information.'), | ||||
| ), | ); | ||||
| array( | |||||
| $arguments[] = array( | |||||
| 'name' => 'rebuild-dimensions', | 'name' => 'rebuild-dimensions', | ||||
| 'help' => pht('Rebuild image dimension information.'), | 'help' => pht('Rebuild image dimension information.'), | ||||
| ), | ); | ||||
| array( | |||||
| 'name' => 'names', | $this | ||||
| 'wildcard' => true, | ->setName('rebuild') | ||||
| ), | ->setSynopsis(pht('Rebuild metadata of old files.')) | ||||
| )); | ->setArguments($arguments); | ||||
| } | } | ||||
| public function execute(PhutilArgumentParser $args) { | public function execute(PhutilArgumentParser $args) { | ||||
| $console = PhutilConsole::getConsole(); | $console = PhutilConsole::getConsole(); | ||||
| $iterator = $this->buildIterator($args); | $iterator = $this->buildIterator($args); | ||||
| if (!$iterator) { | |||||
| throw new PhutilArgumentUsageException( | |||||
| pht( | |||||
| 'Either specify a list of files to update, or use `%s` '. | |||||
| 'to update all files.', | |||||
| '--all')); | |||||
| } | |||||
| $update = array( | $update = array( | ||||
| 'mime' => $args->getArg('rebuild-mime'), | 'mime' => $args->getArg('rebuild-mime'), | ||||
| 'dimensions' => $args->getArg('rebuild-dimensions'), | 'dimensions' => $args->getArg('rebuild-dimensions'), | ||||
| ); | ); | ||||
| // If the user didn't select anything, rebuild everything. | // If the user didn't select anything, rebuild everything. | ||||
| if (!array_filter($update)) { | if (!array_filter($update)) { | ||||
| ▲ Show 20 Lines • Show All 103 Lines • Show Last 20 Lines | |||||