Elgg  Version master
internal_services.php
Go to the documentation of this file.
1 <?php
2 
4 
5 return [
6  'autoloadCache' => DI\autowire(\Elgg\Cache\AutoloadCache::class),
7  'autoloadManager' => DI\autowire(\Elgg\AutoloadManager::class),
8  'accessCache' => DI\autowire(\Elgg\Cache\AccessCache::class),
9  'accessCollections' => DI\autowire(\Elgg\Database\AccessCollections::class),
10  'actions' => DI\autowire(\Elgg\ActionsService::class),
11  'accounts' => DI\autowire(\Elgg\Users\Accounts::class),
12  'adminNotices' => DI\autowire(\Elgg\Database\AdminNotices::class),
13  'ajax' => DI\autowire(\Elgg\Ajax\Service::class),
14  'annotationsTable' => DI\autowire(\Elgg\Database\AnnotationsTable::class),
15  'apiUsersTable' => DI\autowire(\Elgg\Database\ApiUsersTable::class),
16  'authentication' => DI\autowire(\Elgg\AuthenticationService::class),
17  'autoParagraph' => DI\autowire(\Elgg\Views\AutoParagraph::class),
18  'boot' => DI\autowire(\Elgg\BootService::class),
19  'bootCache' => DI\autowire(\Elgg\Cache\BootCache::class),
20  'cacheHandler' => DI\autowire(\Elgg\Application\CacheHandler::class),
21  'cssCompiler' => DI\autowire(\Elgg\Assets\CssCompiler::class),
22  'csrf' => DI\autowire(\Elgg\Security\Csrf::class),
23  'classLoader' => DI\autowire(\Elgg\ClassLoader::class),
24  'cli' => DI\autowire(\Elgg\Cli::class)->constructorParameter('input', DI\get('cli_input'))->constructorParameter('output', DI\get('cli_output')),
25  'cli_input' => DI\factory(function (ContainerInterface $c) {
26  return \Elgg\Application::getStdIn();
27  }),
28  'cli_output' => DI\factory(function (ContainerInterface $c) {
29  return \Elgg\Application::getStdOut();
30  }),
31  'cli_progress' => DI\autowire(\Elgg\Cli\Progress::class)->constructorParameter('output', DI\get('cli_output')),
32  // the 'config' service is available but is set as part of the construction of the application
33  'configTable' => DI\autowire(\Elgg\Database\ConfigTable::class),
34  'cron' => DI\autowire(\Elgg\Cron::class),
35  'crypto' => DI\autowire(\Elgg\Security\Crypto::class),
36  'db' => DI\autowire(\Elgg\Database::class),
37  // the 'dbConfig' service is available but is set as part of the construction of the application
38  'delayedEmailQueueTable' => DI\autowire(\Elgg\Database\DelayedEmailQueueTable::class),
39  'delayedEmailService' => DI\autowire(\Elgg\Email\DelayedEmailService::class),
40  'emails' => DI\autowire(\Elgg\EmailService::class)->constructorParameter('mailer', DI\get('mailer')),
41  'entityCache' => DI\autowire(\Elgg\Cache\EntityCache::class),
42  'entity_capabilities' => DI\autowire(\Elgg\EntityCapabilitiesService::class),
43  'entityPreloader' => DI\autowire(\Elgg\EntityPreloader::class),
44  'entityTable' => DI\autowire(\Elgg\Database\EntityTable::class),
45  'esm' => DI\autowire(\Elgg\Javascript\ESMService::class),
46  'events' => DI\autowire(\Elgg\EventsService::class),
47  'externalFiles' => DI\autowire(\Elgg\Assets\ExternalFiles::class),
48  'fields' => DI\autowire(\Elgg\Forms\FieldsService::class),
49  'forms' => DI\autowire(\Elgg\FormsService::class),
50  'filestore' => DI\factory(function (ContainerInterface $c) {
51  return new \Elgg\Filesystem\Filestore\DiskFilestore($c->config->dataroot);
52  }),
53  'gatekeeper' => DI\autowire(\Elgg\Gatekeeper::class),
54  'group_tools' => DI\autowire(\Elgg\Groups\Tools::class),
55  'handlers' => DI\autowire(\Elgg\HandlersService::class),
56  'hmac' => DI\autowire(\Elgg\Security\HmacFactory::class),
57  'hmacCacheTable' => DI\autowire(\Elgg\Database\HMACCacheTable::class),
58  'html_formatter' => DI\autowire(\Elgg\Views\HtmlFormatter::class),
59  'iconService' => DI\autowire(\Elgg\EntityIconService::class),
60  'imageFetcher' => DI\autowire(\Elgg\Assets\ImageFetcherService::class),
61  'imageService' => DI\autowire(\Elgg\ImageService::class),
62  'invoker' => DI\autowire(\Elgg\Invoker::class)->constructorParameter('dic', function() { return elgg(); }),
63  'locale' => DI\autowire(\Elgg\I18n\LocaleService::class),
64  'logger' => DI\factory(function (ContainerInterface $c) {
65  $logger = \Elgg\Logger::factory($c->cli_input, $c->cli_output);
66 
67  $logger->setLevel($c->config->debug);
68 
69  return $logger;
70  }),
71  'mailer' => DI\factory(function (ContainerInterface $c) {
72  switch ($c->config->emailer_transport) {
73  case 'smtp':
74  $transport = new \Laminas\Mail\Transport\Smtp();
75  $transportOptions = new \Laminas\Mail\Transport\SmtpOptions(
76  $c->config->emailer_smtp_settings
77  );
78  $transport->setOptions($transportOptions);
79  return $transport;
80  default:
81  return new \Laminas\Mail\Transport\Sendmail($c->config->emailer_sendmail_settings);
82  }
83  }),
84  'menus' => DI\autowire(\Elgg\Menu\Service::class),
85  'metadataCache' => DI\autowire(\Elgg\Cache\MetadataCache::class),
86  'metadataTable' => DI\autowire(\Elgg\Database\MetadataTable::class),
87  'mimetype' => DI\autowire(\Elgg\Filesystem\MimeTypeService::class),
88  'mutex' => DI\autowire(\Elgg\Database\Mutex::class),
89  'notifications' => DI\autowire(\Elgg\Notifications\NotificationsService::class)->constructorParameter('queue', DI\get('notificationsQueue')),
90  'notificationsQueue' => DI\autowire(\Elgg\Notifications\NotificationsQueue::class)->constructorParameter('name', \Elgg\Notifications\NotificationsQueue::QUEUE_NAME),
91  'pageOwner' => DI\autowire(\Elgg\Page\PageOwnerService::class),
92  'passwords' => DI\autowire(\Elgg\PasswordService::class),
93  'passwordGenerator' => DI\autowire(\Elgg\Security\PasswordGeneratorService::class),
94  'persistentLogin' => DI\autowire(\Elgg\PersistentLoginService::class),
95  'plugins' => DI\autowire(\Elgg\Database\Plugins::class),
96  'pluginsCache' => DI\autowire(\Elgg\Cache\PluginsCache::class),
97  'publicDb' => DI\autowire(\Elgg\Application\Database::class),
98  'queryCache' => DI\autowire(\Elgg\Cache\QueryCache::class),
99  'redirects' => DI\autowire(\Elgg\RedirectService::class),
100  'relationshipsTable' => DI\autowire(\Elgg\Database\RelationshipsTable::class),
101  'request' => DI\factory(function (ContainerInterface $c) {
102  global $CONFIG;
103  $request = \Elgg\Http\Request::createFromGlobals();
104 
105  // not using config service because of deadloop issues (request is used during config construction)
106  // global $CONFIG is not set during installer
107  if ($CONFIG instanceof \Elgg\Config) {
108  $request->initializeTrustedProxyConfiguration($CONFIG);
109  $request->correctBaseURL($CONFIG);
110  }
111 
112  return $request;
113  }),
114  'requestContext' => DI\factory(function (ContainerInterface $c) {
115  $context = new \Elgg\Router\RequestContext();
116  return $context->fromRequest($c->request);
117  }),
118  'responseFactory' => DI\autowire(\Elgg\Http\ResponseFactory::class),
119  'riverTable' => DI\autowire(\Elgg\Database\RiverTable::class),
120  'routeCollection' => DI\autowire(\Elgg\Router\RouteCollection::class),
121  'routes' => DI\autowire(\Elgg\Router\RouteRegistrationService::class),
122  'router' => DI\autowire(\Elgg\Router::class),
123  'search' => DI\autowire(\Elgg\Search\SearchService::class),
124  'seeder' => DI\autowire(\Elgg\Database\Seeder::class),
125  'serveFileHandler' => DI\autowire(\Elgg\Application\ServeFileHandler::class),
126  'serverCache' => DI\autowire(\Elgg\Cache\ServerCache::class),
127  'session' => DI\factory(function (ContainerInterface $c) {
128  return \ElggSession::fromDatabase($c->config, $c->db);
129  }),
130  'session_manager' => DI\autowire(\Elgg\SessionManagerService::class),
131  'simpleCache' => DI\autowire(\Elgg\Cache\SimpleCache::class),
132  'siteSecret' => DI\autowire(\Elgg\Security\SiteSecret::class),
133  'stickyForms' => DI\autowire(\Elgg\Forms\StickyForms::class),
134  'systemCache' => DI\autowire(\Elgg\Cache\SystemCache::class),
135  'subscriptions' => DI\autowire(\Elgg\Notifications\SubscriptionsService::class),
136  'system_messages' => DI\autowire(\Elgg\SystemMessagesService::class),
137  'table_columns' => DI\autowire(\Elgg\Views\TableColumn\ColumnFactory::class),
138  'temp_filestore' => DI\autowire(\Elgg\Filesystem\Filestore\TempDiskFilestore::class),
139  'timer' => DI\autowire(\Elgg\Timer::class),
140  'translator' => DI\autowire(\Elgg\I18n\Translator::class),
141  'uploads' => DI\autowire(\Elgg\UploadService::class),
142  'upgrades' => DI\autowire(\Elgg\UpgradeService::class),
143  'urlGenerator' => DI\autowire(\Elgg\Router\UrlGenerator::class),
144  'urlMatcher' => DI\autowire(\Elgg\Router\UrlMatcher::class),
145  'urlSigner' => DI\autowire(\Elgg\Security\UrlSigner::class),
146  'urls' => DI\autowire(\Elgg\Http\Urls::class),
147  'userCapabilities' => DI\autowire(\Elgg\UserCapabilities::class),
148  'usersApiSessionsTable' => DI\autowire(\Elgg\Database\UsersApiSessionsTable::class),
149  'users_remember_me_cookies_table' => DI\autowire(\Elgg\Database\UsersRememberMeCookiesTable::class),
150  'upgradeLocator' => DI\autowire(\Elgg\Upgrade\Locator::class),
151  'views' => DI\autowire(\Elgg\ViewsService::class),
152  'widgets' => DI\autowire(\Elgg\WidgetsService::class),
153 
154  // map classes to alias to allow autowiring
155  \ElggSession::class => DI\get('session'),
156  \Elgg\ActionsService::class => DI\get('actions'),
157  \Elgg\Ajax\Service::class => DI\get('ajax'),
158  \Elgg\Application\CacheHandler::class => DI\get('cacheHandler'),
159  \Elgg\Application\Database::class => DI\get('publicDb'),
160  \Elgg\Application\ServeFileHandler::class => DI\get('serveFileHandler'),
161  \Elgg\Assets\CssCompiler::class => DI\get('cssCompiler'),
162  \Elgg\Assets\ExternalFiles::class => DI\get('externalFiles'),
163  \Elgg\Assets\ImageFetcherService::class => DI\get('imageFetcher'),
164  \Elgg\AuthenticationService::class => DI\get('authentication'),
165  \Elgg\AutoloadManager::class => DI\get('autoloadManager'),
166  \Elgg\BootService::class => DI\get('boot'),
167  \Elgg\Cache\AccessCache::class => DI\get('accessCache'),
168  \Elgg\Cache\AutoloadCache::class => DI\get('autoloadCache'),
169  \Elgg\Cache\BootCache::class => DI\get('bootCache'),
170  \Elgg\Cache\EntityCache::class => DI\get('entityCache'),
171  \Elgg\Cache\MetadataCache::class => DI\get('metadataCache'),
172  \Elgg\Cache\PluginsCache::class => DI\get('pluginsCache'),
173  \Elgg\Cache\QueryCache::class => DI\get('queryCache'),
174  \Elgg\Cache\ServerCache::class => DI\get('serverCache'),
175  \Elgg\Cache\SimpleCache::class => DI\get('simpleCache'),
176  \Elgg\Cache\SystemCache::class => DI\get('systemCache'),
177  \Elgg\ClassLoader::class => DI\get('classLoader'),
178  \Elgg\Cli::class => DI\get('cli'),
179  \Elgg\Cli\Progress::class => DI\get('cli_progress'),
180  \Elgg\Config::class => DI\get('config'),
181  \Elgg\Cron::class => DI\get('cron'),
182  \Elgg\Database::class => DI\get('db'),
183  \Elgg\Database\AccessCollections::class => DI\get('accessCollections'),
184  \Elgg\Database\AdminNotices::class => DI\get('adminNotices'),
185  \Elgg\Database\AnnotationsTable::class => DI\get('annotationsTable'),
186  \Elgg\Database\ApiUsersTable::class => DI\get('apiUsersTable'),
187  \Elgg\Database\ConfigTable::class => DI\get('configTable'),
188  \Elgg\Database\DbConfig::class => DI\get('dbConfig'),
189  \Elgg\Database\DelayedEmailQueueTable::class => DI\get('delayedEmailQueueTable'),
190  \Elgg\Database\EntityTable::class => DI\get('entityTable'),
191  \Elgg\Database\HMACCacheTable::class => DI\get('hmacCacheTable'),
192  \Elgg\Database\MetadataTable::class => DI\get('metadataTable'),
193  \Elgg\Database\Mutex::class => DI\get('mutex'),
194  \Elgg\Database\Plugins::class => DI\get('plugins'),
195  \Elgg\Database\RelationshipsTable::class => DI\get('relationshipsTable'),
196  \Elgg\Database\RiverTable::class => DI\get('riverTable'),
197  \Elgg\Database\Seeder::class => DI\get('seeder'),
198  \Elgg\Database\UsersApiSessionsTable::class => DI\get('usersApiSessionsTable'),
199  \Elgg\Database\UsersRememberMeCookiesTable::class => DI\get('users_remember_me_cookies_table'),
200  \Elgg\EntityPreloader::class => DI\get('entityPreloader'),
201  \Elgg\EmailService::class => DI\get('emails'),
202  \Elgg\Email\DelayedEmailService::class => DI\get('delayedEmailService'),
203  \Elgg\EntityIconService::class => DI\get('iconService'),
204  \Elgg\EventsService::class => DI\get('events'),
205  \Elgg\Filesystem\Filestore\DiskFilestore::class => DI\get('filestore'),
206  \Elgg\Filesystem\Filestore\TempDiskFilestore::class => DI\get('temp_filestore'),
207  \Elgg\Filesystem\MimeTypeService::class => DI\get('mimetype'),
208  \Elgg\FormsService::class => DI\get('forms'),
209  \Elgg\Forms\FieldsService::class => DI\get('fields'),
210  \Elgg\Forms\StickyForms::class => DI\get('stickyForms'),
211  \Elgg\Gatekeeper::class => DI\get('gatekeeper'),
212  \Elgg\Groups\Tools::class => DI\get('group_tools'),
213  \Elgg\HandlersService::class => DI\get('handlers'),
214  \Elgg\Http\Request::class => DI\get('request'),
215  \Elgg\Http\ResponseFactory::class => DI\get('responseFactory'),
216  \Elgg\Http\Urls::class => DI\get('urls'),
217  \Elgg\I18n\LocaleService::class => DI\get('locale'),
218  \Elgg\I18n\Translator::class => DI\get('translator'),
219  \Elgg\ImageService::class => DI\get('imageService'),
220  \Elgg\Javascript\ESMService::class => DI\get('esm'),
221  \Elgg\Invoker::class => DI\get('invoker'),
222  \Elgg\Logger::class => DI\get('logger'),
223  \Elgg\Menu\Service::class => DI\get('menus'),
224  \Elgg\Notifications\NotificationsService::class => DI\get('notifications'),
225  \Elgg\Notifications\NotificationsQueue::class => DI\get('notificationsQueue'),
226  \Elgg\Notifications\SubscriptionsService::class => DI\get('subscriptions'),
227  \Elgg\Page\PageOwnerService::class => DI\get('pageOwner'),
228  \Elgg\PasswordService::class => DI\get('passwords'),
229  \Elgg\PersistentLoginService::class => DI\get('persistentLogin'),
230  \Elgg\RedirectService::class => DI\get('redirects'),
231  \Elgg\Router::class => DI\get('router'),
232  \Elgg\Router\RequestContext::class => DI\get('requestContext'),
233  \Elgg\Router\RouteCollection::class => DI\get('routeCollection'),
234  \Elgg\Router\RouteRegistrationService::class => DI\get('routes'),
235  \Elgg\Router\UrlGenerator::class => DI\get('urlGenerator'),
236  \Elgg\Router\UrlMatcher::class => DI\get('urlMatcher'),
237  \Elgg\Search\SearchService::class => DI\get('search'),
238  \Elgg\Security\Crypto::class => DI\get('crypto'),
239  \Elgg\Security\Csrf::class => DI\get('csrf'),
240  \Elgg\Security\HmacFactory::class => DI\get('hmac'),
241  \Elgg\Security\PasswordGeneratorService::class => DI\get('passwordGenerator'),
242  \Elgg\Security\SiteSecret::class => DI\get('siteSecret'),
243  \Elgg\Security\UrlSigner::class => DI\get('urlSigner'),
244  \Elgg\SessionManagerService::class => DI\get('session_manager'),
245  \Elgg\SystemMessagesService::class => DI\get('system_messages'),
246  \Elgg\Timer::class => DI\get('timer'),
247  \Elgg\UpgradeService::class => DI\get('upgrades'),
248  \Elgg\Upgrade\Locator::class => DI\get('upgradeLocator'),
249  \Elgg\UploadService::class => DI\get('uploads'),
250  \Elgg\UserCapabilities::class => DI\get('userCapabilities'),
251  \Elgg\Users\Accounts::class => DI\get('accounts'),
252  \Elgg\ViewsService::class => DI\get('views'),
253  \Elgg\Views\AutoParagraph::class => DI\get('autoParagraph'),
254  \Elgg\Views\HtmlFormatter::class => DI\get('html_formatter'),
255  \Elgg\Views\TableColumn\ColumnFactory::class => DI\get('table_columns'),
256  \Elgg\WidgetsService::class => DI\get('widgets'),
257 ];
elgg
Definition: install.js:27
$context
Definition: add.php:8
$request
Definition: livesearch.php:12
static factory(InputInterface $input=null, OutputInterface $output=null)
Build a new logger.
Definition: Logger.php:78
global $CONFIG