From cb5a1daa408160c00994c39aaa8278c3fdfc4d9c Mon Sep 17 00:00:00 2001 From: Art4 Date: Thu, 26 Dec 2024 10:27:44 +0000 Subject: [PATCH] extract dependency for $_SERVER --- bin/daemon.php | 2 +- src/App.php | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bin/daemon.php b/bin/daemon.php index 5242d9bf4e..83774c7a2d 100755 --- a/bin/daemon.php +++ b/bin/daemon.php @@ -31,4 +31,4 @@ $dice = (new Dice())->addRules(require(dirname(__DIR__) . '/static/dependencies. $app = \Friendica\App::fromDice($dice); -$app->processDaemon($options); +$app->processDaemon($_SERVER['argv'] ?? [], $options); diff --git a/src/App.php b/src/App.php index a1634e54f9..481b1c07c7 100644 --- a/src/App.php +++ b/src/App.php @@ -216,7 +216,7 @@ class App (new \Friendica\Core\Console($this->container, $argv))->execute(); } - public function processDaemon(array $options): void + public function processDaemon(array $argv, array $options): void { $this->setupContainerForAddons(); @@ -247,15 +247,15 @@ class App $pidfile = DI::config()->get('system', 'pidfile'); - if (in_array('start', $_SERVER['argv'])) { + if (in_array('start', $argv)) { $mode = 'start'; } - if (in_array('stop', $_SERVER['argv'])) { + if (in_array('stop', $argv)) { $mode = 'stop'; } - if (in_array('status', $_SERVER['argv'])) { + if (in_array('status', $argv)) { $mode = 'status'; } @@ -265,7 +265,7 @@ class App 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"); }