Path: blob/master/src/applications/daemon/management/PhabricatorDaemonManagementLaunchWorkflow.php
12256 views
<?php12final class PhabricatorDaemonManagementLaunchWorkflow3extends PhabricatorDaemonManagementWorkflow {45public function shouldParsePartial() {6return true;7}89protected function didConstruct() {10$this11->setName('launch')12->setExamples('**launch** [n] __daemon__ [options]')13->setSynopsis(pht(14'Start a specific __daemon__, or __n__ copies of a specific '.15'__daemon__.'))16->setArguments(17array(18array(19'name' => 'argv',20'wildcard' => true,21),22));23}2425public function execute(PhutilArgumentParser $args) {26$argv = $args->getArg('argv');2728$daemon_count = 1;29if ($argv) {30if (is_numeric(head($argv))) {31$daemon_count = array_shift($argv);32}3334if ($daemon_count < 1) {35throw new PhutilArgumentUsageException(36pht('You must launch at least one daemon.'));37}38}3940if (!$argv) {41throw new PhutilArgumentUsageException(42pht('You must specify which daemon to launch.'));43}4445$daemon = array();46$daemon['class'] = array_shift($argv);47$daemon['label'] = $daemon['class'];48$daemon['argv'] = $argv;4950$daemons = array_fill(0, $daemon_count, $daemon);5152$this->launchDaemons($daemons, $is_debug = false);5354return 0;55}5657}585960