Differential D20614 Diff 49179 src/applications/files/management/PhabricatorFilesManagementEncodeWorkflow.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/files/management/PhabricatorFilesManagementEncodeWorkflow.php
| <?php | <?php | ||||
| final class PhabricatorFilesManagementEncodeWorkflow | final class PhabricatorFilesManagementEncodeWorkflow | ||||
| extends PhabricatorFilesManagementWorkflow { | extends PhabricatorFilesManagementWorkflow { | ||||
| protected function didConstruct() { | protected function didConstruct() { | ||||
| $this | $arguments = $this->newIteratorArguments(); | ||||
| ->setName('encode') | |||||
| ->setSynopsis( | $arguments[] = array( | ||||
| pht('Change the storage encoding of files.')) | |||||
| ->setArguments( | |||||
| array( | |||||
| array( | |||||
| 'name' => 'as', | 'name' => 'as', | ||||
| 'param' => 'format', | 'param' => 'format', | ||||
| 'help' => pht('Select the storage format to use.'), | 'help' => pht('Select the storage format to use.'), | ||||
| ), | ); | ||||
| array( | |||||
| $arguments[] = array( | |||||
| 'name' => 'key', | 'name' => 'key', | ||||
| 'param' => 'keyname', | 'param' => 'keyname', | ||||
| 'help' => pht('Select a specific storage key.'), | 'help' => pht('Select a specific storage key.'), | ||||
| ), | ); | ||||
| array( | |||||
| 'name' => 'all', | $arguments[] = array( | ||||
| 'help' => pht('Change encoding for all files.'), | |||||
| ), | |||||
| array( | |||||
| 'name' => 'force', | 'name' => 'force', | ||||
| 'help' => pht( | 'help' => pht( | ||||
| 'Re-encode files which are already stored in the target '. | 'Re-encode files which are already stored in the target '. | ||||
| 'encoding.'), | 'encoding.'), | ||||
| ), | ); | ||||
| array( | |||||
| 'name' => 'names', | $this | ||||
| 'wildcard' => true, | ->setName('encode') | ||||
| ), | ->setSynopsis( | ||||
| )); | pht('Change the storage encoding of files.')) | ||||
| ->setArguments($arguments); | |||||
| } | } | ||||
| public function execute(PhutilArgumentParser $args) { | public function execute(PhutilArgumentParser $args) { | ||||
| $iterator = $this->buildIterator($args); | $iterator = $this->buildIterator($args); | ||||
| if (!$iterator) { | |||||
| throw new PhutilArgumentUsageException( | |||||
| pht( | |||||
| 'Either specify a list of files to encode, or use --all to '. | |||||
| 'encode all files.')); | |||||
| } | |||||
| $force = (bool)$args->getArg('force'); | $force = (bool)$args->getArg('force'); | ||||
| $format_list = PhabricatorFileStorageFormat::getAllFormats(); | $format_list = PhabricatorFileStorageFormat::getAllFormats(); | ||||
| $format_list = array_keys($format_list); | $format_list = array_keys($format_list); | ||||
| $format_list = implode(', ', $format_list); | $format_list = implode(', ', $format_list); | ||||
| $format_key = $args->getArg('as'); | $format_key = $args->getArg('as'); | ||||
| ▲ Show 20 Lines • Show All 96 Lines • Show Last 20 Lines | |||||