Skip to content

Commit d5847b3

Browse files
committed
add .
1 parent fd9a433 commit d5847b3

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

libs/Task/Server/OptionAndConfigTrait.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,11 @@ protected function parseCommandAndConfig()
5757
$this->initConfigAndProperties($this->config);
5858

5959
// Debug option to dump the config and exit
60-
if (isset($result['D']) || isset($result['dump'])) {
61-
$val = isset($result['D']) ? $result['D'] : (isset($result['dump']) ? $result['dump'] : '');
60+
if (isset($this->cliOpts['D'])) {
61+
$val = $this->cliOpts['D'];
62+
$this->dumpInfo($val === 'all');
63+
} elseif (isset($this->cliOpts['dump'])) {
64+
$val = $this->cliOpts['dump'];
6265
$this->dumpInfo($val === 'all');
6366
}
6467
}
@@ -73,7 +76,7 @@ protected function parseCliOptions()
7376
]);
7477
$this->fullScript = implode(' ', $GLOBALS['argv']);
7578
$this->script = strpos($result[0], '.php') ? "php {$result[0]}" : $result[0];
76-
$this->command = $command = isset($result[1]) ? $result[1] : 'start';
79+
$this->command = $result[1] ?? 'start';
7780

7881
unset($result[0], $result[1]);
7982

@@ -116,8 +119,8 @@ protected function dispatchCommand($command)
116119
$this->reloadWorkers($masterPid);
117120
break;
118121
case 'status':
119-
$cmd = isset($result['cmd']) ? $result['cmd'] : 'status';
120-
$this->showStatus($cmd, isset($result['watch-status']));
122+
$cmd = $this->cliOpts['cmd'] ?? 'status';
123+
$this->showStatus($cmd, isset($this->cliOpts['watch-status']));
121124
break;
122125
default:
123126
$this->showHelp("The command [{$command}] is don't supported!");

libs/Task/Worker/Manager.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ public function handleTask($data)
234234
/**
235235
* showVersion
236236
*/
237-
protected function showVersion()
237+
public function showVersion()
238238
{
239239
printf("Gearman worker manager script tool. Version %s\n", Cli::color(self::VERSION, 'green'));
240240

@@ -312,7 +312,7 @@ protected function showHelp($msg = '', $code = 0)
312312
* @param string $command
313313
* @param bool $watch
314314
*/
315-
protected function showStatus($command, $watch = false)
315+
public function showStatus($command, $watch = false)
316316
{
317317
$this->stdout("un-completed! $command, $watch", true, 0);
318318
}
@@ -321,7 +321,7 @@ protected function showStatus($command, $watch = false)
321321
* dumpInfo
322322
* @param bool $allInfo
323323
*/
324-
protected function dumpInfo($allInfo = false)
324+
public function dumpInfo($allInfo = false)
325325
{
326326
if ($allInfo) {
327327
$this->stdout("There are all information of the manager:\n" . PhpHelper::printVar($this));

0 commit comments

Comments
 (0)