public function testCanAddModuleAsShim() { $amdConfig = new \Elgg\Amd\Config(); $amdConfig->addModule('jquery.form', array('exports' => 'jquery.fn.ajaxform')); $configArray = $amdConfig->getConfig(); $this->assertArrayHasKey('jquery.form', $configArray['shim']); $this->assertEquals(array('exports' => 'jquery.fn.ajaxform'), $configArray['shim']['jquery.form']); }
public function testCanAddModuleAsShim() { $amdConfig = new \Elgg\Amd\Config(); $amdConfig->addModule('jquery.form', array('url' => 'http://foobar.com', 'exports' => 'jquery.fn.ajaxform', 'deps' => array('jquery'))); $configArray = $amdConfig->getConfig(); $this->assertArrayHasKey('jquery.form', $configArray['shim']); $this->assertEquals(array('exports' => 'jquery.fn.ajaxform', 'deps' => array('jquery')), $configArray['shim']['jquery.form']); $this->assertArrayHasKey('jquery.form', $configArray['paths']); $this->assertEquals(array('http://foobar.com'), $configArray['paths']['jquery.form']); $this->assertTrue($amdConfig->hasModule('jquery.form')); $this->assertTrue($amdConfig->hasShim('jquery.form')); $amdConfig->removeModule('jquery.form'); $this->assertFalse($amdConfig->hasModule('jquery.form')); $this->assertFalse($amdConfig->hasShim('jquery.form')); }
public function testGetConfigTriggersTheConfigAmdPluginHook() { $hooks = new \Elgg\PluginHooksService(); $amdConfig = new \Elgg\Amd\Config($hooks); $test_input = ['test' => 'test_' . time()]; $hooks->registerHandler('config', 'amd', function () use($test_input) { return $test_input; }); $config = $amdConfig->getConfig(); $this->assertEquals($test_input, $config); }
/** * Constructor * * @param \Elgg\Config $config Elgg Config service */ public function __construct(\Elgg\Config $config) { $this->setFactory('classLoader', function (ServiceProvider $c) { $loader = new \Elgg\ClassLoader(new \Elgg\ClassMap()); $loader->register(); return $loader; }); $this->setFactory('autoloadManager', function (ServiceProvider $c) { $manager = new \Elgg\AutoloadManager($c->classLoader); if (!$c->config->get('AutoloaderManager_skip_storage')) { $manager->setStorage($c->systemCache->getFileCache()); $manager->loadCache(); } return $manager; }); $this->setFactory('accessCache', function (ServiceProvider $c) { return new \ElggStaticVariableCache('access'); }); $this->setFactory('accessCollections', function (ServiceProvider $c) { return new \Elgg\Database\AccessCollections($c->config->get('site_guid')); }); $this->setClassName('actions', \Elgg\ActionsService::class); $this->setClassName('adminNotices', \Elgg\Database\AdminNotices::class); $this->setFactory('amdConfig', function (ServiceProvider $c) { $obj = new \Elgg\Amd\Config($c->hooks); $obj->setBaseUrl($c->simpleCache->getRoot()); return $obj; }); $this->setClassName('annotations', \Elgg\Database\Annotations::class); $this->setClassName('autoP', \ElggAutoP::class); $this->setValue('config', $config); $this->setClassName('configTable', \Elgg\Database\ConfigTable::class); $this->setClassName('context', \Elgg\Context::class); $this->setClassName('crypto', \ElggCrypto::class); $this->setFactory('datalist', function (ServiceProvider $c) { // TODO(ewinslow): Add back memcached support $db = $c->db; $dbprefix = $db->getTablePrefix(); $pool = new Pool\InMemory(); return new \Elgg\Database\Datalist($pool, $db, $c->logger, "{$dbprefix}datalists"); }); $this->setFactory('db', function (ServiceProvider $c) { $db_config = new \Elgg\Database\Config($c->config->getStorageObject()); // we inject the logger in _elgg_engine_boot() return new \Elgg\Database($db_config); }); $this->setFactory('deprecation', function (ServiceProvider $c) { return new \Elgg\DeprecationService($c->session, $c->logger); }); $this->setClassName('entityPreloader', \Elgg\EntityPreloader::class); $this->setClassName('entityTable', \Elgg\Database\EntityTable::class); $this->setFactory('events', function (ServiceProvider $c) { return $this->resolveLoggerDependencies('events'); }); $this->setFactory('externalFiles', function (ServiceProvider $c) { return new \Elgg\Assets\ExternalFiles($c->config->getStorageObject()); }); $this->setFactory('hooks', function (ServiceProvider $c) { return $this->resolveLoggerDependencies('hooks'); }); $this->setClassName('input', \Elgg\Http\Input::class); $this->setFactory('logger', function (ServiceProvider $c) { return $this->resolveLoggerDependencies('logger'); }); // TODO(evan): Support configurable transports... $this->setClassName('mailer', 'Zend\\Mail\\Transport\\Sendmail'); $this->setFactory('metadataCache', function (ServiceProvider $c) { return new \Elgg\Cache\MetadataCache($c->session); }); $this->setFactory('metadataTable', function (ServiceProvider $c) { // TODO(ewinslow): Use Pool instead of MetadataCache for caching return new \Elgg\Database\MetadataTable($c->metadataCache, $c->db, $c->entityTable, $c->events, $c->metastringsTable, $c->session); }); $this->setFactory('metastringsTable', function (ServiceProvider $c) { // TODO(ewinslow): Use memcache-based Pool if available... $pool = new Pool\InMemory(); return new \Elgg\Database\MetastringsTable($pool, $c->db); }); $this->setFactory('notifications', function (ServiceProvider $c) { // @todo move queue in service provider $queue_name = \Elgg\Notifications\NotificationsService::QUEUE_NAME; $queue = new \Elgg\Queue\DatabaseQueue($queue_name, $c->db); $sub = new \Elgg\Notifications\SubscriptionsService($c->db); return new \Elgg\Notifications\NotificationsService($sub, $queue, $c->hooks, $c->session); }); $this->setFactory('persistentLogin', function (ServiceProvider $c) { $global_cookies_config = $c->config->get('cookies'); $cookie_config = $global_cookies_config['remember_me']; $cookie_name = $cookie_config['name']; $cookie_token = $c->request->cookies->get($cookie_name, ''); return new \Elgg\PersistentLoginService($c->db, $c->session, $c->crypto, $cookie_config, $cookie_token); }); $this->setFactory('passwords', function (ServiceProvider $c) { if (!function_exists('password_hash')) { $root = $c->config->getRootPath(); require "{$root}vendor/ircmaxell/password-compat/lib/password.php"; } return new \Elgg\PasswordService(); }); $this->setFactory('plugins', function (ServiceProvider $c) { return new \Elgg\Database\Plugins(new Pool\InMemory()); }); $this->setFactory('privateSettings', function (ServiceProvider $c) { return new \Elgg\Database\PrivateSettingsTable($c->db, $c->entityTable); }); $this->setFactory('queryCounter', function (ServiceProvider $c) { return new \Elgg\Database\QueryCounter($c->db); }, false); $this->setClassName('relationshipsTable', \Elgg\Database\RelationshipsTable::class); $this->setFactory('request', [\Elgg\Http\Request::class, 'createFromGlobals']); $this->setFactory('router', function (ServiceProvider $c) { // TODO(evan): Init routes from plugins or cache return new \Elgg\Router($c->hooks); }); $this->setFactory('session', function (ServiceProvider $c) { $params = $c->config->get('cookies')['session']; $options = ['cache_limiter' => session_cache_limiter(), 'name' => $params['name'], 'cookie_path' => $params['path'], 'cookie_domain' => $params['domain'], 'cookie_secure' => $params['secure'], 'cookie_httponly' => $params['httponly'], 'cookie_lifetime' => $params['lifetime']]; $handler = new \Elgg\Http\DatabaseSessionHandler($c->db); $storage = new NativeSessionStorage($options, $handler); $session = new SymfonySession($storage); return new \ElggSession($session); }); $this->setFactory('simpleCache', function (ServiceProvider $c) { return new \Elgg\Cache\SimpleCache($c->config, $c->datalist, $c->views); }); $this->setClassName('siteSecret', \Elgg\Database\SiteSecret::class); $this->setClassName('stickyForms', \Elgg\Forms\StickyForms::class); $this->setClassName('subtypeTable', \Elgg\Database\SubtypeTable::class); $this->setClassName('systemCache', \Elgg\Cache\SystemCache::class); $this->setFactory('systemMessages', function (ServiceProvider $c) { return new \Elgg\SystemMessagesService($c->session); }); $this->setClassName('translator', \Elgg\I18n\Translator::class); $this->setClassName('usersTable', \Elgg\Database\UsersTable::class); $this->setFactory('views', function (ServiceProvider $c) { return new \Elgg\ViewsService($c->hooks, $c->logger); }); $this->setClassName('widgets', \Elgg\WidgetsService::class); }
/** * AMD Config factory * * @param \Elgg\Di\ServiceProvider $c Dependency injection container * @return \Elgg\Amd\Config */ protected function getAmdConfig(\Elgg\Di\ServiceProvider $c) { $obj = new \Elgg\Amd\Config(); $obj->setBaseUrl(_elgg_get_simplecache_root() . "js/"); return $obj; }
/** * Constructor * * @param \Elgg\AutoloadManager $autoload_manager Class autoloader */ public function __construct(\Elgg\AutoloadManager $autoload_manager) { $this->setValue('autoloadManager', $autoload_manager); $this->setClassName('access', '\\Elgg\\Access'); $this->setFactory('accessCache', function (ServiceProvider $c) { return new \ElggStaticVariableCache('access'); }); $this->setFactory('accessCollections', function (ServiceProvider $c) { return new \Elgg\Database\AccessCollections($c->config->get('site_guid')); }); $this->setClassName('actions', '\\Elgg\\ActionsService'); $this->setClassName('adminNotices', '\\Elgg\\Database\\AdminNotices'); $this->setFactory('amdConfig', function (ServiceProvider $c) { $obj = new \Elgg\Amd\Config(); $obj->setBaseUrl($c->simpleCache->getRoot() . "js/"); return $obj; }); $this->setClassName('annotations', '\\Elgg\\Database\\Annotations'); $this->setClassName('autoP', '\\ElggAutoP'); $this->setClassName('config', '\\Elgg\\Config'); $this->setClassName('configTable', '\\Elgg\\Database\\ConfigTable'); $this->setClassName('context', '\\Elgg\\Context'); $this->setClassName('crypto', '\\ElggCrypto'); $this->setFactory('datalist', function (ServiceProvider $c) { // TODO(ewinslow): Add back memcached support $db = $c->db; $dbprefix = $db->getTablePrefix(); $pool = new \Elgg\Cache\MemoryPool(); return new \Elgg\Database\Datalist($pool, $db, $c->logger, "{$dbprefix}datalists"); }); $this->setFactory('db', function (ServiceProvider $c) { global $CONFIG; $db_config = new \Elgg\Database\Config($CONFIG); return new \Elgg\Database($db_config, $c->logger); }); $this->setClassName('entityTable', '\\Elgg\\Database\\EntityTable'); $this->setFactory('events', function (ServiceProvider $c) { return $this->resolveLoggerDependencies('events'); }); $this->setFactory('externalFiles', function (ServiceProvider $c) { global $CONFIG; return new \Elgg\Assets\ExternalFiles($CONFIG); }); $this->setFactory('hooks', function (ServiceProvider $c) { return $this->resolveLoggerDependencies('hooks'); }); $this->setClassName('input', 'Elgg\\Http\\Input'); $this->setFactory('logger', function (ServiceProvider $c) { return $this->resolveLoggerDependencies('logger'); }); $this->setClassName('metadataCache', '\\ElggVolatileMetadataCache'); $this->setFactory('metadataTable', function (ServiceProvider $c) { // TODO(ewinslow): Use Elgg\Cache\Pool instead of MetadataCache return new \Elgg\Database\MetadataTable($c->metadataCache, $c->db, $c->entityTable, $c->events, $c->metastringsTable, $c->session); }); $this->setFactory('metastringsTable', function (ServiceProvider $c) { // TODO(ewinslow): Use memcache-based Pool if available... $pool = new \Elgg\Cache\MemoryPool(); return new \Elgg\Database\MetastringsTable($pool, $c->db); }); $this->setFactory('notifications', function (ServiceProvider $c) { // @todo move queue in service provider $queue_name = \Elgg\Notifications\NotificationsService::QUEUE_NAME; $queue = new \Elgg\Queue\DatabaseQueue($queue_name, $c->db); $sub = new \Elgg\Notifications\SubscriptionsService($c->db); return new \Elgg\Notifications\NotificationsService($sub, $queue, $c->hooks, $c->access); }); $this->setFactory('ownerPreloader', function (ServiceProvider $c) { return new \Elgg\EntityPreloader(array('owner_guid')); }); $this->setFactory('persistentLogin', function (ServiceProvider $c) { $global_cookies_config = _elgg_services()->config->get('cookies'); $cookie_config = $global_cookies_config['remember_me']; $cookie_name = $cookie_config['name']; $cookie_token = $c->request->cookies->get($cookie_name, ''); return new \Elgg\PersistentLoginService($c->db, $c->session, $c->crypto, $cookie_config, $cookie_token); }); $this->setFactory('passwords', function (ServiceProvider $c) { if (!function_exists('password_hash')) { $root = $c->config->getRootPath(); require "{$root}vendor/ircmaxell/password-compat/lib/password.php"; } return new \Elgg\PasswordService(); }); $this->setClassName('plugins', '\\Elgg\\Database\\Plugins'); $this->setFactory('queryCounter', function (ServiceProvider $c) { return new \Elgg\Database\QueryCounter($c->db); }, false); $this->setClassName('relationshipsTable', '\\Elgg\\Database\\RelationshipsTable'); $this->setFactory('request', '\\Elgg\\Http\\Request::createFromGlobals'); $this->setFactory('router', function (ServiceProvider $c) { // TODO(evan): Init routes from plugins or cache return new \Elgg\Router($c->hooks); }); $this->setFactory('session', function (ServiceProvider $c) { // account for difference of session_get_cookie_params() and ini key names $params = $c->config->get('cookies')['session']; foreach ($params as $key => $value) { if (in_array($key, array('path', 'domain', 'secure', 'httponly'))) { $params["cookie_{$key}"] = $value; unset($params[$key]); } } $handler = new \Elgg\Http\DatabaseSessionHandler($c->db); $storage = new \Elgg\Http\NativeSessionStorage($params, $handler); return new \ElggSession($storage); }); $this->setClassName('simpleCache', '\\Elgg\\Cache\\SimpleCache'); $this->setClassName('siteSecret', '\\Elgg\\Database\\SiteSecret'); $this->setClassName('stickyForms', 'Elgg\\Forms\\StickyForms'); $this->setClassName('subtypeTable', '\\Elgg\\Database\\SubtypeTable'); $this->setClassName('systemCache', '\\Elgg\\Cache\\SystemCache'); $this->setClassName('translator', '\\Elgg\\I18n\\Translator'); $this->setClassName('usersTable', '\\Elgg\\Database\\UsersTable'); $this->setFactory('views', function (ServiceProvider $c) { return new \Elgg\ViewsService($c->hooks, $c->logger); }); $this->setClassName('widgets', '\\Elgg\\WidgetsService'); }
/** * Constructor * * @param \Elgg\Config $config Elgg Config service */ public function __construct(\Elgg\Config $config) { $this->setFactory('classLoader', function (ServiceProvider $c) { $loader = new \Elgg\ClassLoader(new \Elgg\ClassMap()); $loader->register(); return $loader; }); $this->setFactory('autoloadManager', function (ServiceProvider $c) { $manager = new \Elgg\AutoloadManager($c->classLoader); if (!$c->config->get('AutoloaderManager_skip_storage')) { $manager->setStorage($c->fileCache); $manager->loadCache(); } return $manager; }); $this->setFactory('accessCache', function (ServiceProvider $c) { return new \ElggStaticVariableCache('access'); }); $this->setFactory('accessCollections', function (ServiceProvider $c) { return new \Elgg\Database\AccessCollections($c->config, $c->db, $c->entityTable, $c->accessCache, $c->hooks, $c->session, $c->translator); }); $this->setFactory('actions', function (ServiceProvider $c) { return new \Elgg\ActionsService($c->config, $c->session, $c->crypto); }); $this->setClassName('adminNotices', \Elgg\Database\AdminNotices::class); $this->setFactory('ajax', function (ServiceProvider $c) { return new \Elgg\Ajax\Service($c->hooks, $c->systemMessages, $c->input, $c->amdConfig); }); $this->setFactory('amdConfig', function (ServiceProvider $c) { $obj = new \Elgg\Amd\Config($c->hooks); $obj->setBaseUrl($c->simpleCache->getRoot()); return $obj; }); $this->setFactory('annotations', function (ServiceProvider $c) { return new \Elgg\Database\Annotations($c->db, $c->session, $c->events); }); $this->setClassName('autoP', \ElggAutoP::class); $this->setFactory('boot', function (ServiceProvider $c) { $boot = new \Elgg\BootService(); if ($c->config->getVolatile('enable_profiling')) { $boot->setTimer($c->timer); } return $boot; }); $this->setFactory('batchUpgrader', function (ServiceProvider $c) { return new \Elgg\BatchUpgrader($c->config); }); $this->setValue('config', $config); $this->setFactory('configTable', function (ServiceProvider $c) { return new \Elgg\Database\ConfigTable($c->db, $c->boot, $c->logger); }); $this->setClassName('context', \Elgg\Context::class); $this->setFactory('crypto', function (ServiceProvider $c) { return new \ElggCrypto($c->siteSecret); }); $this->setFactory('db', function (ServiceProvider $c) { // gonna need dbprefix from settings $c->config->loadSettingsFile(); $db_config = new \Elgg\Database\Config($c->config->getStorageObject()); // we inject the logger in _elgg_engine_boot() $db = new \Elgg\Database($db_config); if ($c->config->getVolatile('profiling_sql')) { $db->setTimer($c->timer); } return $db; }); $this->setFactory('deprecation', function (ServiceProvider $c) { return new \Elgg\DeprecationService($c->logger); }); $this->setFactory('entityCache', function (ServiceProvider $c) { return new \Elgg\Cache\EntityCache($c->session, $c->metadataCache); }); $this->setFactory('entityPreloader', function (ServiceProvider $c) { return new \Elgg\EntityPreloader($c->entityCache, $c->entityTable); }); $this->setFactory('entityTable', function (ServiceProvider $c) { return new \Elgg\Database\EntityTable($c->config, $c->db, $c->entityCache, $c->metadataCache, $c->subtypeTable, $c->events, $c->session, $c->translator, $c->logger); }); $this->setFactory('events', function (ServiceProvider $c) { return $this->resolveLoggerDependencies('events'); }); $this->setFactory('externalFiles', function (ServiceProvider $c) { return new \Elgg\Assets\ExternalFiles($c->config->getStorageObject()); }); $this->setFactory('fileCache', function (ServiceProvider $c) { return new \ElggFileCache($c->config->getCachePath() . 'system_cache/'); }); $this->setFactory('filestore', function (ServiceProvider $c) { return new \ElggDiskFilestore($c->config->getDataPath()); }); $this->setFactory('forms', function (ServiceProvider $c) { return new \Elgg\FormsService($c->views, $c->logger); }); $this->setFactory('hooks', function (ServiceProvider $c) { return $this->resolveLoggerDependencies('hooks'); }); $this->setFactory('iconService', function (ServiceProvider $c) { return new \Elgg\EntityIconService($c->config, $c->hooks, $c->request, $c->logger, $c->entityTable); }); $this->setClassName('input', \Elgg\Http\Input::class); $this->setFactory('imageService', function (ServiceProvider $c) { $imagine = new \Imagine\Gd\Imagine(); return new \Elgg\ImageService($imagine, $c->config); }); $this->setFactory('logger', function (ServiceProvider $c) { return $this->resolveLoggerDependencies('logger'); }); // TODO(evan): Support configurable transports... $this->setClassName('mailer', 'Zend\\Mail\\Transport\\Sendmail'); $this->setFactory('menus', function (ServiceProvider $c) { return new \Elgg\Menu\Service($c->hooks, $c->config); }); $this->setFactory('metadataCache', function (ServiceProvider $c) { return new \Elgg\Cache\MetadataCache($c->session); }); $this->setFactory('memcacheStashPool', function (ServiceProvider $c) { if (!$c->config->getVolatile('memcache')) { return null; } $servers = $c->config->getVolatile('memcache_servers'); if (!$servers) { return null; } $driver = new \Stash\Driver\Memcache(['servers' => $servers]); return new \Stash\Pool($driver); }); $this->setFactory('metadataTable', function (ServiceProvider $c) { // TODO(ewinslow): Use Pool instead of MetadataCache for caching return new \Elgg\Database\MetadataTable($c->metadataCache, $c->db, $c->entityTable, $c->events, $c->session); }); $this->setFactory('mutex', function (ServiceProvider $c) { return new \Elgg\Database\Mutex($c->db, $c->logger); }); $this->setFactory('notifications', function (ServiceProvider $c) { // @todo move queue in service provider $queue_name = \Elgg\Notifications\NotificationsService::QUEUE_NAME; $queue = new \Elgg\Queue\DatabaseQueue($queue_name, $c->db); $sub = new \Elgg\Notifications\SubscriptionsService($c->db); return new \Elgg\Notifications\NotificationsService($sub, $queue, $c->hooks, $c->session, $c->translator, $c->entityTable, $c->logger); }); $this->setClassName('nullCache', \Elgg\Cache\NullCache::class); $this->setFactory('persistentLogin', function (ServiceProvider $c) { $global_cookies_config = $c->config->getCookieConfig(); $cookie_config = $global_cookies_config['remember_me']; $cookie_name = $cookie_config['name']; $cookie_token = $c->request->cookies->get($cookie_name, ''); return new \Elgg\PersistentLoginService($c->db, $c->session, $c->crypto, $cookie_config, $cookie_token); }); $this->setClassName('passwords', \Elgg\PasswordService::class); $this->setFactory('plugins', function (ServiceProvider $c) { $pool = new Pool\InMemory(); $plugins = new \Elgg\Database\Plugins($pool, $c->pluginSettingsCache); if ($c->config->getVolatile('enable_profiling')) { $plugins->setTimer($c->timer); } return $plugins; }); $this->setClassName('pluginSettingsCache', \Elgg\Cache\PluginSettingsCache::class); $this->setFactory('privateSettings', function (ServiceProvider $c) { return new \Elgg\Database\PrivateSettingsTable($c->db, $c->entityTable, $c->pluginSettingsCache); }); $this->setFactory('publicDb', function (ServiceProvider $c) { return new \Elgg\Application\Database($c->db); }); $this->setFactory('queryCounter', function (ServiceProvider $c) { return new \Elgg\Database\QueryCounter($c->db); }, false); $this->setFactory('relationshipsTable', function (ServiceProvider $c) { return new \Elgg\Database\RelationshipsTable($c->db, $c->entityTable, $c->metadataTable, $c->events); }); $this->setFactory('request', [\Elgg\Http\Request::class, 'createFromGlobals']); $this->setFactory('responseFactory', function (ServiceProvider $c) { if (PHP_SAPI === 'cli') { $transport = new \Elgg\Http\OutputBufferTransport(); } else { $transport = new \Elgg\Http\HttpProtocolTransport(); } return new \Elgg\Http\ResponseFactory($c->request, $c->hooks, $c->ajax, $transport); }); $this->setFactory('router', function (ServiceProvider $c) { // TODO(evan): Init routes from plugins or cache $router = new \Elgg\Router($c->hooks); if ($c->config->getVolatile('enable_profiling')) { $router->setTimer($c->timer); } return $router; }); $this->setFactory('serveFileHandler', function (ServiceProvider $c) { return new \Elgg\Application\ServeFileHandler($c->crypto, $c->config); }); $this->setFactory('session', function (ServiceProvider $c) { $params = $c->config->getCookieConfig()['session']; $options = ['cache_limiter' => session_cache_limiter(), 'name' => $params['name'], 'cookie_path' => $params['path'], 'cookie_domain' => $params['domain'], 'cookie_secure' => $params['secure'], 'cookie_httponly' => $params['httponly'], 'cookie_lifetime' => $params['lifetime']]; $handler = new \Elgg\Http\DatabaseSessionHandler($c->db); $storage = new NativeSessionStorage($options, $handler); $session = new SymfonySession($storage); return new \ElggSession($session); }); $this->setClassName('urlSigner', \Elgg\Security\UrlSigner::class); $this->setFactory('simpleCache', function (ServiceProvider $c) { return new \Elgg\Cache\SimpleCache($c->config, $c->views); }); $this->setFactory('siteSecret', function (ServiceProvider $c) { return new \Elgg\Database\SiteSecret($c->configTable); }); $this->setClassName('stickyForms', \Elgg\Forms\StickyForms::class); $this->setFactory('subtypeTable', function (ServiceProvider $c) { return new \Elgg\Database\SubtypeTable($c->db); }); $this->setFactory('systemCache', function (ServiceProvider $c) { $cache = new \Elgg\Cache\SystemCache($c->fileCache, $c->config); if ($c->config->getVolatile('enable_profiling')) { $cache->setTimer($c->timer); } return $cache; }); $this->setFactory('systemMessages', function (ServiceProvider $c) { return new \Elgg\SystemMessagesService($c->session); }); $this->setClassName('table_columns', \Elgg\Views\TableColumn\ColumnFactory::class); $this->setClassName('timer', \Elgg\Timer::class); $this->setClassName('translator', \Elgg\I18n\Translator::class); $this->setFactory('uploads', function (ServiceProvider $c) { return new \Elgg\UploadService($c->request); }); $this->setFactory('upgrades', function (ServiceProvider $c) { return new \Elgg\UpgradeService($c->translator, $c->events, $c->hooks, $c->config, $c->logger, $c->mutex); }); $this->setFactory('userCapabilities', function (ServiceProvider $c) { return new \Elgg\UserCapabilities($c->hooks, $c->entityTable, $c->session); }); $this->setFactory('usersTable', function (ServiceProvider $c) { return new \Elgg\Database\UsersTable($c->config, $c->db, $c->entityTable, $c->entityCache, $c->events); }); $this->setFactory('upgradeLocator', function (ServiceProvider $c) { return new \Elgg\Upgrade\Locator($c->plugins, $c->logger, $c->privateSettings); }); $this->setFactory('views', function (ServiceProvider $c) { return new \Elgg\ViewsService($c->hooks, $c->logger); }); $this->setClassName('widgets', \Elgg\WidgetsService::class); }