]> git.mxchange.org Git - friendica.git/blob - static/dependencies.config.php
Posts per author/server on the community pages (#13764)
[friendica.git] / static / dependencies.config.php
1 <?php
2 /**
3  * @copyright Copyright (C) 2010-2023, the Friendica project
4  *
5  * @license GNU AGPL version 3 or any later version
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU Affero General Public License as
9  * published by the Free Software Foundation, either version 3 of the
10  * License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU Affero General Public License for more details.
16  *
17  * You should have received a copy of the GNU Affero General Public License
18  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
19  *
20  * The configuration defines "complex" dependencies inside Friendica
21  * So this classes shouldn't be simple or their dependencies are already defined here.
22  *
23  * This kind of dependencies are NOT required to be defined here:
24  *   - $a = new ClassA(new ClassB());
25  *   - $a = new ClassA();
26  *   - $a = new ClassA(Configuration $configuration);
27  *
28  * This kind of dependencies SHOULD be defined here:
29  *   - $a = new ClassA();
30  *     $b = $a->create();
31  *
32  *   - $a = new ClassA($creationPassedVariable);
33  *
34  */
35
36 use Dice\Dice;
37 use Friendica\App;
38 use Friendica\Core\Cache;
39 use Friendica\Core\Config;
40 use Friendica\Core\Hooks\Capability\ICanCreateInstances;
41 use Friendica\Core\Hooks\Capability\ICanRegisterStrategies;
42 use Friendica\Core\Hooks\Model\DiceInstanceManager;
43 use Friendica\Core\PConfig;
44 use Friendica\Core\L10n;
45 use Friendica\Core\Lock;
46 use Friendica\Core\Session\Capability\IHandleSessions;
47 use Friendica\Core\Session\Capability\IHandleUserSessions;
48 use Friendica\Core\Storage\Repository\StorageManager;
49 use Friendica\Database\Database;
50 use Friendica\Database\Definition\DbaDefinition;
51 use Friendica\Database\Definition\ViewDefinition;
52 use Friendica\Factory;
53 use Friendica\Core\Storage\Capability\ICanWriteToStorage;
54 use Friendica\Model\User\Cookie;
55 use Friendica\Model\Log\ParsedLogIterator;
56 use Friendica\Network;
57 use Friendica\Util;
58 use Psr\Log\LoggerInterface;
59
60 return [
61         '*'                             => [
62                 // marks all class result as shared for other creations, so there's just
63                 // one instance for the whole execution
64                 'shared' => true,
65         ],
66         \Friendica\Core\Addon\Capability\ICanLoadAddons::class => [
67                 'instanceOf' => \Friendica\Core\Addon\Model\AddonLoader::class,
68                 'constructParams' => [
69                         [Dice::INSTANCE => '$basepath'],
70                         [Dice::INSTANCE => Dice::SELF],
71                 ],
72         ],
73         '$basepath'                     => [
74                 'instanceOf'      => Util\BasePath::class,
75                 'call'            => [
76                         ['getPath', [], Dice::CHAIN_CALL],
77                 ],
78                 'constructParams' => [
79                         dirname(__FILE__, 2),
80                         $_SERVER
81                 ]
82         ],
83         Util\BasePath::class         => [
84                 'constructParams' => [
85                         dirname(__FILE__, 2),
86                         $_SERVER
87                 ]
88         ],
89         DiceInstanceManager::class   => [
90                 'constructParams' => [
91                         [Dice::INSTANCE => Dice::SELF],
92                 ]
93         ],
94         \Friendica\Core\Hooks\Util\StrategiesFileManager::class => [
95                 'constructParams' => [
96                         [Dice::INSTANCE => '$basepath'],
97                 ],
98                 'call' => [
99                         ['loadConfig'],
100                 ],
101         ],
102         ICanRegisterStrategies::class => [
103                 'instanceOf' => DiceInstanceManager::class,
104                 'constructParams' => [
105                         [Dice::INSTANCE => Dice::SELF],
106                 ],
107         ],
108         ICanCreateInstances::class   => [
109                 'instanceOf' => DiceInstanceManager::class,
110                 'constructParams' => [
111                         [Dice::INSTANCE => Dice::SELF],
112                 ],
113         ],
114         Config\Util\ConfigFileManager::class => [
115                 'instanceOf' => Config\Factory\Config::class,
116                 'call'       => [
117                         ['createConfigFileManager', [
118                                 [Dice::INSTANCE => '$basepath'],
119                                 $_SERVER,
120                         ], Dice::CHAIN_CALL],
121                 ],
122         ],
123         Config\ValueObject\Cache::class => [
124                 'instanceOf' => Config\Factory\Config::class,
125                 'call'       => [
126                         ['createCache', [], Dice::CHAIN_CALL],
127                 ],
128         ],
129         App\Mode::class              => [
130                 'call' => [
131                         ['determineRunMode', [true, $_SERVER], Dice::CHAIN_CALL],
132                         ['determine', [
133                                 [Dice::INSTANCE => '$basepath']
134                         ], Dice::CHAIN_CALL],
135                 ],
136         ],
137         Config\Capability\IManageConfigValues::class => [
138                 'instanceOf' => Config\Model\DatabaseConfig::class,
139                 'constructParams' => [
140                         $_SERVER,
141                 ],
142         ],
143         PConfig\Capability\IManagePersonalConfigValues::class => [
144                 'instanceOf' => PConfig\Factory\PConfig::class,
145                 'call'       => [
146                         ['create', [], Dice::CHAIN_CALL],
147                 ]
148         ],
149         DbaDefinition::class => [
150                 'constructParams' => [
151                         [Dice::INSTANCE => '$basepath'],
152                 ],
153                 'call' => [
154                         ['load', [false], Dice::CHAIN_CALL],
155                 ],
156         ],
157         ViewDefinition::class => [
158                 'constructParams' => [
159                         [Dice::INSTANCE => '$basepath'],
160                 ],
161                 'call' => [
162                         ['load', [false], Dice::CHAIN_CALL],
163                 ],
164         ],
165         Database::class                         => [
166                 'constructParams' => [
167                         [Dice::INSTANCE => Config\Model\ReadOnlyFileConfig::class],
168                 ],
169         ],
170         /**
171          * Creates the App\BaseURL
172          *
173          * Same as:
174          *   $baseURL = new App\BaseURL($configuration, $_SERVER);
175          */
176         App\BaseURL::class             => [
177                 'constructParams' => [
178                         $_SERVER,
179                 ],
180         ],
181         '$hostname'                    => [
182                 'instanceOf' => App\BaseURL::class,
183                 'constructParams' => [
184                         $_SERVER,
185                 ],
186                 'call' => [
187                         ['getHost', [], Dice::CHAIN_CALL],
188                 ],
189         ],
190         Cache\Type\AbstractCache::class => [
191                 'constructParams' => [
192                         [Dice::INSTANCE => '$hostname'],
193                 ],
194         ],
195         App\Page::class => [
196                 'constructParams' => [
197                         [Dice::INSTANCE => '$basepath'],
198                 ],
199         ],
200         \Psr\Log\LoggerInterface::class                                    => [
201                 'instanceOf' => \Friendica\Core\Logger\Factory\Logger::class,
202                 'call'       => [
203                         ['create', [], Dice::CHAIN_CALL],
204                 ],
205         ],
206         \Friendica\Core\Logger\Type\SyslogLogger::class                    => [
207                 'instanceOf' => \Friendica\Core\Logger\Factory\SyslogLogger::class,
208                 'call'       => [
209                         ['create', [], Dice::CHAIN_CALL],
210                 ],
211         ],
212         \Friendica\Core\Logger\Type\StreamLogger::class                    => [
213                 'instanceOf' => \Friendica\Core\Logger\Factory\StreamLogger::class,
214                 'call'       => [
215                         ['create', [], Dice::CHAIN_CALL],
216                 ],
217         ],
218         \Friendica\Core\Logger\Capability\IHaveCallIntrospections::class => [
219                 'instanceOf'      => \Friendica\Core\Logger\Util\Introspection::class,
220                 'constructParams' => [
221                         \Friendica\Core\Logger\Capability\IHaveCallIntrospections::IGNORE_CLASS_LIST,
222                 ],
223         ],
224         '$devLogger'                                                       => [
225                 'instanceOf' => \Friendica\Core\Logger\Factory\StreamLogger::class,
226                 'call'       => [
227                         ['createDev', [], Dice::CHAIN_CALL],
228                 ],
229         ],
230         Cache\Capability\ICanCache::class => [
231                 'instanceOf' => Cache\Factory\Cache::class,
232                 'call'       => [
233                         ['createLocal', [], Dice::CHAIN_CALL],
234                 ],
235         ],
236         Cache\Capability\ICanCacheInMemory::class => [
237                 'instanceOf' => Cache\Factory\Cache::class,
238                 'call'       => [
239                         ['createLocal', [], Dice::CHAIN_CALL],
240                 ],
241         ],
242         Lock\Capability\ICanLock::class => [
243                 'instanceOf' => Lock\Factory\Lock::class,
244                 'call'       => [
245                         ['create', [], Dice::CHAIN_CALL],
246                 ],
247         ],
248         App\Arguments::class => [
249                 'instanceOf' => App\Arguments::class,
250                 'call' => [
251                         ['determine', [$_SERVER, $_GET], Dice::CHAIN_CALL],
252                 ],
253         ],
254         \Friendica\Core\System::class => [
255                 'constructParams' => [
256                         [Dice::INSTANCE => '$basepath'],
257                 ],
258         ],
259         App\Router::class => [
260                 'constructParams' => [
261                         $_SERVER,
262                         __DIR__ . '/routes.config.php',
263                         [Dice::INSTANCE => Dice::SELF],
264                         null
265                 ],
266         ],
267         L10n::class => [
268                 'constructParams' => [
269                         $_SERVER, $_GET
270                 ],
271         ],
272         IHandleSessions::class => [
273                 'instanceOf' => \Friendica\Core\Session\Factory\Session::class,
274                 'call' => [
275                         ['create', [$_SERVER], Dice::CHAIN_CALL],
276                         ['start', [], Dice::CHAIN_CALL],
277                 ],
278         ],
279         IHandleUserSessions::class => [
280                 'instanceOf' => \Friendica\Core\Session\Model\UserSession::class,
281         ],
282         Cookie::class => [
283                 'constructParams' => [
284                         $_COOKIE
285                 ],
286         ],
287         ICanWriteToStorage::class => [
288                 'instanceOf' => StorageManager::class,
289                 'call' => [
290                         ['getBackend', [], Dice::CHAIN_CALL],
291                 ],
292         ],
293         \Friendica\Core\KeyValueStorage\Capability\IManageKeyValuePairs::class => [
294                 'instanceOf' => \Friendica\Core\KeyValueStorage\Factory\KeyValueStorage::class,
295                 'call' => [
296                         ['create', [], Dice::CHAIN_CALL],
297                 ],
298         ],
299         Network\HTTPClient\Capability\ICanSendHttpRequests::class => [
300                 'instanceOf' => Network\HTTPClient\Factory\HttpClient::class,
301                 'call'       => [
302                         ['createClient', [], Dice::CHAIN_CALL],
303                 ],
304         ],
305         ParsedLogIterator::class => [
306                 'constructParams' => [
307                         [Dice::INSTANCE => Util\ReversedFileReader::class],
308                 ]
309         ],
310         \Friendica\Core\Worker\Repository\Process::class => [
311                 'constructParams' => [
312                         $_SERVER
313                 ],
314         ],
315         App\Request::class => [
316                 'constructParams' => [
317                         $_SERVER
318                 ],
319         ],
320         \Psr\Clock\ClockInterface::class => [
321                 'instanceOf' => Util\Clock\SystemClock::class
322         ],
323         \Friendica\Module\Special\HTTPException::class => [
324                 'constructParams' => [
325                         $_SERVER
326                 ],
327         ],
328         \Friendica\Module\Api\ApiResponse::class => [
329                 'constructParams' => [
330                         $_SERVER,
331                         $_GET['callback'] ?? '',
332                 ],
333         ],
334 ];