@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3final class PhabricatorDaemonManagementLaunchWorkflow
4 extends PhabricatorDaemonManagementWorkflow {
5
6 public function shouldParsePartial() {
7 return true;
8 }
9
10 protected 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 = array();
47 $daemon['class'] = array_shift($argv);
48 $daemon['label'] = $daemon['class'];
49 $daemon['argv'] = $argv;
50
51 $daemons = array_fill(0, $daemon_count, $daemon);
52
53 $this->launchDaemons($daemons, $is_debug = false);
54
55 return 0;
56 }
57
58}