Page MenuHomePhabricator

D15698.diff
No OneTemporary

D15698.diff

diff --git a/src/applications/aphlict/management/PhabricatorAphlictManagementDebugWorkflow.php b/src/applications/aphlict/management/PhabricatorAphlictManagementDebugWorkflow.php
--- a/src/applications/aphlict/management/PhabricatorAphlictManagementDebugWorkflow.php
+++ b/src/applications/aphlict/management/PhabricatorAphlictManagementDebugWorkflow.php
@@ -4,17 +4,18 @@
extends PhabricatorAphlictManagementWorkflow {
protected function didConstruct() {
- parent::didConstruct();
$this
->setName('debug')
->setSynopsis(
pht(
'Start the notifications server in the foreground and print large '.
- 'volumes of diagnostic information to the console.'));
+ 'volumes of diagnostic information to the console.'))
+ ->setArguments($this->getLaunchArguments());
}
public function execute(PhutilArgumentParser $args) {
- parent::execute($args);
+ $this->parseLaunchArguments($args);
+
$this->setDebug(true);
$this->willLaunch();
diff --git a/src/applications/aphlict/management/PhabricatorAphlictManagementRestartWorkflow.php b/src/applications/aphlict/management/PhabricatorAphlictManagementRestartWorkflow.php
--- a/src/applications/aphlict/management/PhabricatorAphlictManagementRestartWorkflow.php
+++ b/src/applications/aphlict/management/PhabricatorAphlictManagementRestartWorkflow.php
@@ -4,19 +4,20 @@
extends PhabricatorAphlictManagementWorkflow {
protected function didConstruct() {
- parent::didConstruct();
$this
->setName('restart')
- ->setSynopsis(pht('Stop, then start the notifications server.'));
+ ->setSynopsis(pht('Stop, then start the notification server.'))
+ ->setArguments($this->getLaunchArguments());
}
public function execute(PhutilArgumentParser $args) {
- parent::execute($args);
+ $this->parseLaunchArguments($args);
$err = $this->executeStopCommand();
if ($err) {
return $err;
}
+
return $this->executeStartCommand();
}
diff --git a/src/applications/aphlict/management/PhabricatorAphlictManagementStartWorkflow.php b/src/applications/aphlict/management/PhabricatorAphlictManagementStartWorkflow.php
--- a/src/applications/aphlict/management/PhabricatorAphlictManagementStartWorkflow.php
+++ b/src/applications/aphlict/management/PhabricatorAphlictManagementStartWorkflow.php
@@ -4,14 +4,14 @@
extends PhabricatorAphlictManagementWorkflow {
protected function didConstruct() {
- parent::didConstruct();
$this
->setName('start')
- ->setSynopsis(pht('Start the notifications server.'));
+ ->setSynopsis(pht('Start the notifications server.'))
+ ->setArguments($this->getLaunchArguments());
}
public function execute(PhutilArgumentParser $args) {
- parent::execute($args);
+ $this->parseLaunchArguments($args);
return $this->executeStartCommand();
}
diff --git a/src/applications/aphlict/management/PhabricatorAphlictManagementStatusWorkflow.php b/src/applications/aphlict/management/PhabricatorAphlictManagementStatusWorkflow.php
--- a/src/applications/aphlict/management/PhabricatorAphlictManagementStatusWorkflow.php
+++ b/src/applications/aphlict/management/PhabricatorAphlictManagementStatusWorkflow.php
@@ -6,7 +6,7 @@
protected function didConstruct() {
$this
->setName('status')
- ->setSynopsis(pht('Show the status of the notifications server.'))
+ ->setSynopsis(pht('Show the status of the notification server.'))
->setArguments(array());
}
diff --git a/src/applications/aphlict/management/PhabricatorAphlictManagementStopWorkflow.php b/src/applications/aphlict/management/PhabricatorAphlictManagementStopWorkflow.php
--- a/src/applications/aphlict/management/PhabricatorAphlictManagementStopWorkflow.php
+++ b/src/applications/aphlict/management/PhabricatorAphlictManagementStopWorkflow.php
@@ -6,7 +6,7 @@
protected function didConstruct() {
$this
->setName('stop')
- ->setSynopsis(pht('Stop the notifications server.'))
+ ->setSynopsis(pht('Stop the notification server.'))
->setArguments(array());
}
diff --git a/src/applications/aphlict/management/PhabricatorAphlictManagementWorkflow.php b/src/applications/aphlict/management/PhabricatorAphlictManagementWorkflow.php
--- a/src/applications/aphlict/management/PhabricatorAphlictManagementWorkflow.php
+++ b/src/applications/aphlict/management/PhabricatorAphlictManagementWorkflow.php
@@ -7,27 +7,29 @@
private $clientHost;
private $clientPort;
- protected function didConstruct() {
- $this
- ->setArguments(
- array(
- array(
- 'name' => 'client-host',
- 'param' => 'hostname',
- 'help' => pht('Hostname to bind to for the client server.'),
- ),
- array(
- 'name' => 'client-port',
- 'param' => 'port',
- 'help' => pht('Port to bind to for the client server.'),
- ),
- ));
+ final protected function setDebug($debug) {
+ $this->debug = $debug;
+ return $this;
+ }
+
+ protected function getLaunchArguments() {
+ return array(
+ array(
+ 'name' => 'client-host',
+ 'param' => 'hostname',
+ 'help' => pht('Hostname to bind to for the client server.'),
+ ),
+ array(
+ 'name' => 'client-port',
+ 'param' => 'port',
+ 'help' => pht('Port to bind to for the client server.'),
+ ),
+ );
}
- public function execute(PhutilArgumentParser $args) {
+ protected function parseLaunchArguments(PhutilArgumentParser $args) {
$this->clientHost = $args->getArg('client-host');
$this->clientPort = $args->getArg('client-port');
- return 0;
}
final public function getPIDPath() {
@@ -86,11 +88,6 @@
exit(1);
}
- final protected function setDebug($debug) {
- $this->debug = $debug;
- return $this;
- }
-
public static function requireExtensions() {
self::mustHaveExtension('pcntl');
self::mustHaveExtension('posix');
@@ -146,11 +143,8 @@
$test_argv = $this->getServerArgv();
$test_argv[] = '--test=true';
- execx(
- '%s %s %Ls',
- $this->getNodeBinary(),
- $this->getAphlictScriptPath(),
- $test_argv);
+
+ execx('%C', $this->getStartCommand($test_argv));
}
private function getServerArgv() {
@@ -189,11 +183,6 @@
return $server_argv;
}
- private function getAphlictScriptPath() {
- $root = dirname(phutil_get_library_root('phabricator'));
- return $root.'/support/aphlict/server/aphlict_server.js';
- }
-
final protected function launch() {
$console = PhutilConsole::getConsole();
@@ -205,11 +194,7 @@
Filesystem::writeFile($this->getPIDPath(), getmypid());
}
- $command = csprintf(
- '%s %s %Ls',
- $this->getNodeBinary(),
- $this->getAphlictScriptPath(),
- $this->getServerArgv());
+ $command = $this->getStartCommand($this->getServerArgv());
if (!$this->debug) {
declare(ticks = 1);
@@ -267,7 +252,6 @@
fclose(STDOUT);
fclose(STDERR);
-
$this->launch();
return 0;
}
@@ -325,4 +309,17 @@
'$PATH'));
}
+ private function getAphlictScriptPath() {
+ $root = dirname(phutil_get_library_root('phabricator'));
+ return $root.'/support/aphlict/server/aphlict_server.js';
+ }
+
+ private function getStartCommand(array $server_argv) {
+ return csprintf(
+ '%s %s %Ls',
+ $this->getNodeBinary(),
+ $this->getAphlictScriptPath(),
+ $server_argv);
+ }
+
}

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 8, 4:27 AM (1 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6710986
Default Alt Text
D15698.diff (7 KB)

Event Timeline