Differential D16848 Diff 40576 src/infrastructure/storage/management/workflow/PhabricatorStorageManagementRenamespaceWorkflow.php
Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/storage/management/workflow/PhabricatorStorageManagementRenamespaceWorkflow.php
| Show First 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | final class PhabricatorStorageManagementRenamespaceWorkflow | ||||
| public function didExecute(PhutilArgumentParser $args) { | public function didExecute(PhutilArgumentParser $args) { | ||||
| $console = PhutilConsole::getConsole(); | $console = PhutilConsole::getConsole(); | ||||
| $input = $args->getArg('input'); | $input = $args->getArg('input'); | ||||
| $is_live = $args->getArg('live'); | $is_live = $args->getArg('live'); | ||||
| if (!strlen($input) && !$is_live) { | if (!strlen($input) && !$is_live) { | ||||
| throw new PhutilArgumentUsageException( | throw new PhutilArgumentUsageException( | ||||
| pht( | pht( | ||||
| 'Specify the dumpfile to read with "--in", or use "--live" to '. | 'Specify the dumpfile to read with "--input", or use "--live" to '. | ||||
| 'generate one automatically.')); | 'generate one automatically.')); | ||||
| } | } | ||||
| $from = $args->getArg('from'); | $from = $args->getArg('from'); | ||||
| if (!strlen($from)) { | if (!strlen($from)) { | ||||
| throw new PhutilArgumentUsageException( | throw new PhutilArgumentUsageException( | ||||
| pht( | pht( | ||||
| 'Specify namespace to rename from with %s.', | 'Specify namespace to rename from with %s.', | ||||
| Show All 29 Lines | if ($output_file !== null) { | ||||
| 'Output file "%s" already exists. Use "--overwrite" '. | 'Output file "%s" already exists. Use "--overwrite" '. | ||||
| 'to overwrite.', | 'to overwrite.', | ||||
| $output_file)); | $output_file)); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| if ($is_live) { | if ($is_live) { | ||||
| $api = $this->getSingleAPI(); | |||||
| $ref_key = $api->getRef()->getRefKey(); | |||||
| $root = dirname(phutil_get_library_root('phabricator')); | $root = dirname(phutil_get_library_root('phabricator')); | ||||
| $future = new ExecFuture( | $future = new ExecFuture( | ||||
| '%R dump', | '%R dump --ref %s', | ||||
| $root.'/bin/storage'); | $root.'/bin/storage', | ||||
| $ref_key); | |||||
| $lines = new LinesOfALargeExecFuture($future); | $lines = new LinesOfALargeExecFuture($future); | ||||
| } else { | } else { | ||||
| $lines = new LinesOfALargeFile($input); | $lines = new LinesOfALargeFile($input); | ||||
| } | } | ||||
| if ($output_file === null) { | if ($output_file === null) { | ||||
| $file = fopen('php://stdout', 'wb'); | $file = fopen('php://stdout', 'wb'); | ||||
| ▲ Show 20 Lines • Show All 89 Lines • Show Last 20 Lines | |||||