X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=static%2Fdependencies.config.php;h=830b7fec389121eeed1778ca919496c8275b4226;hb=e7d65f2d12ee9156de525233d6f07c6bcdb5e5d4;hp=5b7a345685947cc179634285914fc1fd5a6aecf8;hpb=b2d7c4ec430d4706e634e982dbb56db45b153aec;p=friendica.git diff --git a/static/dependencies.config.php b/static/dependencies.config.php index 5b7a345685..830b7fec38 100644 --- a/static/dependencies.config.php +++ b/static/dependencies.config.php @@ -37,8 +37,9 @@ use Dice\Dice; use Friendica\App; use Friendica\Core\Cache; use Friendica\Core\Config; -use Friendica\Core\Hooks\Capabilities\ICanManageInstances; -use Friendica\Core\Hooks\Model\InstanceManager; +use Friendica\Core\Hooks\Capability\ICanCreateInstances; +use Friendica\Core\Hooks\Capability\ICanRegisterStrategies; +use Friendica\Core\Hooks\Model\DiceInstanceManager; use Friendica\Core\PConfig; use Friendica\Core\L10n; use Friendica\Core\Lock; @@ -62,6 +63,13 @@ return [ // one instance for the whole execution 'shared' => true, ], + \Friendica\Core\Addon\Capability\ICanLoadAddons::class => [ + 'instanceOf' => \Friendica\Core\Addon\Model\AddonLoader::class, + 'constructParams' => [ + [Dice::INSTANCE => '$basepath'], + [Dice::INSTANCE => Dice::SELF], + ], + ], '$basepath' => [ 'instanceOf' => Util\BasePath::class, 'call' => [ @@ -78,8 +86,27 @@ return [ $_SERVER ] ], - ICanManageInstances::class => [ - 'instanceOf' => InstanceManager::class, + DiceInstanceManager::class => [ + 'constructParams' => [ + [Dice::INSTANCE => Dice::SELF], + ] + ], + \Friendica\Core\Hooks\Util\StrategiesFileManager::class => [ + 'constructParams' => [ + [Dice::INSTANCE => '$basepath'], + ], + 'call' => [ + ['loadConfig'], + ], + ], + ICanRegisterStrategies::class => [ + 'instanceOf' => DiceInstanceManager::class, + 'constructParams' => [ + [Dice::INSTANCE => Dice::SELF], + ], + ], + ICanCreateInstances::class => [ + 'instanceOf' => DiceInstanceManager::class, 'constructParams' => [ [Dice::INSTANCE => Dice::SELF], ], @@ -108,7 +135,7 @@ return [ ], ], Config\Capability\IManageConfigValues::class => [ - 'instanceOf' => Config\Model\Config::class, + 'instanceOf' => Config\Model\DatabaseConfig::class, 'constructParams' => [ $_SERVER, ], @@ -137,7 +164,7 @@ return [ ], Database::class => [ 'constructParams' => [ - [Dice::INSTANCE => \Psr\Log\NullLogger::class], + [Dice::INSTANCE => Config\Model\ReadOnlyFileConfig::class], ], ], /** @@ -151,45 +178,53 @@ return [ $_SERVER, ], ], + '$hostname' => [ + 'instanceOf' => App\BaseURL::class, + 'constructParams' => [ + $_SERVER, + ], + 'call' => [ + ['getHost', [], Dice::CHAIN_CALL], + ], + ], + Cache\Type\AbstractCache::class => [ + 'constructParams' => [ + [Dice::INSTANCE => '$hostname'], + ], + ], App\Page::class => [ 'constructParams' => [ [Dice::INSTANCE => '$basepath'], ], ], - /** - * Create a Logger, which implements the LoggerInterface - * - * Same as: - * $loggerFactory = new Factory\LoggerFactory(); - * $logger = $loggerFactory->create($channel, $configuration, $profiler); - * - * Attention1: We can use DICE for detecting dependencies inside "chained" calls too - * Attention2: The variable "$channel" is passed inside the creation of the dependencies per: - * $app = $dice->create(App::class, [], ['$channel' => 'index']); - * and is automatically passed as an argument with the same name - */ - LoggerInterface::class => [ + \Psr\Log\LoggerInterface::class => [ 'instanceOf' => \Friendica\Core\Logger\Factory\Logger::class, - 'constructParams' => [ - 'index', + 'call' => [ + ['create', [], Dice::CHAIN_CALL], ], + ], + \Friendica\Core\Logger\Type\SyslogLogger::class => [ + 'instanceOf' => \Friendica\Core\Logger\Factory\SyslogLogger::class, 'call' => [ ['create', [], Dice::CHAIN_CALL], ], ], - '$devLogger' => [ - 'instanceOf' => \Friendica\Core\Logger\Factory\Logger::class, + \Friendica\Core\Logger\Type\StreamLogger::class => [ + 'instanceOf' => \Friendica\Core\Logger\Factory\StreamLogger::class, + 'call' => [ + ['create', [], Dice::CHAIN_CALL], + ], + ], + \Friendica\Core\Logger\Capability\IHaveCallIntrospections::class => [ + 'instanceOf' => \Friendica\Core\Logger\Util\Introspection::class, 'constructParams' => [ - 'dev', + \Friendica\Core\Logger\Capability\IHaveCallIntrospections::IGNORE_CLASS_LIST, ], + ], + '$devLogger' => [ + 'instanceOf' => \Friendica\Core\Logger\Factory\StreamLogger::class, 'call' => [ ['createDev', [], Dice::CHAIN_CALL], - ] - ], - \Friendica\Core\Logger\Capabilities\IHaveCallIntrospections::class => [ - 'instanceOf' => \Friendica\Core\Logger\Util\Introspection::class, - 'constructParams' => [ - \Friendica\Core\Logger\Util\Introspection::IGNORE_CLASS_LIST, ], ], Cache\Capability\ICanCache::class => [ @@ -237,7 +272,7 @@ return [ IHandleSessions::class => [ 'instanceOf' => \Friendica\Core\Session\Factory\Session::class, 'call' => [ - ['createSession', [$_SERVER], Dice::CHAIN_CALL], + ['create', [$_SERVER], Dice::CHAIN_CALL], ['start', [], Dice::CHAIN_CALL], ], ], @@ -255,8 +290,11 @@ return [ ['getBackend', [], Dice::CHAIN_CALL], ], ], - \Friendica\Core\KeyValueStorage\Capabilities\IManageKeyValuePairs::class => [ - 'instanceOf' => \Friendica\Core\KeyValueStorage\Type\DBKeyValueStorage::class, + \Friendica\Core\KeyValueStorage\Capability\IManageKeyValuePairs::class => [ + 'instanceOf' => \Friendica\Core\KeyValueStorage\Factory\KeyValueStorage::class, + 'call' => [ + ['create', [], Dice::CHAIN_CALL], + ], ], Network\HTTPClient\Capability\ICanSendHttpRequests::class => [ 'instanceOf' => Network\HTTPClient\Factory\HttpClient::class, @@ -292,4 +330,10 @@ return [ $_SERVER ], ], + \Friendica\Module\Api\ApiResponse::class => [ + 'constructParams' => [ + $_SERVER, + $_GET['callback'] ?? '', + ], + ], ];