extract dependency for $_SERVER

This commit is contained in:
Art4 2024-12-26 10:27:44 +00:00
parent eb0e1c393f
commit cb5a1daa40
2 changed files with 6 additions and 6 deletions

View file

@ -31,4 +31,4 @@ $dice = (new Dice())->addRules(require(dirname(__DIR__) . '/static/dependencies.
$app = \Friendica\App::fromDice($dice); $app = \Friendica\App::fromDice($dice);
$app->processDaemon($options); $app->processDaemon($_SERVER['argv'] ?? [], $options);

View file

@ -216,7 +216,7 @@ class App
(new \Friendica\Core\Console($this->container, $argv))->execute(); (new \Friendica\Core\Console($this->container, $argv))->execute();
} }
public function processDaemon(array $options): void public function processDaemon(array $argv, array $options): void
{ {
$this->setupContainerForAddons(); $this->setupContainerForAddons();
@ -247,15 +247,15 @@ class App
$pidfile = DI::config()->get('system', 'pidfile'); $pidfile = DI::config()->get('system', 'pidfile');
if (in_array('start', $_SERVER['argv'])) { if (in_array('start', $argv)) {
$mode = 'start'; $mode = 'start';
} }
if (in_array('stop', $_SERVER['argv'])) { if (in_array('stop', $argv)) {
$mode = 'stop'; $mode = 'stop';
} }
if (in_array('status', $_SERVER['argv'])) { if (in_array('status', $argv)) {
$mode = 'status'; $mode = 'status';
} }
@ -265,7 +265,7 @@ class App
die("Please use either 'start', 'stop' or 'status'.\n"); die("Please use either 'start', 'stop' or 'status'.\n");
} }
if (empty($_SERVER['argv'][0])) { if (empty($argv[0])) {
die("Unexpected script behaviour. This message should never occur.\n"); die("Unexpected script behaviour. This message should never occur.\n");
} }