]> git.mxchange.org Git - friendica.git/commitdiff
Use getmypid() as dependency (improve testing)
authorPhilipp <admin@philipp.info>
Sat, 19 Sep 2020 18:28:01 +0000 (20:28 +0200)
committerPhilipp <admin@philipp.info>
Sat, 19 Sep 2020 18:28:01 +0000 (20:28 +0200)
src/Core/Process.php
src/Core/Worker.php
static/dependencies.config.php

index 08284b211bdd12b9714c19f74b8e03342eac60e9..f8958f102c3ceda81f9f619bb857baad43b1bea2 100644 (file)
@@ -67,14 +67,14 @@ class Process
         */
        private $pid;
 
-       public function __construct(LoggerInterface $logger, App\Mode $mode, IConfig $config, Model\Process $processModel, string $basepath)
+       public function __construct(LoggerInterface $logger, App\Mode $mode, IConfig $config, Model\Process $processModel, string $basepath, int $pid)
        {
                $this->logger = $logger;
                $this->mode = $mode;
                $this->config = $config;
                $this->basePath = $basepath;
                $this->processModel = $processModel;
-               $this->pid = getmypid();
+               $this->pid = $pid;
        }
 
        /**
index 80ec16982c709e608eff186dfc54e1dfac04ea3c..c586310b7e269246abdfa105a2d7e64546c3023b 100644 (file)
@@ -1172,7 +1172,7 @@ class Worker
                $args = ['no_cron' => !$do_cron];
 
                $a = DI::app();
-               $process = new Core\Process(DI::logger(), DI::mode(), DI::config(), $a->getBasePath());
+               $process = new Core\Process(DI::logger(), DI::mode(), DI::config(), DI::modelProcess(), $a->getBasePath(), getmypid());
                $process->run($command, $args);
 
                // after spawning we have to remove the flag.
index 3df54b79e61106c3485e0377d8dd90e4dd359ef7..b1a54786ac10cd68a4549fe717ef271c155db80d 100644 (file)
@@ -187,6 +187,7 @@ return [
        Process::class => [
                'constructParams' => [
                        [Dice::INSTANCE => '$basepath'],
+                       getmypid(),
                ],
        ],
        App\Router::class => [