71 $this->
setValue(
'autoloadManager', $autoload_manager);
74 return new \ElggStaticVariableCache(
'access');
78 return new \Elgg\Database\AccessCollections($c->config->get(
'site_guid'));
83 $this->
setClassName(
'adminNotices',
'\Elgg\Database\AdminNotices');
86 $obj = new \Elgg\Amd\Config($c->hooks);
87 $obj->setBaseUrl($c->simpleCache->getRoot() .
"js/");
91 $this->
setClassName(
'annotations',
'\Elgg\Database\Annotations');
97 $this->
setClassName(
'configTable',
'\Elgg\Database\ConfigTable');
107 $pool = new \Elgg\Cache\MemoryPool();
108 return new \Elgg\Database\Datalist($pool, $db, $c->logger,
"{$dbprefix}datalists");
113 $db_config = new \Elgg\Database\Config($CONFIG);
114 return new \Elgg\Database($db_config, $c->logger);
118 return new \Elgg\DeprecationService($c->session, $c->logger);
121 $this->
setClassName(
'entityPreloader',
'\Elgg\EntityPreloader');
123 $this->
setClassName(
'entityTable',
'\Elgg\Database\EntityTable');
131 return new \Elgg\Assets\ExternalFiles($CONFIG);
145 return new \Elgg\Cache\MetadataCache($c->session);
150 return new \Elgg\Database\MetadataTable(
151 $c->metadataCache, $c->db, $c->entityTable, $c->events, $c->metastringsTable, $c->session);
156 $pool = new \Elgg\Cache\MemoryPool();
157 return new \Elgg\Database\MetastringsTable($pool, $c->db);
163 $queue = new \Elgg\Queue\DatabaseQueue($queue_name, $c->db);
164 $sub = new \Elgg\Notifications\SubscriptionsService($c->db);
165 return new \Elgg\Notifications\NotificationsService($sub, $queue, $c->hooks, $c->session);
169 $global_cookies_config =
_elgg_services()->config->get(
'cookies');
170 $cookie_config = $global_cookies_config[
'remember_me'];
171 $cookie_name = $cookie_config[
'name'];
172 $cookie_token = $c->request->cookies->get($cookie_name,
'');
173 return new \Elgg\PersistentLoginService(
174 $c->db, $c->session, $c->crypto, $cookie_config, $cookie_token);
178 if (!function_exists(
'password_hash')) {
179 $root = $c->config->getRootPath();
180 require "{$root}vendor/ircmaxell/password-compat/lib/password.php";
182 return new \Elgg\PasswordService();
186 return new \Elgg\Database\Plugins($c->events,
new \
Elgg\Cache\MemoryPool());
190 return new \Elgg\Database\PrivateSettingsTable($c->db, $c->entityTable);
194 return new \Elgg\Database\QueryCounter($c->db);
197 $this->
setClassName(
'relationshipsTable',
'\Elgg\Database\RelationshipsTable');
199 $this->
setFactory(
'request',
'\Elgg\Http\Request::createFromGlobals');
203 return new \Elgg\Router($c->hooks);
207 $params = $c->config->get(
'cookies')[
'session'];
211 'cache_limiter' => session_cache_limiter(),
214 'cookie_path' =>
$params[
'path'],
215 'cookie_domain' =>
$params[
'domain'],
216 'cookie_secure' =>
$params[
'secure'],
217 'cookie_httponly' =>
$params[
'httponly'],
218 'cookie_lifetime' =>
$params[
'lifetime'],
221 $handler = new \Elgg\Http\DatabaseSessionHandler($c->db);
227 $this->
setClassName(
'simpleCache',
'\Elgg\Cache\SimpleCache');
229 $this->
setClassName(
'siteSecret',
'\Elgg\Database\SiteSecret');
231 $this->
setClassName(
'stickyForms',
'Elgg\Forms\StickyForms');
233 $this->
setClassName(
'subtypeTable',
'\Elgg\Database\SubtypeTable');
235 $this->
setClassName(
'systemCache',
'\Elgg\Cache\SystemCache');
238 return new \Elgg\SystemMessagesService($c->session);
241 $this->
setClassName(
'translator',
'\Elgg\I18n\Translator');
243 $this->
setClassName(
'usersTable',
'\Elgg\Database\UsersTable');
246 return new \Elgg\ViewsService($c->hooks, $c->logger);
261 $svcs[
'hooks'] = new \Elgg\PluginHooksService();
262 $svcs[
'logger'] = new \Elgg\Logger($svcs[
'hooks']);
263 $svcs[
'hooks']->setLogger($svcs[
'logger']);
264 $svcs[
'events'] = new \Elgg\EventsService();
265 $svcs[
'events']->setLogger($svcs[
'logger']);
267 foreach ($svcs as
$key => $service) {
270 return $svcs[$service_needed];
__construct(\Elgg\AutoloadManager $autoload_manager)
Constructor.
resolveLoggerDependencies($service_needed)
Returns the first requested service of the logger, events, and hooks.
setClassName($name, $class_name, $shared=true)
Set a factory based on instantiating a class with no arguments.
setValue($name, $value)
Set a value to be returned without modification.
elgg require
Throw an error if the required package isn't present.
elgg global
Pointer to the global context.
setFactory($name, $callable, $shared=true)
Set a factory to generate a value when the container is read.