Differential D20602 Diff 49168 src/applications/daemon/management/PhabricatorDaemonManagementRestartWorkflow.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/daemon/management/PhabricatorDaemonManagementRestartWorkflow.php
<?php | <?php | ||||
final class PhabricatorDaemonManagementRestartWorkflow | final class PhabricatorDaemonManagementRestartWorkflow | ||||
extends PhabricatorDaemonManagementWorkflow { | extends PhabricatorDaemonManagementWorkflow { | ||||
protected function didConstruct() { | protected function didConstruct() { | ||||
$this | $this | ||||
->setName('restart') | ->setName('restart') | ||||
->setSynopsis(pht('Stop, then start the standard daemon loadout.')) | ->setSynopsis( | ||||
pht( | |||||
'Stop daemon processes on this host, then start the standard '. | |||||
'daemon loadout.')) | |||||
->setArguments( | ->setArguments( | ||||
array( | array( | ||||
array( | array( | ||||
'name' => 'graceful', | 'name' => 'graceful', | ||||
'param' => 'seconds', | 'param' => 'seconds', | ||||
'help' => pht( | 'help' => pht( | ||||
'Grace period for daemons to attempt a clean shutdown, in '. | 'Grace period for daemons to attempt a clean shutdown, in '. | ||||
'seconds. Defaults to __15__ seconds.'), | 'seconds. Defaults to __15__ seconds.'), | ||||
'default' => 15, | 'default' => 15, | ||||
), | ), | ||||
array( | array( | ||||
'name' => 'gently', | 'name' => 'force', | ||||
'help' => pht( | 'help' => pht( | ||||
'Ignore running processes that look like daemons but do not '. | 'Stop all daemon processes on this host, even if they belong '. | ||||
'have corresponding PID files.'), | 'to another Phabricator instance.'), | ||||
), | ), | ||||
array( | array( | ||||
'name' => 'force', | 'name' => 'gently', | ||||
'help' => pht( | 'help' => pht('Deprecated. Has no effect.'), | ||||
'Also stop running processes that look like daemons but do '. | |||||
'not have corresponding PID files.'), | |||||
), | ), | ||||
$this->getAutoscaleReserveArgument(), | $this->getAutoscaleReserveArgument(), | ||||
)); | )); | ||||
} | } | ||||
public function execute(PhutilArgumentParser $args) { | public function execute(PhutilArgumentParser $args) { | ||||
$err = $this->executeStopCommand( | $err = $this->executeStopCommand( | ||||
array( | array( | ||||
'graceful' => $args->getArg('graceful'), | 'graceful' => $args->getArg('graceful'), | ||||
'force' => $args->getArg('force'), | 'force' => $args->getArg('force'), | ||||
'gently' => $args->getArg('gently'), | |||||
)); | )); | ||||
if ($err) { | if ($err) { | ||||
return $err; | return $err; | ||||
} | } | ||||
return $this->executeStartCommand( | return $this->executeStartCommand( | ||||
array( | array( | ||||
'reserve' => (float)$args->getArg('autoscale-reserve'), | 'reserve' => (float)$args->getArg('autoscale-reserve'), | ||||
)); | )); | ||||
} | } | ||||
} | } |