]> git.mxchange.org Git - friendica.git/commitdiff
Refactor getting the basepath
authorArt4 <art4@wlabs.de>
Sun, 22 Dec 2024 16:29:47 +0000 (16:29 +0000)
committerArt4 <art4@wlabs.de>
Sun, 22 Dec 2024 16:29:47 +0000 (16:29 +0000)
static/dependencies.config.php

index 615319336b8ceb07af6a893400cea5890dc3fa9a..5ca2f1672629efa4b0373a5f331cfe612adf48e8 100644 (file)
@@ -47,6 +47,12 @@ use Friendica\Network;
 use Friendica\Util;
 use Psr\Log\LoggerInterface;
 
+$basepath = (function() {
+       $path = dirname(__FILE__, 2);
+
+       return ($realpath = realpath($path)) ? $realpath : $path;
+})();
+
 return [
        '*'                             => [
                // marks all class result as shared for other creations, so there's just
@@ -56,7 +62,7 @@ return [
        \Friendica\Core\Addon\Capability\ICanLoadAddons::class => [
                'instanceOf' => \Friendica\Core\Addon\Model\AddonLoader::class,
                'constructParams' => [
-                       [Dice::INSTANCE => '$basepath'],
+                       $basepath,
                        [Dice::INSTANCE => Dice::SELF],
                ],
        ],
@@ -83,7 +89,7 @@ return [
        ],
        \Friendica\Core\Hooks\Util\StrategiesFileManager::class => [
                'constructParams' => [
-                       [Dice::INSTANCE => '$basepath'],
+                       $basepath,
                ],
                'call' => [
                        ['loadConfig'],
@@ -108,7 +114,7 @@ return [
                'instanceOf' => Config\Factory\Config::class,
                'call'       => [
                        ['createConfigFileManager', [
-                               [Dice::INSTANCE => '$basepath'],
+                               $basepath,
                                $_SERVER,
                        ], Dice::CHAIN_CALL],
                ],
@@ -123,7 +129,7 @@ return [
                'call' => [
                        ['determineRunMode', [true, $_SERVER], Dice::CHAIN_CALL],
                        ['determine', [
-                               [Dice::INSTANCE => '$basepath']
+                               $basepath,
                        ], Dice::CHAIN_CALL],
                ],
        ],
@@ -141,7 +147,7 @@ return [
        ],
        DbaDefinition::class => [
                'constructParams' => [
-                       [Dice::INSTANCE => '$basepath'],
+                       $basepath,
                ],
                'call' => [
                        ['load', [false], Dice::CHAIN_CALL],
@@ -149,7 +155,7 @@ return [
        ],
        ViewDefinition::class => [
                'constructParams' => [
-                       [Dice::INSTANCE => '$basepath'],
+                       $basepath,
                ],
                'call' => [
                        ['load', [false], Dice::CHAIN_CALL],
@@ -187,7 +193,7 @@ return [
        ],
        App\Page::class => [
                'constructParams' => [
-                       [Dice::INSTANCE => '$basepath'],
+                       $basepath,
                ],
        ],
        \Psr\Log\LoggerInterface::class                                    => [
@@ -246,7 +252,7 @@ return [
        ],
        \Friendica\Core\System::class => [
                'constructParams' => [
-                       [Dice::INSTANCE => '$basepath'],
+                       $basepath,
                ],
        ],
        App\Router::class => [