@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 PhabricatorDaemonManagementDebugWorkflow
4 extends PhabricatorDaemonManagementWorkflow {
5
6 public function shouldParsePartial() {
7 return true;
8 }
9
10 protected function didConstruct() {
11 $this
12 ->setName('debug')
13 ->setExamples('**debug** __daemon__')
14 ->setSynopsis(
15 pht(
16 'Start __daemon__ in the foreground and print large volumes of '.
17 'diagnostic information to the console.'))
18 ->setArguments(
19 array(
20 array(
21 'name' => 'argv',
22 'wildcard' => true,
23 ),
24 array(
25 'name' => 'pool',
26 'param' => 'count',
27 'help' => pht('Maximum pool size.'),
28 'default' => 1,
29 ),
30 array(
31 'name' => 'as-current-user',
32 'help' => pht(
33 'Run the daemon as the current user '.
34 'instead of the configured %s',
35 'phd.user'),
36 ),
37 ));
38 }
39
40 public function execute(PhutilArgumentParser $args) {
41 $argv = $args->getArg('argv');
42 $run_as_current_user = $args->getArg('as-current-user');
43
44 if (!$argv) {
45 throw new PhutilArgumentUsageException(
46 pht('You must specify which daemon to debug.'));
47 }
48
49 $config = array(
50 'class' => array_shift($argv),
51 'label' => 'debug',
52 'pool' => (int)$args->getArg('pool'),
53 'argv' => $argv,
54 );
55
56 return $this->launchDaemons(
57 array(
58 $config,
59 ),
60 $is_debug = true,
61 $run_as_current_user);
62 }
63
64}