@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
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add a --force command to `phd start`

Summary:
Ref T7352. This isn't wildly useful for us but seems generally reasonable, can be helpful with testing, and @hach-que has a use case for it.

The only reason we issue this warning is to prevent user error; you can still launch all the daemons with `phd launch` manually and daemons all use locks to protect critical regions.

Test Plan: Ran `phd start --force` a bunch, saw zillions of daemons.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley, hach-que

Maniphest Tasks: T7352

Differential Revision: https://secure.phabricator.com/D11861

+26 -16
+8 -1
src/applications/daemon/management/PhabricatorDaemonManagementStartWorkflow.php
··· 19 19 'By default, **phd start** will free all task leases held by '. 20 20 'the daemons. With this flag, this step will be skipped.'), 21 21 ), 22 + array( 23 + 'name' => 'force', 24 + 'help' => pht( 25 + 'Start daemons even if daemons are already running.'), 26 + ), 22 27 )); 23 28 } 24 29 25 30 public function execute(PhutilArgumentParser $args) { 26 - return $this->executeStartCommand($args->getArg('keep-leases')); 31 + return $this->executeStartCommand( 32 + $args->getArg('keep-leases'), 33 + $args->getArg('force')); 27 34 } 28 35 29 36 }
+18 -15
src/applications/daemon/management/PhabricatorDaemonManagementWorkflow.php
··· 286 286 /* -( Commands )----------------------------------------------------------- */ 287 287 288 288 289 - protected final function executeStartCommand($keep_leases = false) { 289 + protected final function executeStartCommand($keep_leases, $force) { 290 290 $console = PhutilConsole::getConsole(); 291 291 292 - $running = $this->loadRunningDaemons(); 292 + if (!$force) { 293 + $running = $this->loadRunningDaemons(); 293 294 294 - // This may include daemons which were launched but which are no longer 295 - // running; check that we actually have active daemons before failing. 296 - foreach ($running as $daemon) { 297 - if ($daemon->isRunning()) { 298 - $message = pht( 299 - "phd start: Unable to start daemons because daemons are already ". 300 - "running.\n". 301 - "You can view running daemons with 'phd status'.\n". 302 - "You can stop running daemons with 'phd stop'.\n". 303 - "You can use 'phd restart' to stop all daemons before starting new ". 304 - "daemons."); 295 + // This may include daemons which were launched but which are no longer 296 + // running; check that we actually have active daemons before failing. 297 + foreach ($running as $daemon) { 298 + if ($daemon->isRunning()) { 299 + $message = pht( 300 + "phd start: Unable to start daemons because daemons are already ". 301 + "running.\n\n". 302 + "You can view running daemons with 'phd status'.\n". 303 + "You can stop running daemons with 'phd stop'.\n". 304 + "You can use 'phd restart' to stop all daemons before starting ". 305 + "new daemons.\n". 306 + "You can force daemons to start anyway with --force."); 305 307 306 - $console->writeErr("%s\n", $message); 307 - exit(1); 308 + $console->writeErr("%s\n", $message); 309 + exit(1); 310 + } 308 311 } 309 312 } 310 313