summaryrefslogtreecommitdiffstats
path: root/lib/private/AppFramework
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2017-03-21 10:00:02 +0100
committerRoeland Jago Douma <roeland@famdouma.nl>2017-03-21 10:29:59 +0100
commit48c34522eda4023f27c4eaabdc28f28bc00c9772 (patch)
treefd7f26289b3e176266b9e6104cb3123ee7d1b5d4 /lib/private/AppFramework
parent0fb577613317404fe53da8e882e08e469c36821a (diff)
downloadnextcloud-server-48c34522eda4023f27c4eaabdc28f28bc00c9772.tar.gz
nextcloud-server-48c34522eda4023f27c4eaabdc28f28bc00c9772.zip
Move a lot of stuff over to the ServerContainer
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib/private/AppFramework')
-rw-r--r--lib/private/AppFramework/DependencyInjection/DIContainer.php224
1 files changed, 20 insertions, 204 deletions
diff --git a/lib/private/AppFramework/DependencyInjection/DIContainer.php b/lib/private/AppFramework/DependencyInjection/DIContainer.php
index d196eda946a..bbcfa7be24b 100644
--- a/lib/private/AppFramework/DependencyInjection/DIContainer.php
+++ b/lib/private/AppFramework/DependencyInjection/DIContainer.php
@@ -46,13 +46,15 @@ use OC\AppFramework\Utility\SimpleContainer;
use OC\Core\Middleware\TwoFactorMiddleware;
use OC\RichObjectStrings\Validator;
use OC\ServerContainer;
+use OCP\AppFramework\Http\IOutput;
use OCP\AppFramework\IApi;
use OCP\AppFramework\IAppContainer;
-use OCP\AppFramework\QueryException;
-use OCP\Federation\ICloudIdManager;
+use OCP\Files\Folder;
use OCP\Files\IAppData;
-use OCP\Files\Mount\IMountManager;
+use OCP\IL10N;
+use OCP\IRequest;
use OCP\IServerContainer;
+use OCP\IUserSession;
use OCP\RichObjectStrings\IValidator;
use OCP\Util;
@@ -92,233 +94,47 @@ class DIContainer extends SimpleContainer implements IAppContainer {
/**
* Core services
*/
- $this->registerService('OCP\\AppFramework\\Http\\IOutput', function($c){
+ $this->registerService(IOutput::class, function($c){
return new Output($this->getServer()->getWebRoot());
});
- $this->registerService(\OCP\Authentication\LoginCredentials\IStore::class, function() {
- return $this->getServer()->query(\OCP\Authentication\LoginCredentials\IStore::class);
- });
-
- $this->registerService('OCP\\IAvatarManager', function($c) {
- return $this->getServer()->getAvatarManager();
- });
-
- $this->registerService('OCP\\Activity\\IManager', function($c) {
- return $this->getServer()->getActivityManager();
- });
- $this->registerService(\OCP\Activity\IEventMerger::class, function($c) {
- return $this->getServer()->query(\OCP\Activity\IEventMerger::class);
- });
-
- $this->registerService('OCP\\ICache', function($c) {
- return $this->getServer()->getCache();
- });
-
- $this->registerService('OC\\CapabilitiesManager', function($c) {
- return $this->getServer()->getCapabilitiesManager();
- });
-
- $this->registerService('OCP\Comments\ICommentsManager', function($c) {
- return $this->getServer()->getCommentsManager();
- });
-
- $this->registerService('OCP\\Contacts\\IManager', function($c) {
- return $this->getServer()->getContactsManager();
- });
-
- $this->registerService('OCP\\IDateTimeZone', function($c) {
- return $this->getServer()->getDateTimeZone();
- });
-
- $this->registerService('OCP\\IDateTimeFormatter', function($c) {
- return $this->getServer()->getDateTimeFormatter();
- });
-
- $this->registerService('OCP\\IDBConnection', function($c) {
- return $this->getServer()->getDatabaseConnection();
- });
-
- $this->registerService('OCP\\Diagnostics\\IEventLogger', function($c) {
- return $this->getServer()->getEventLogger();
- });
-
- $this->registerService('OCP\\Diagnostics\\IQueryLogger', function($c) {
- return $this->getServer()->getQueryLogger();
- });
-
- $this->registerService(ICloudIdManager::class, function($c) {
- return $this->getServer()->getCloudIdManager();
- });
-
- $this->registerService('OCP\\Files\\IMimeTypeDetector', function($c) {
- return $this->getServer()->getMimeTypeDetector();
- });
-
- $this->registerService('OCP\\Files\\Config\\IMountProviderCollection', function($c) {
- return $this->getServer()->getMountProviderCollection();
- });
-
- $this->registerService('OCP\\Files\\Config\\IUserMountCache', function($c) {
- return $this->getServer()->getUserMountCache();
- });
-
- $this->registerService('OCP\\Files\\IRootFolder', function($c) {
- return $this->getServer()->getRootFolder();
- });
-
- $this->registerService('OCP\\Files\\Folder', function() {
+ $this->registerService(Folder::class, function() {
return $this->getServer()->getUserFolder();
});
- $this->registerService('OCP\\Http\\Client\\IClientService', function($c) {
- return $this->getServer()->getHTTPClientService();
- });
-
$this->registerService(IAppData::class, function (SimpleContainer $c) {
return $this->getServer()->getAppDataDir($c->query('AppName'));
});
- $this->registerService('OCP\\IGroupManager', function($c) {
- return $this->getServer()->getGroupManager();
- });
-
- $this->registerService('OCP\\Http\\Client\\IClientService', function() {
- return $this->getServer()->getHTTPClientService();
- });
-
- $this->registerService('OCP\\IL10N', function($c) {
+ $this->registerService(IL10N::class, function($c) {
return $this->getServer()->getL10N($c->query('AppName'));
});
- $this->registerService('OCP\\L10N\\IFactory', function($c) {
- return $this->getServer()->getL10NFactory();
- });
-
- $this->registerService('OCP\\ILogger', function($c) {
- return $this->getServer()->getLogger();
- });
-
- $this->registerService('OCP\\BackgroundJob\\IJobList', function($c) {
- return $this->getServer()->getJobList();
- });
-
- $this->registerAlias('OCP\\AppFramework\\Utility\\IControllerMethodReflector', 'OC\AppFramework\Utility\ControllerMethodReflector');
- $this->registerAlias('ControllerMethodReflector', 'OCP\\AppFramework\\Utility\\IControllerMethodReflector');
-
- $this->registerService('OCP\\Files\\IMimeTypeDetector', function($c) {
- return $this->getServer()->getMimeTypeDetector();
- });
-
- $this->registerService('OCP\\Mail\\IMailer', function() {
- return $this->getServer()->getMailer();
- });
-
- $this->registerService('OCP\\INavigationManager', function($c) {
- return $this->getServer()->getNavigationManager();
- });
-
- $this->registerService('OCP\\Notification\IManager', function($c) {
- return $this->getServer()->getNotificationManager();
- });
-
- $this->registerService('OCP\\IPreview', function($c) {
- return $this->getServer()->getPreviewManager();
- });
-
- $this->registerService('OCP\\IRequest', function () {
- return $this->getServer()->getRequest();
- });
- $this->registerAlias('Request', 'OCP\\IRequest');
-
- $this->registerService('OCP\\ITagManager', function($c) {
- return $this->getServer()->getTagManager();
- });
-
- $this->registerAlias('OCP\\AppFramework\\Utility\\ITimeFactory', 'OC\AppFramework\Utility\TimeFactory');
- $this->registerAlias('TimeFactory', 'OCP\\AppFramework\\Utility\\ITimeFactory');
-
-
- $this->registerService('OCP\\Route\\IRouter', function($c) {
- return $this->getServer()->getRouter();
- });
-
- $this->registerService('OCP\\ISearch', function($c) {
- return $this->getServer()->getSearch();
- });
-
- $this->registerService('OCP\\ISearch', function($c) {
- return $this->getServer()->getSearch();
- });
-
- $this->registerService('OCP\\Security\\ICrypto', function($c) {
- return $this->getServer()->getCrypto();
- });
-
- $this->registerService('OCP\\Security\\IHasher', function($c) {
- return $this->getServer()->getHasher();
- });
-
- $this->registerService('OCP\\Security\\ICredentialsManager', function($c) {
- return $this->getServer()->getCredentialsManager();
- });
-
- $this->registerService('OCP\\Security\\ISecureRandom', function($c) {
- return $this->getServer()->getSecureRandom();
- });
-
- $this->registerService('OCP\\Share\\IManager', function($c) {
- return $this->getServer()->getShareManager();
- });
+ $this->registerAlias(\OCP\AppFramework\Utility\IControllerMethodReflector::class, \OC\AppFramework\Utility\ControllerMethodReflector::class);
+ $this->registerAlias('ControllerMethodReflector', \OCP\AppFramework\Utility\IControllerMethodReflector::class);
- $this->registerService('OCP\\SystemTag\\ISystemTagManager', function() {
- return $this->getServer()->getSystemTagManager();
+ $this->registerService(IRequest::class, function() {
+ return $this->getServer()->query(IRequest::class);
});
+ $this->registerAlias('Request', IRequest::class);
- $this->registerService('OCP\\SystemTag\\ISystemTagObjectMapper', function() {
- return $this->getServer()->getSystemTagObjectMapper();
- });
+ $this->registerAlias(\OCP\AppFramework\Utility\ITimeFactory::class, \OC\AppFramework\Utility\TimeFactory::class);
+ $this->registerAlias('TimeFactory', \OCP\AppFramework\Utility\ITimeFactory::class);
- $this->registerService('OCP\\IURLGenerator', function($c) {
- return $this->getServer()->getURLGenerator();
- });
-
- $this->registerService('OCP\\IUserManager', function($c) {
- return $this->getServer()->getUserManager();
- });
-
- $this->registerService('OCP\\IUserSession', function($c) {
- return $this->getServer()->getUserSession();
- });
$this->registerAlias(\OC\User\Session::class, \OCP\IUserSession::class);
- $this->registerService('OCP\\ISession', function($c) {
- return $this->getServer()->getSession();
- });
-
- $this->registerService('OCP\\Security\\IContentSecurityPolicyManager', function($c) {
- return $this->getServer()->getContentSecurityPolicyManager();
- });
-
- $this->registerService('ServerContainer', function ($c) {
+ $this->registerService(IServerContainer::class, function ($c) {
return $this->getServer();
});
- $this->registerAlias('OCP\\IServerContainer', 'ServerContainer');
+ $this->registerAlias('ServerContainer', IServerContainer::class);
- $this->registerService('Symfony\Component\EventDispatcher\EventDispatcherInterface', function ($c) {
- return $this->getServer()->getEventDispatcher();
- });
-
- $this->registerService('OCP\WorkflowEngine\IManager', function ($c) {
+ $this->registerService(\OCP\WorkflowEngine\IManager::class, function ($c) {
return $c->query('OCA\WorkflowEngine\Manager');
});
- $this->registerService('OCP\\AppFramework\\IAppContainer', function ($c) {
+ $this->registerService(\OCP\AppFramework\IAppContainer::class, function ($c) {
return $c;
});
- $this->registerService(IMountManager::class, function () {
- return $this->getServer()->getMountManager();
- });
// commonly used attributes
$this->registerService('UserId', function ($c) {
@@ -417,7 +233,7 @@ class DIContainer extends SimpleContainer implements IAppContainer {
return new CORSMiddleware(
$c['Request'],
$c['ControllerMethodReflector'],
- $c['OCP\IUserSession'],
+ $c->query(IUserSession::class),
$c->getServer()->getBruteForceThrottler()
);
});