5 use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage;
6 use Symfony\Component\HttpFoundation\Session\Session as SymfonySession;
7 use Zend\Mail\Transport\TransportInterface as Mailer;
106 $manager = new \Elgg\AutoloadManager(
$c->classLoader);
107 if (!
$c->config->get(
'AutoloaderManager_skip_storage')) {
108 $manager->setStorage(
$c->fileCache);
109 $manager->loadCache();
115 return new \ElggStaticVariableCache(
'access');
119 return new \Elgg\Database\AccessCollections(
120 $c->config,
$c->db,
$c->entityTable,
$c->accessCache,
$c->hooks,
$c->session,
$c->translator);
124 return new \Elgg\ActionsService(
$c->config,
$c->session,
$c->crypto);
130 return new \Elgg\Ajax\Service(
$c->hooks,
$c->systemMessages,
$c->input,
$c->amdConfig);
134 $obj = new \Elgg\Amd\Config(
$c->hooks);
135 $obj->setBaseUrl(
$c->simpleCache->getRoot());
140 return new \Elgg\Database\Annotations(
$c->db,
$c->session,
$c->events);
146 $boot = new \Elgg\BootService();
147 if (
$c->config->getVolatile(
'enable_profiling')) {
148 $boot->setTimer(
$c->timer);
160 return new \ElggCrypto(
$c->siteSecret);
167 $pool =
new Pool\InMemory();
168 return new \Elgg\Database\Datalist($pool, $db,
$c->logger,
"{$dbprefix}datalists");
173 $c->config->loadSettingsFile();
174 $db_config = new \Elgg\Database\Config(
$c->config->getStorageObject());
177 $db = new \Elgg\Database($db_config);
179 if (
$c->config->getVolatile(
'profiling_sql')) {
180 $db->setTimer(
$c->timer);
187 return new \Elgg\DeprecationService(
$c->logger);
191 return new \Elgg\Cache\EntityCache(
$c->session,
$c->metadataCache);
195 return new \Elgg\EntityPreloader(
$c->entityCache,
$c->entityTable);
199 return new \Elgg\Database\EntityTable(
217 return new \Elgg\Assets\ExternalFiles(
$c->config->getStorageObject());
221 return new \ElggFileCache(
$c->config->getCachePath() .
'system_cache/');
225 return new \Elgg\FormsService(
$c->views,
$c->logger);
233 return new \Elgg\EntityIconService(
$c->config,
$c->hooks,
$c->request,
$c->logger,
$c->entityTable);
239 $imagine = new \Imagine\Gd\Imagine();
240 return new \Elgg\ImageService($imagine,
$c->config);
248 $this->
setClassName(
'mailer',
'Zend\Mail\Transport\Sendmail');
251 return new \Elgg\Menu\Service(
$c->hooks,
$c->config);
255 return new \Elgg\Cache\MetadataCache(
$c->session);
259 if (!
$c->config->getVolatile(
'memcache')) {
263 $servers =
$c->config->getVolatile(
'memcache_servers');
268 if (!\Stash\Driver\Memcache::isAvailable()) {
272 $driver = new \Stash\Driver\Memcache([
275 return new \Stash\Pool($driver);
280 return new \Elgg\Database\MetadataTable(
281 $c->metadataCache,
$c->db,
$c->entityTable,
$c->events,
$c->metastringsTable,
$c->session);
286 $pool =
new Pool\InMemory();
287 return new \Elgg\Database\MetastringsTable($pool,
$c->db);
291 return new \Elgg\Database\Mutex(
300 $queue = new \Elgg\Queue\DatabaseQueue($queue_name,
$c->db);
301 $sub = new \Elgg\Notifications\SubscriptionsService(
$c->db);
302 return new \Elgg\Notifications\NotificationsService($sub, $queue,
$c->hooks,
$c->session,
$c->translator,
$c->entityTable,
$c->logger);
308 $global_cookies_config =
$c->config->getCookieConfig();
309 $cookie_config = $global_cookies_config[
'remember_me'];
310 $cookie_name = $cookie_config[
'name'];
311 $cookie_token =
$c->request->cookies->get($cookie_name,
'');
312 return new \Elgg\PersistentLoginService(
313 $c->db,
$c->session,
$c->crypto, $cookie_config, $cookie_token);
319 $pool =
new Pool\InMemory();
320 $plugins = new \Elgg\Database\Plugins($pool,
$c->pluginSettingsCache);
321 if (
$c->config->getVolatile(
'enable_profiling')) {
322 $plugins->setTimer(
$c->timer);
327 $this->
setClassName(
'pluginSettingsCache', \
Elgg\Cache\PluginSettingsCache::class);
330 return new \Elgg\Database\PrivateSettingsTable(
$c->db,
$c->entityTable,
$c->pluginSettingsCache);
334 return new \Elgg\Application\Database(
$c->db);
338 return new \Elgg\Database\QueryCounter(
$c->db);
343 $is_xhr =
$c->request->isXmlHttpRequest();
344 return new \Elgg\RedirectService(
$c->session, $is_xhr,
$c->config->getSiteUrl(),
$url);
348 return new \Elgg\Database\RelationshipsTable(
$c->db,
$c->entityTable,
$c->metadataTable,
$c->events);
351 $this->
setFactory(
'request', [\
Elgg\Http\Request::class,
'createFromGlobals']);
354 if (PHP_SAPI ===
'cli') {
355 $transport = new \Elgg\Http\OutputBufferTransport();
357 $transport = new \Elgg\Http\HttpProtocolTransport();
359 return new \Elgg\Http\ResponseFactory(
$c->request,
$c->hooks,
$c->ajax, $transport);
364 $router = new \Elgg\Router(
$c->hooks);
365 if (
$c->config->getVolatile(
'enable_profiling')) {
366 $router->setTimer(
$c->timer);
372 return new \Elgg\Database\Seeder(
$c->hooks);
376 return new \Elgg\Application\ServeFileHandler(
$c->crypto,
$c->config);
380 $params =
$c->config->getCookieConfig()[
'session'];
384 'cache_limiter' => session_cache_limiter(),
387 'cookie_path' =>
$params[
'path'],
388 'cookie_domain' =>
$params[
'domain'],
389 'cookie_secure' =>
$params[
'secure'],
390 'cookie_httponly' =>
$params[
'httponly'],
391 'cookie_lifetime' =>
$params[
'lifetime'],
394 $handler = new \Elgg\Http\DatabaseSessionHandler(
$c->db);
396 $session =
new SymfonySession($storage);
403 return new \Elgg\Cache\SimpleCache(
$c->config,
$c->datalist,
$c->views);
407 return new \Elgg\Database\SiteSecret(
$c->datalist);
413 return new \Elgg\Database\SubtypeTable(
$c->db);
417 $cache = new \Elgg\Cache\SystemCache(
$c->fileCache,
$c->config,
$c->datalist);
418 if (
$c->config->getVolatile(
'enable_profiling')) {
419 $cache->setTimer(
$c->timer);
425 return new \Elgg\SystemMessagesService(
$c->session);
428 $this->
setClassName(
'table_columns', \
Elgg\Views\TableColumn\ColumnFactory::class);
435 return new \Elgg\UploadService(
$c->request);
439 return new \Elgg\UpgradeService(
450 return new \Elgg\UserCapabilities(
$c->hooks,
$c->entityTable,
$c->session);
454 return new \Elgg\Database\UsersTable(
464 return new \Elgg\ViewsService(
$c->hooks,
$c->logger);
479 $svcs[
'hooks'] = new \Elgg\PluginHooksService();
481 $svcs[
'logger'] = new \Elgg\Logger($svcs[
'hooks'], $this->config, $this->context);
482 $svcs[
'hooks']->setLogger($svcs[
'logger']);
484 $svcs[
'events'] = new \Elgg\EventsService();
485 $svcs[
'events']->setLogger($svcs[
'logger']);
486 if ($this->config->getVolatile(
'enable_profiling')) {
487 $svcs[
'events']->setTimer($this->timer);
490 foreach ($svcs as
$key => $service) {
493 return $svcs[$service_needed];
Access to configuration values.
setValue($name, $value)
Set a value to be returned without modification.
setClassName($name, $class_name, $shared=true)
Set a factory based on instantiating a class with no arguments.
setFactory($name, $callable, $shared=true)
Set a factory to generate a value when the container is read.
__construct(\Elgg\Config $config)
Constructor.
resolveLoggerDependencies($service_needed)
Returns the first requested service of the logger, events, and hooks.
if(!is_file("$autoload_root/vendor/autoload.php"))