]> git.mxchange.org Git - friendica.git/commitdiff
extract dependency for $_SERVER
authorArt4 <art4@wlabs.de>
Thu, 26 Dec 2024 10:27:44 +0000 (10:27 +0000)
committerArt4 <art4@wlabs.de>
Thu, 26 Dec 2024 10:27:44 +0000 (10:27 +0000)
bin/daemon.php
src/App.php

index 5242d9bf4e65f08e93277f0535390ba4f51cb824..83774c7a2de4054baeb12dac334c5c37c3509de3 100755 (executable)
@@ -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);
index a1634e54f903fe2a69e87297c8552c52a9471062..481b1c07c794d9be6e35e805edcaa57bb44726e4 100644 (file)
@@ -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");
                }