[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/daemon/management/ -> PhabricatorDaemonManagementLaunchWorkflow.php (source)

   1  <?php
   2  
   3  final class PhabricatorDaemonManagementLaunchWorkflow
   4    extends PhabricatorDaemonManagementWorkflow {
   5  
   6    public function shouldParsePartial() {
   7      return true;
   8    }
   9  
  10    public function didConstruct() {
  11      $this
  12        ->setName('launch')
  13        ->setExamples('**launch** [n] __daemon__ [options]')
  14        ->setSynopsis(pht(
  15          'Start a specific __daemon__, or __n__ copies of a specific '.
  16          '__daemon__.'))
  17        ->setArguments(
  18          array(
  19            array(
  20              'name' => 'argv',
  21              'wildcard' => true,
  22            ),
  23          ));
  24    }
  25  
  26    public function execute(PhutilArgumentParser $args) {
  27      $argv = $args->getArg('argv');
  28  
  29      $daemon_count = 1;
  30      if ($argv) {
  31        if (is_numeric(head($argv))) {
  32          $daemon_count = array_shift($argv);
  33        }
  34  
  35        if ($daemon_count < 1) {
  36          throw new PhutilArgumentUsageException(
  37            pht('You must launch at least one daemon.'));
  38        }
  39      }
  40  
  41      if (!$argv) {
  42        throw new PhutilArgumentUsageException(
  43          pht('You must specify which daemon to launch.'));
  44      }
  45  
  46      $daemon_class = array_shift($argv);
  47  
  48      $this->willLaunchDaemons();
  49  
  50      for ($ii = 0; $ii < $daemon_count; $ii++) {
  51        $this->launchDaemon($daemon_class, $argv, $is_debug = false);
  52      }
  53  
  54      return 0;
  55    }
  56  
  57  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1