Differential D20614 Diff 49179 src/applications/files/management/PhabricatorFilesManagementCycleWorkflow.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/files/management/PhabricatorFilesManagementCycleWorkflow.php
| <?php | <?php | ||||
| final class PhabricatorFilesManagementCycleWorkflow | final class PhabricatorFilesManagementCycleWorkflow | ||||
| extends PhabricatorFilesManagementWorkflow { | extends PhabricatorFilesManagementWorkflow { | ||||
| protected function didConstruct() { | protected function didConstruct() { | ||||
| $arguments = $this->newIteratorArguments(); | |||||
| $arguments[] = array( | |||||
| 'name' => 'key', | |||||
| 'param' => 'keyname', | |||||
| 'help' => pht('Select a specific storage key to cycle to.'), | |||||
| ); | |||||
| $this | $this | ||||
| ->setName('cycle') | ->setName('cycle') | ||||
| ->setSynopsis( | ->setSynopsis( | ||||
| pht('Cycle master key for encrypted files.')) | pht('Cycle master key for encrypted files.')) | ||||
| ->setArguments( | ->setArguments($arguments); | ||||
| array( | |||||
| array( | |||||
| 'name' => 'key', | |||||
| 'param' => 'keyname', | |||||
| 'help' => pht('Select a specific storage key to cycle to.'), | |||||
| ), | |||||
| array( | |||||
| 'name' => 'all', | |||||
| 'help' => pht('Change encoding for all files.'), | |||||
| ), | |||||
| array( | |||||
| 'name' => 'names', | |||||
| 'wildcard' => true, | |||||
| ), | |||||
| )); | |||||
| } | } | ||||
| 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 cycle, or use --all to cycle '. | |||||
| 'all files.')); | |||||
| } | |||||
| $format_map = PhabricatorFileStorageFormat::getAllFormats(); | $format_map = PhabricatorFileStorageFormat::getAllFormats(); | ||||
| $engines = PhabricatorFileStorageEngine::loadAllEngines(); | $engines = PhabricatorFileStorageEngine::loadAllEngines(); | ||||
| $key_name = $args->getArg('key'); | $key_name = $args->getArg('key'); | ||||
| $failed = array(); | $failed = array(); | ||||
| foreach ($iterator as $file) { | foreach ($iterator as $file) { | ||||
| ▲ Show 20 Lines • Show All 88 Lines • Show Last 20 Lines | |||||