70 $this->
setValue(
'autoloadManager', $autoload_manager);
73 return new \ElggStaticVariableCache(
'access');
77 return new \Elgg\Database\AccessCollections($c->config->get(
'site_guid'));
82 $this->
setClassName(
'adminNotices',
'\Elgg\Database\AdminNotices');
85 $obj = new \Elgg\Amd\Config($c->hooks);
86 $obj->setBaseUrl($c->simpleCache->getRoot() .
"js/");
90 $this->
setClassName(
'annotations',
'\Elgg\Database\Annotations');
96 $this->
setClassName(
'configTable',
'\Elgg\Database\ConfigTable');
106 $pool = new \Elgg\Cache\MemoryPool();
107 return new \Elgg\Database\Datalist($pool, $db, $c->logger,
"{$dbprefix}datalists");
112 $db_config = new \Elgg\Database\Config($CONFIG);
113 return new \Elgg\Database($db_config, $c->logger);
117 return new \Elgg\DeprecationService($c->session, $c->logger);
120 $this->
setClassName(
'entityPreloader',
'\Elgg\EntityPreloader');
122 $this->
setClassName(
'entityTable',
'\Elgg\Database\EntityTable');
130 return new \Elgg\Assets\ExternalFiles($CONFIG);
144 return new \Elgg\Cache\MetadataCache($c->session);
149 return new \Elgg\Database\MetadataTable(
150 $c->metadataCache, $c->db, $c->entityTable, $c->events, $c->metastringsTable, $c->session);
155 $pool = new \Elgg\Cache\MemoryPool();
156 return new \Elgg\Database\MetastringsTable($pool, $c->db);
162 $queue = new \Elgg\Queue\DatabaseQueue($queue_name, $c->db);
163 $sub = new \Elgg\Notifications\SubscriptionsService($c->db);
164 return new \Elgg\Notifications\NotificationsService($sub, $queue, $c->hooks, $c->session);
168 $global_cookies_config =
_elgg_services()->config->get(
'cookies');
169 $cookie_config = $global_cookies_config[
'remember_me'];
170 $cookie_name = $cookie_config[
'name'];
171 $cookie_token = $c->request->cookies->get($cookie_name,
'');
172 return new \Elgg\PersistentLoginService(
173 $c->db, $c->session, $c->crypto, $cookie_config, $cookie_token);
177 if (!function_exists(
'password_hash')) {
178 $root = $c->config->getRootPath();
179 require "{$root}vendor/ircmaxell/password-compat/lib/password.php";
181 return new \Elgg\PasswordService();
185 return new \Elgg\Database\Plugins($c->events,
new \
Elgg\Cache\MemoryPool());
189 return new \Elgg\Database\QueryCounter($c->db);
192 $this->
setClassName(
'relationshipsTable',
'\Elgg\Database\RelationshipsTable');
194 $this->
setFactory(
'request',
'\Elgg\Http\Request::createFromGlobals');
198 return new \Elgg\Router($c->hooks);
202 $params = $c->config->get(
'cookies')[
'session'];
206 'cache_limiter' => session_cache_limiter(),
209 'cookie_path' =>
$params[
'path'],
210 'cookie_domain' =>
$params[
'domain'],
211 'cookie_secure' =>
$params[
'secure'],
212 'cookie_httponly' =>
$params[
'httponly'],
213 'cookie_lifetime' =>
$params[
'lifetime'],
216 $handler = new \Elgg\Http\DatabaseSessionHandler($c->db);
222 $this->
setClassName(
'simpleCache',
'\Elgg\Cache\SimpleCache');
224 $this->
setClassName(
'siteSecret',
'\Elgg\Database\SiteSecret');
226 $this->
setClassName(
'stickyForms',
'Elgg\Forms\StickyForms');
228 $this->
setClassName(
'subtypeTable',
'\Elgg\Database\SubtypeTable');
230 $this->
setClassName(
'systemCache',
'\Elgg\Cache\SystemCache');
233 return new \Elgg\SystemMessagesService($c->session);
236 $this->
setClassName(
'translator',
'\Elgg\I18n\Translator');
238 $this->
setClassName(
'usersTable',
'\Elgg\Database\UsersTable');
241 return new \Elgg\ViewsService($c->hooks, $c->logger);
256 $svcs[
'hooks'] = new \Elgg\PluginHooksService();
257 $svcs[
'logger'] = new \Elgg\Logger($svcs[
'hooks']);
258 $svcs[
'hooks']->setLogger($svcs[
'logger']);
259 $svcs[
'events'] = new \Elgg\EventsService();
260 $svcs[
'events']->setLogger($svcs[
'logger']);
262 foreach ($svcs as
$key => $service) {
265 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.