]> git.mxchange.org Git - friendica.git/commitdiff
Move setupContainerForAddons() into App
authorArt4 <art4@wlabs.de>
Thu, 9 Jan 2025 08:17:43 +0000 (08:17 +0000)
committerArt4 <art4@wlabs.de>
Thu, 9 Jan 2025 08:17:43 +0000 (08:17 +0000)
src/App.php
src/Core/DiceContainer.php

index 10c360319986d6ed1ab144211c567fd06fd0c1cc..8c22a42a0629aecba31ad9e763caaa75306f36e4 100644 (file)
@@ -17,6 +17,7 @@ use Friendica\App\Router;
 use Friendica\Capabilities\ICanCreateResponses;
 use Friendica\Capabilities\ICanHandleRequests;
 use Friendica\Content\Nav;
+use Friendica\Core\Addon\Capability\ICanLoadAddons;
 use Friendica\Core\Config\Factory\Config;
 use Friendica\Core\Container;
 use Friendica\Core\Renderer;
@@ -134,6 +135,8 @@ class App
                        ],
                ]);
 
+               $this->setupContainerForAddons();
+
                $this->container->setup(LogChannel::APP, false);
 
                $this->requestId = $this->container->create(Request::class)->getRequestId();
@@ -170,11 +173,15 @@ class App
 
        public function processConsole(array $argv): void
        {
+               $this->setupContainerForAddons();
+
                (\Friendica\Core\Console::create($this->container, $argv))->execute();
        }
 
        public function processEjabberd(): void
        {
+               $this->setupContainerForAddons();
+
                $this->container->setup(LogChannel::AUTH_JABBERED, false);
 
                /** @var BasePath */
@@ -192,6 +199,16 @@ class App
                }
        }
 
+       private function setupContainerForAddons(): void
+       {
+               /** @var ICanLoadAddons $addonLoader */
+               $addonLoader = $this->container->create(ICanLoadAddons::class);
+
+               foreach ($addonLoader->getActiveAddonConfig('dependencies') as $name => $rule) {
+                       $this->container->addRule($name, $rule);
+               }
+       }
+
        private function registerTemplateEngine(): void
        {
                Renderer::registerTemplateEngine('Friendica\Render\FriendicaSmartyEngine');
index d2abdc58fa5e660efdcd890fb64ec46f2a063ad9..8b7f9472d7a9bfffbb6150319ab52f99f17af5c6 100644 (file)
@@ -49,7 +49,6 @@ final class DiceContainer implements Container
         */
        public function setup(string $logChannel = LogChannel::DEFAULT, bool $withTemplateEngine = true): void
        {
-               $this->setupContainerForAddons();
                $this->setupContainerForLogger($logChannel);
                $this->setupLegacyServiceLocator();
                $this->registerErrorHandler();
@@ -85,14 +84,6 @@ final class DiceContainer implements Container
                $this->container = $this->container->addRule($name, $rule);
        }
 
-       private function setupContainerForAddons(): void
-       {
-               /** @var ICanLoadAddons $addonLoader */
-               $addonLoader = $this->container->create(ICanLoadAddons::class);
-
-               $this->container = $this->container->addRules($addonLoader->getActiveAddonConfig('dependencies'));
-       }
-
        private function setupContainerForLogger(string $logChannel): void
        {
                $this->container = $this->container->addRule(LoggerInterface::class, [