diff options
author | Joas Schilling <coding@schilljs.com> | 2020-03-18 10:43:54 +0100 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2020-03-18 18:59:49 +0100 |
commit | dc7913efcdefbf1791a5a3f2815b818b9a21c0ee (patch) | |
tree | eeae6f1d66b860d99de08a25fcfc5c9d8faef733 /lib/private/Server.php | |
parent | 570f3c77989120d92efbbd7a8bc5ad39288d7222 (diff) | |
download | nextcloud-server-dc7913efcdefbf1791a5a3f2815b818b9a21c0ee.tar.gz nextcloud-server-dc7913efcdefbf1791a5a3f2815b818b9a21c0ee.zip |
Fix recursive calls in logging via server methods
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private/Server.php')
-rw-r--r-- | lib/private/Server.php | 347 |
1 files changed, 194 insertions, 153 deletions
diff --git a/lib/private/Server.php b/lib/private/Server.php index d57d2138913..3300920edb7 100644 --- a/lib/private/Server.php +++ b/lib/private/Server.php @@ -114,6 +114,7 @@ use OC\Security\Bruteforce\Throttler; use OC\Security\CertificateManager; use OC\Security\CredentialsManager; use OC\Security\Crypto; +use OC\Security\CSP\ContentSecurityPolicyManager; use OC\Security\CSP\ContentSecurityPolicyNonceManager; use OC\Security\CSRF\CsrfTokenGenerator; use OC\Security\CSRF\CsrfTokenManager; @@ -136,15 +137,25 @@ use OCP\Accounts\IAccountManager; use OCP\App\IAppManager; use OCP\AppFramework\QueryException; use OCP\Authentication\LoginCredentials\IStore; +use OCP\BackgroundJob\IJobList; use OCP\Collaboration\AutoComplete\IManager; +use OCP\Comments\ICommentsManager; use OCP\Contacts\ContactsMenu\IActionFactory; use OCP\Contacts\ContactsMenu\IContactsStore; use OCP\Dashboard\IDashboardManager; use OCP\Defaults; +use OCP\Diagnostics\IEventLogger; +use OCP\Diagnostics\IQueryLogger; use OCP\EventDispatcher\IEventDispatcher; use OCP\Federation\ICloudFederationFactory; use OCP\Federation\ICloudFederationProviderManager; use OCP\Federation\ICloudIdManager; +use OCP\Files\Config\IMountProviderCollection; +use OCP\Files\Config\IUserMountCache; +use OCP\Files\IMimeTypeDetector; +use OCP\Files\IMimeTypeLoader; +use OCP\Files\IRootFolder; +use OCP\Files\Mount\IMountManager; use OCP\Files\NotFoundException; use OCP\Files\Storage\IStorageFactory; use OCP\FullTextSearch\IFullTextSearchManager; @@ -158,22 +169,46 @@ use OCP\Group\Events\GroupDeletedEvent; use OCP\Group\Events\UserAddedEvent; use OCP\Group\Events\UserRemovedEvent; use OCP\Group\ISubAdmin; +use OCP\Http\Client\IClientService; +use OCP\IAppConfig; +use OCP\IAvatarManager; +use OCP\ICache; use OCP\ICacheFactory; use OCP\IContainer; +use OCP\IDateTimeFormatter; +use OCP\IDateTimeZone; use OCP\IDBConnection; +use OCP\IGroupManager; use OCP\IInitialStateService; use OCP\IL10N; use OCP\ILogger; +use OCP\INavigationManager; +use OCP\IPreview; +use OCP\IRequest; +use OCP\ISearch; use OCP\IServerContainer; +use OCP\ITagManager; use OCP\ITempManager; +use OCP\IURLGenerator; use OCP\IUser; +use OCP\IUserManager; +use OCP\IUserSession; +use OCP\L10N\IFactory; use OCP\Lock\ILockingProvider; use OCP\Log\ILogFactory; +use OCP\Mail\IMailer; use OCP\Remote\Api\IApiFactory; use OCP\Remote\IInstanceFactory; use OCP\RichObjectStrings\IValidator; +use OCP\Route\IRouter; use OCP\Security\IContentSecurityPolicyManager; +use OCP\Security\ICredentialsManager; +use OCP\Security\ICrypto; +use OCP\Security\IHasher; +use OCP\Security\ISecureRandom; use OCP\Share\IShareHelper; +use OCP\SystemTag\ISystemTagManager; +use OCP\SystemTag\ISystemTagObjectMapper; use OCP\User\Events\BeforePasswordUpdatedEvent; use OCP\User\Events\BeforeUserCreatedEvent; use OCP\User\Events\BeforeUserDeletedEvent; @@ -189,6 +224,10 @@ use OCP\User\Events\UserLoggedInWithCookieEvent; use OCP\User\Events\UserLoggedOutEvent; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\GenericEvent; +use OCA\Files_External\Service\UserStoragesService; +use OCA\Files_External\Service\UserGlobalStoragesService; +use OCA\Files_External\Service\GlobalStoragesService; +use OCA\Files_External\Service\BackendService; /** * Class Server @@ -233,7 +272,7 @@ class Server extends ServerContainer implements IServerContainer { $this->registerAlias(IActionFactory::class, ActionFactory::class); - $this->registerService(\OCP\IPreview::class, function (Server $c) { + $this->registerService(IPreview::class, function (Server $c) { return new PreviewManager( $c->getConfig(), $c->getRootFolder(), @@ -243,7 +282,7 @@ class Server extends ServerContainer implements IServerContainer { $c->getSession()->get('user_id') ); }); - $this->registerDeprecatedAlias('PreviewManager', \OCP\IPreview::class); + $this->registerDeprecatedAlias('PreviewManager', IPreview::class); $this->registerService(\OC\Preview\Watcher::class, function (Server $c) { return new \OC\Preview\Watcher( @@ -310,12 +349,12 @@ class Server extends ServerContainer implements IServerContainer { $factoryClass = $config->getSystemValue('systemtags.managerFactory', SystemTagManagerFactory::class); return new $factoryClass($this); }); - $this->registerService(\OCP\SystemTag\ISystemTagManager::class, function (Server $c) { + $this->registerService(ISystemTagManager::class, function (Server $c) { return $c->query('SystemTagManagerFactory')->getManager(); }); - $this->registerDeprecatedAlias('SystemTagManager', \OCP\SystemTag\ISystemTagManager::class); + $this->registerDeprecatedAlias('SystemTagManager', ISystemTagManager::class); - $this->registerService(\OCP\SystemTag\ISystemTagObjectMapper::class, function (Server $c) { + $this->registerService(ISystemTagObjectMapper::class, function (Server $c) { return $c->query('SystemTagManagerFactory')->getObjectMapper(); }); $this->registerService('RootFolder', function (Server $c) { @@ -337,14 +376,14 @@ class Server extends ServerContainer implements IServerContainer { return $root; }); - $this->registerDeprecatedAlias('SystemTagObjectMapper', \OCP\SystemTag\ISystemTagObjectMapper::class); + $this->registerDeprecatedAlias('SystemTagObjectMapper', ISystemTagObjectMapper::class); - $this->registerService(\OCP\Files\IRootFolder::class, function (Server $c) { + $this->registerService(IRootFolder::class, function (Server $c) { return new LazyRoot(function () use ($c) { return $c->query('RootFolder'); }); }); - $this->registerDeprecatedAlias('LazyRootFolder', \OCP\Files\IRootFolder::class); + $this->registerDeprecatedAlias('LazyRootFolder', IRootFolder::class); $this->registerDeprecatedAlias('UserManager', \OC\User\Manager::class); $this->registerAlias(\OCP\IUserManager::class, \OC\User\Manager::class); @@ -554,8 +593,8 @@ class Server extends ServerContainer implements IServerContainer { $this->registerAlias(\OCP\Authentication\TwoFactorAuth\IRegistry::class, \OC\Authentication\TwoFactorAuth\Registry::class); - $this->registerAlias(\OCP\INavigationManager::class, \OC\NavigationManager::class); - $this->registerDeprecatedAlias('NavigationManager', \OCP\INavigationManager::class); + $this->registerAlias(INavigationManager::class, \OC\NavigationManager::class); + $this->registerDeprecatedAlias('NavigationManager', INavigationManager::class); $this->registerService(\OC\AllConfig::class, function (Server $c) { return new \OC\AllConfig( @@ -574,9 +613,9 @@ class Server extends ServerContainer implements IServerContainer { return new \OC\AppConfig($c->getDatabaseConnection()); }); $this->registerDeprecatedAlias('AppConfig', \OC\AppConfig::class); - $this->registerAlias(\OCP\IAppConfig::class, \OC\AppConfig::class); + $this->registerAlias(IAppConfig::class, \OC\AppConfig::class); - $this->registerService(\OCP\L10N\IFactory::class, function (Server $c) { + $this->registerService(IFactory::class, function (Server $c) { return new \OC\L10N\Factory( $c->getConfig(), $c->getRequest(), @@ -584,9 +623,9 @@ class Server extends ServerContainer implements IServerContainer { \OC::$SERVERROOT ); }); - $this->registerDeprecatedAlias('L10NFactory', \OCP\L10N\IFactory::class); + $this->registerDeprecatedAlias('L10NFactory', IFactory::class); - $this->registerService(\OCP\IURLGenerator::class, function (Server $c) { + $this->registerService(IURLGenerator::class, function (Server $c) { $config = $c->getConfig(); $cacheFactory = $c->getMemCacheFactory(); $request = $c->getRequest(); @@ -596,15 +635,15 @@ class Server extends ServerContainer implements IServerContainer { $request ); }); - $this->registerDeprecatedAlias('URLGenerator', \OCP\IURLGenerator::class); + $this->registerDeprecatedAlias('URLGenerator', IURLGenerator::class); $this->registerDeprecatedAlias('AppFetcher', AppFetcher::class); $this->registerDeprecatedAlias('CategoryFetcher', CategoryFetcher::class); - $this->registerService(\OCP\ICache::class, function ($c) { + $this->registerService(ICache::class, function ($c) { return new Cache\File(); }); - $this->registerDeprecatedAlias('UserCache', \OCP\ICache::class); + $this->registerDeprecatedAlias('UserCache', ICache::class); $this->registerService(Factory::class, function (Server $c) { @@ -665,7 +704,7 @@ class Server extends ServerContainer implements IServerContainer { $c->getConfig() ); }); - $this->registerAlias(\OCP\IAvatarManager::class, AvatarManager::class); + $this->registerAlias(IAvatarManager::class, AvatarManager::class); $this->registerDeprecatedAlias('AvatarManager', AvatarManager::class); $this->registerAlias(\OCP\Support\CrashReport\IRegistry::class, \OC\Support\CrashReport\Registry::class); @@ -679,14 +718,14 @@ class Server extends ServerContainer implements IServerContainer { return new Log($logger, $this->getSystemConfig(), null, $registry); }); - $this->registerAlias(\OCP\ILogger::class, \OC\Log::class); + $this->registerAlias(ILogger::class, \OC\Log::class); $this->registerDeprecatedAlias('Logger', \OC\Log::class); $this->registerService(ILogFactory::class, function (Server $c) { return new LogFactory($c, $this->getSystemConfig()); }); - $this->registerService(\OCP\BackgroundJob\IJobList::class, function (Server $c) { + $this->registerService(IJobList::class, function (Server $c) { $config = $c->getConfig(); return new \OC\BackgroundJob\JobList( $c->getDatabaseConnection(), @@ -694,9 +733,9 @@ class Server extends ServerContainer implements IServerContainer { new TimeFactory() ); }); - $this->registerDeprecatedAlias('JobList', \OCP\BackgroundJob\IJobList::class); + $this->registerDeprecatedAlias('JobList', IJobList::class); - $this->registerService(\OCP\Route\IRouter::class, function (Server $c) { + $this->registerService(IRouter::class, function (Server $c) { $cacheFactory = $c->getMemCacheFactory(); $logger = $c->getLogger(); if ($cacheFactory->isLocalCacheAvailable()) { @@ -706,12 +745,12 @@ class Server extends ServerContainer implements IServerContainer { } return $router; }); - $this->registerDeprecatedAlias('Router', \OCP\Route\IRouter::class); + $this->registerDeprecatedAlias('Router', IRouter::class); - $this->registerService(\OCP\ISearch::class, function ($c) { + $this->registerService(ISearch::class, function ($c) { return new Search(); }); - $this->registerDeprecatedAlias('Search', \OCP\ISearch::class); + $this->registerDeprecatedAlias('Search', ISearch::class); $this->registerService(\OC\Security\RateLimiting\Backend\IBackend::class, function ($c) { return new \OC\Security\RateLimiting\Backend\MemoryCache( @@ -725,20 +764,20 @@ class Server extends ServerContainer implements IServerContainer { }); $this->registerDeprecatedAlias('SecureRandom', \OCP\Security\ISecureRandom::class); - $this->registerService(\OCP\Security\ICrypto::class, function (Server $c) { + $this->registerService(ICrypto::class, function (Server $c) { return new Crypto($c->getConfig(), $c->getSecureRandom()); }); - $this->registerDeprecatedAlias('Crypto', \OCP\Security\ICrypto::class); + $this->registerDeprecatedAlias('Crypto', ICrypto::class); - $this->registerService(\OCP\Security\IHasher::class, function (Server $c) { + $this->registerService(IHasher::class, function (Server $c) { return new Hasher($c->getConfig()); }); - $this->registerDeprecatedAlias('Hasher', \OCP\Security\IHasher::class); + $this->registerDeprecatedAlias('Hasher', IHasher::class); - $this->registerService(\OCP\Security\ICredentialsManager::class, function (Server $c) { + $this->registerService(ICredentialsManager::class, function (Server $c) { return new CredentialsManager($c->getCrypto(), $c->getDatabaseConnection()); }); - $this->registerDeprecatedAlias('CredentialsManager', \OCP\Security\ICredentialsManager::class); + $this->registerDeprecatedAlias('CredentialsManager', ICredentialsManager::class); $this->registerService(IDBConnection::class, function (Server $c) { $systemConfig = $c->getSystemConfig(); @@ -755,7 +794,7 @@ class Server extends ServerContainer implements IServerContainer { $this->registerDeprecatedAlias('DatabaseConnection', IDBConnection::class); - $this->registerService(\OCP\Http\Client\IClientService::class, function (Server $c) { + $this->registerService(IClientService::class, function (Server $c) { $user = \OC_User::getUser(); $uid = $user ? $user : null; return new ClientService( @@ -769,8 +808,8 @@ class Server extends ServerContainer implements IServerContainer { ) ); }); - $this->registerDeprecatedAlias('HttpClientService', \OCP\Http\Client\IClientService::class); - $this->registerService(\OCP\Diagnostics\IEventLogger::class, function (Server $c) { + $this->registerDeprecatedAlias('HttpClientService', IClientService::class); + $this->registerService(IEventLogger::class, function (Server $c) { $eventLogger = new EventLogger(); if ($c->getSystemConfig()->getValue('debug', false)) { // In debug mode, module is being activated by default @@ -778,9 +817,9 @@ class Server extends ServerContainer implements IServerContainer { } return $eventLogger; }); - $this->registerDeprecatedAlias('EventLogger', \OCP\Diagnostics\IEventLogger::class); + $this->registerDeprecatedAlias('EventLogger', IEventLogger::class); - $this->registerService(\OCP\Diagnostics\IQueryLogger::class, function (Server $c) { + $this->registerService(IQueryLogger::class, function (Server $c) { $queryLogger = new QueryLogger(); if ($c->getSystemConfig()->getValue('debug', false)) { // In debug mode, module is being activated by default @@ -788,7 +827,7 @@ class Server extends ServerContainer implements IServerContainer { } return $queryLogger; }); - $this->registerDeprecatedAlias('QueryLogger', \OCP\Diagnostics\IQueryLogger::class); + $this->registerDeprecatedAlias('QueryLogger', IQueryLogger::class); $this->registerService(TempManager::class, function (Server $c) { return new TempManager( @@ -813,15 +852,15 @@ class Server extends ServerContainer implements IServerContainer { $this->registerDeprecatedAlias('AppManager', AppManager::class); $this->registerAlias(IAppManager::class, AppManager::class); - $this->registerService(\OCP\IDateTimeZone::class, function (Server $c) { + $this->registerService(IDateTimeZone::class, function (Server $c) { return new DateTimeZone( $c->getConfig(), $c->getSession() ); }); - $this->registerDeprecatedAlias('DateTimeZone', \OCP\IDateTimeZone::class); + $this->registerDeprecatedAlias('DateTimeZone', IDateTimeZone::class); - $this->registerService(\OCP\IDateTimeFormatter::class, function (Server $c) { + $this->registerService(IDateTimeFormatter::class, function (Server $c) { $language = $c->getConfig()->getUserValue($c->getSession()->get('user_id'), 'core', 'lang', null); return new DateTimeFormatter( @@ -829,19 +868,19 @@ class Server extends ServerContainer implements IServerContainer { $c->getL10N('lib', $language) ); }); - $this->registerDeprecatedAlias('DateTimeFormatter', \OCP\IDateTimeFormatter::class); + $this->registerDeprecatedAlias('DateTimeFormatter', IDateTimeFormatter::class); - $this->registerService(\OCP\Files\Config\IUserMountCache::class, function (Server $c) { + $this->registerService(IUserMountCache::class, function (Server $c) { $mountCache = new UserMountCache($c->getDatabaseConnection(), $c->getUserManager(), $c->getLogger()); $listener = new UserMountCacheListener($mountCache); $listener->listen($c->getUserManager()); return $mountCache; }); - $this->registerDeprecatedAlias('UserMountCache', \OCP\Files\Config\IUserMountCache::class); + $this->registerDeprecatedAlias('UserMountCache', IUserMountCache::class); - $this->registerService(\OCP\Files\Config\IMountProviderCollection::class, function (Server $c) { + $this->registerService(IMountProviderCollection::class, function (Server $c) { $loader = \OC\Files\Filesystem::getLoader(); - $mountCache = $c->query('UserMountCache'); + $mountCache = $c->query(IUserMountCache::class); $manager = new \OC\Files\Config\MountProviderCollection($loader, $mountCache); // builtin providers @@ -853,7 +892,7 @@ class Server extends ServerContainer implements IServerContainer { return $manager; }); - $this->registerDeprecatedAlias('MountConfigManager', \OCP\Files\Config\IMountProviderCollection::class); + $this->registerDeprecatedAlias('MountConfigManager', IMountProviderCollection::class); $this->registerService('IniWrapper', function ($c) { return new IniGetWrapper(); @@ -943,7 +982,7 @@ class Server extends ServerContainer implements IServerContainer { }); $this->registerDeprecatedAlias('Request', \OCP\IRequest::class); - $this->registerService(\OCP\Mail\IMailer::class, function (Server $c) { + $this->registerService(IMailer::class, function (Server $c) { return new Mailer( $c->getConfig(), $c->getLogger(), @@ -952,7 +991,7 @@ class Server extends ServerContainer implements IServerContainer { $c->getL10N('lib') ); }); - $this->registerDeprecatedAlias('Mailer', \OCP\Mail\IMailer::class); + $this->registerDeprecatedAlias('Mailer', IMailer::class); $this->registerService('LDAPProvider', function (Server $c) { $config = $c->getConfig(); @@ -987,12 +1026,12 @@ class Server extends ServerContainer implements IServerContainer { }); $this->registerDeprecatedAlias('LockingProvider', ILockingProvider::class); - $this->registerService(\OCP\Files\Mount\IMountManager::class, function () { + $this->registerService(IMountManager::class, function () { return new \OC\Files\Mount\Manager(); }); - $this->registerDeprecatedAlias('MountManager', \OCP\Files\Mount\IMountManager::class); + $this->registerDeprecatedAlias('MountManager', IMountManager::class); - $this->registerService(\OCP\Files\IMimeTypeDetector::class, function (Server $c) { + $this->registerService(IMimeTypeDetector::class, function (Server $c) { return new \OC\Files\Type\Detection( $c->getURLGenerator(), $c->getLogger(), @@ -1000,14 +1039,14 @@ class Server extends ServerContainer implements IServerContainer { \OC::$SERVERROOT . '/resources/config/' ); }); - $this->registerDeprecatedAlias('MimeTypeDetector', \OCP\Files\IMimeTypeDetector::class); + $this->registerDeprecatedAlias('MimeTypeDetector', IMimeTypeDetector::class); - $this->registerService(\OCP\Files\IMimeTypeLoader::class, function (Server $c) { + $this->registerService(IMimeTypeLoader::class, function (Server $c) { return new \OC\Files\Type\Loader( $c->getDatabaseConnection() ); }); - $this->registerDeprecatedAlias('MimeTypeLoader', \OCP\Files\IMimeTypeLoader::class); + $this->registerDeprecatedAlias('MimeTypeLoader', IMimeTypeLoader::class); $this->registerService(BundleFetcher::class, function () { return new BundleFetcher($this->getL10N('lib')); }); @@ -1019,8 +1058,8 @@ class Server extends ServerContainer implements IServerContainer { }); $this->registerDeprecatedAlias('NotificationManager', \OCP\Notification\IManager::class); - $this->registerService(\OC\CapabilitiesManager::class, function (Server $c) { - $manager = new \OC\CapabilitiesManager($c->getLogger()); + $this->registerService(CapabilitiesManager::class, function (Server $c) { + $manager = new CapabilitiesManager($c->getLogger()); $manager->registerCapability(function () use ($c) { return new \OC\OCS\CoreCapabilities($c->getConfig()); }); @@ -1029,9 +1068,9 @@ class Server extends ServerContainer implements IServerContainer { }); return $manager; }); - $this->registerDeprecatedAlias('CapabilitiesManager', \OC\CapabilitiesManager::class); + $this->registerDeprecatedAlias('CapabilitiesManager', CapabilitiesManager::class); - $this->registerService(\OCP\Comments\ICommentsManager::class, function (Server $c) { + $this->registerService(ICommentsManager::class, function (Server $c) { $config = $c->getConfig(); $factoryClass = $config->getSystemValue('comments.managerFactory', CommentsManagerFactory::class); /** @var \OCP\Comments\ICommentsManagerFactory $factory */ @@ -1052,7 +1091,7 @@ class Server extends ServerContainer implements IServerContainer { return $manager; }); - $this->registerDeprecatedAlias('CommentsManager', \OCP\Comments\ICommentsManager::class); + $this->registerDeprecatedAlias('CommentsManager', ICommentsManager::class); $this->registerService('ThemingDefaults', function (Server $c) { /* @@ -1145,8 +1184,8 @@ class Server extends ServerContainer implements IServerContainer { $this->registerService(SessionStorage::class, function (Server $c) { return new SessionStorage($c->getSession()); }); - $this->registerAlias(\OCP\Security\IContentSecurityPolicyManager::class, \OC\Security\CSP\ContentSecurityPolicyManager::class); - $this->registerDeprecatedAlias('ContentSecurityPolicyManager', \OC\Security\CSP\ContentSecurityPolicyManager::class); + $this->registerAlias(\OCP\Security\IContentSecurityPolicyManager::class, ContentSecurityPolicyManager::class); + $this->registerDeprecatedAlias('ContentSecurityPolicyManager', ContentSecurityPolicyManager::class); $this->registerService('ContentSecurityPolicyNonceManager', function (Server $c) { return new ContentSecurityPolicyNonceManager( @@ -1318,21 +1357,21 @@ class Server extends ServerContainer implements IServerContainer { * @return \OCP\Calendar\IManager */ public function getCalendarManager() { - return $this->query('CalendarManager'); + return $this->query(\OC\Calendar\Manager::class); } /** * @return \OCP\Calendar\Resource\IManager */ public function getCalendarResourceBackendManager() { - return $this->query('CalendarResourceBackendManager'); + return $this->query(\OC\Calendar\Resource\Manager::class); } /** * @return \OCP\Calendar\Room\IManager */ public function getCalendarRoomBackendManager() { - return $this->query('CalendarRoomBackendManager'); + return $this->query(\OC\Calendar\Room\Manager::class); } private function connectDispatcher() { @@ -1382,14 +1421,14 @@ class Server extends ServerContainer implements IServerContainer { * @return \OCP\Contacts\IManager */ public function getContactsManager() { - return $this->query('ContactsManager'); + return $this->query(\OCP\Contacts\IManager::class); } /** * @return \OC\Encryption\Manager */ public function getEncryptionManager() { - return $this->query('EncryptionManager'); + return $this->query(\OCP\Encryption\IManager::class); } /** @@ -1414,66 +1453,66 @@ class Server extends ServerContainer implements IServerContainer { * @return \OCP\IRequest */ public function getRequest() { - return $this->query('Request'); + return $this->query(IRequest::class); } /** * Returns the preview manager which can create preview images for a given file * - * @return \OCP\IPreview + * @return IPreview */ public function getPreviewManager() { - return $this->query('PreviewManager'); + return $this->query(IPreview::class); } /** * Returns the tag manager which can get and set tags for different object types * * @see \OCP\ITagManager::load() - * @return \OCP\ITagManager + * @return ITagManager */ public function getTagManager() { - return $this->query('TagManager'); + return $this->query(ITagManager::class); } /** * Returns the system-tag manager * - * @return \OCP\SystemTag\ISystemTagManager + * @return ISystemTagManager * * @since 9.0.0 */ public function getSystemTagManager() { - return $this->query('SystemTagManager'); + return $this->query(ISystemTagManager::class); } /** * Returns the system-tag object mapper * - * @return \OCP\SystemTag\ISystemTagObjectMapper + * @return ISystemTagObjectMapper * * @since 9.0.0 */ public function getSystemTagObjectMapper() { - return $this->query('SystemTagObjectMapper'); + return $this->query(ISystemTagObjectMapper::class); } /** * Returns the avatar manager, used for avatar functionality * - * @return \OCP\IAvatarManager + * @return IAvatarManager */ public function getAvatarManager() { - return $this->query('AvatarManager'); + return $this->query(IAvatarManager::class); } /** * Returns the root folder of ownCloud's data directory * - * @return \OCP\Files\IRootFolder + * @return IRootFolder */ public function getRootFolder() { - return $this->query('LazyRootFolder'); + return $this->query(IRootFolder::class); } /** @@ -1481,10 +1520,10 @@ class Server extends ServerContainer implements IServerContainer { * This is the lazy variant so this gets only initialized once it * is actually used. * - * @return \OCP\Files\IRootFolder + * @return IRootFolder */ public function getLazyRootFolder() { - return $this->query('LazyRootFolder'); + return $this->query(IRootFolder::class); } /** @@ -1526,28 +1565,28 @@ class Server extends ServerContainer implements IServerContainer { * @return \OC\User\Manager */ public function getUserManager() { - return $this->query('UserManager'); + return $this->query(IUserManager::class); } /** * @return \OC\Group\Manager */ public function getGroupManager() { - return $this->query('GroupManager'); + return $this->query(IGroupManager::class); } /** * @return \OC\User\Session */ public function getUserSession() { - return $this->query('UserSession'); + return $this->query(IUserSession::class); } /** * @return \OCP\ISession */ public function getSession() { - return $this->query('UserSession')->getSession(); + return $this->getUserSession()->getSession(); } /** @@ -1555,7 +1594,7 @@ class Server extends ServerContainer implements IServerContainer { */ public function setSession(\OCP\ISession $session) { $this->query(SessionStorage::class)->setSession($session); - $this->query('UserSession')->setSession($session); + $this->getUserSession()->setSession($session); $this->query(Store::class)->setSession($session); } @@ -1563,14 +1602,14 @@ class Server extends ServerContainer implements IServerContainer { * @return \OC\Authentication\TwoFactorAuth\Manager */ public function getTwoFactorAuthManager() { - return $this->query('\OC\Authentication\TwoFactorAuth\Manager'); + return $this->query(\OC\Authentication\TwoFactorAuth\Manager::class); } /** * @return \OC\NavigationManager */ public function getNavigationManager() { - return $this->query('NavigationManager'); + return $this->query(INavigationManager::class); } /** @@ -1590,17 +1629,17 @@ class Server extends ServerContainer implements IServerContainer { /** * Returns the app config manager * - * @return \OCP\IAppConfig + * @return IAppConfig */ public function getAppConfig() { - return $this->query('AppConfig'); + return $this->query(IAppConfig::class); } /** - * @return \OCP\L10N\IFactory + * @return IFactory */ public function getL10NFactory() { - return $this->query('L10NFactory'); + return $this->query(IFactory::class); } /** @@ -1615,10 +1654,10 @@ class Server extends ServerContainer implements IServerContainer { } /** - * @return \OCP\IURLGenerator + * @return IURLGenerator */ public function getURLGenerator() { - return $this->query('URLGenerator'); + return $this->query(IURLGenerator::class); } /** @@ -1632,11 +1671,11 @@ class Server extends ServerContainer implements IServerContainer { * Returns an ICache instance. Since 8.1.0 it returns a fake cache. Use * getMemCacheFactory() instead. * - * @return \OCP\ICache + * @return ICache * @deprecated 8.1.0 use getMemCacheFactory to obtain a proper cache */ public function getCache() { - return $this->query('UserCache'); + return $this->query(ICache::class); } /** @@ -1645,7 +1684,7 @@ class Server extends ServerContainer implements IServerContainer { * @return \OCP\ICacheFactory */ public function getMemCacheFactory() { - return $this->query('MemCacheFactory'); + return $this->query(Factory::class); } /** @@ -1664,7 +1703,7 @@ class Server extends ServerContainer implements IServerContainer { * @return \OCP\IDBConnection */ public function getDatabaseConnection() { - return $this->query('DatabaseConnection'); + return $this->query(IDBConnection::class); } /** @@ -1673,25 +1712,25 @@ class Server extends ServerContainer implements IServerContainer { * @return \OCP\Activity\IManager */ public function getActivityManager() { - return $this->query('ActivityManager'); + return $this->query(\OCP\Activity\IManager::class); } /** * Returns an job list for controlling background jobs * - * @return \OCP\BackgroundJob\IJobList + * @return IJobList */ public function getJobList() { - return $this->query('JobList'); + return $this->query(IJobList::class); } /** * Returns a logger instance * - * @return \OCP\ILogger + * @return ILogger */ public function getLogger() { - return $this->query('Logger'); + return $this->query(ILogger::class); } /** @@ -1705,19 +1744,19 @@ class Server extends ServerContainer implements IServerContainer { /** * Returns a router for generating and matching urls * - * @return \OCP\Route\IRouter + * @return IRouter */ public function getRouter() { - return $this->query('Router'); + return $this->query(IRouter::class); } /** * Returns a search instance * - * @return \OCP\ISearch + * @return ISearch */ public function getSearch() { - return $this->query('Search'); + return $this->query(ISearch::class); } /** @@ -1726,34 +1765,34 @@ class Server extends ServerContainer implements IServerContainer { * @return \OCP\Security\ISecureRandom */ public function getSecureRandom() { - return $this->query('SecureRandom'); + return $this->query(ISecureRandom::class); } /** * Returns a Crypto instance * - * @return \OCP\Security\ICrypto + * @return ICrypto */ public function getCrypto() { - return $this->query('Crypto'); + return $this->query(ICrypto::class); } /** * Returns a Hasher instance * - * @return \OCP\Security\IHasher + * @return IHasher */ public function getHasher() { - return $this->query('Hasher'); + return $this->query(IHasher::class); } /** * Returns a CredentialsManager instance * - * @return \OCP\Security\ICredentialsManager + * @return ICredentialsManager */ public function getCredentialsManager() { - return $this->query('CredentialsManager'); + return $this->query(ICredentialsManager::class); } /** @@ -1783,10 +1822,10 @@ class Server extends ServerContainer implements IServerContainer { /** * Returns an instance of the HTTP client service * - * @return \OCP\Http\Client\IClientService + * @return IClientService */ public function getHTTPClientService() { - return $this->query('HttpClientService'); + return $this->query(IClientService::class); } /** @@ -1803,10 +1842,10 @@ class Server extends ServerContainer implements IServerContainer { * * The returned logger only logs data when debug mode is enabled * - * @return \OCP\Diagnostics\IEventLogger + * @return IEventLogger */ public function getEventLogger() { - return $this->query('EventLogger'); + return $this->query(IEventLogger::class); } /** @@ -1814,10 +1853,10 @@ class Server extends ServerContainer implements IServerContainer { * * The returned logger only logs data when debug mode is enabled * - * @return \OCP\Diagnostics\IQueryLogger + * @return IQueryLogger */ public function getQueryLogger() { - return $this->query('QueryLogger'); + return $this->query(IQueryLogger::class); } /** @@ -1826,7 +1865,7 @@ class Server extends ServerContainer implements IServerContainer { * @return \OCP\ITempManager */ public function getTempManager() { - return $this->query('TempManager'); + return $this->query(ITempManager::class); } /** @@ -1835,16 +1874,16 @@ class Server extends ServerContainer implements IServerContainer { * @return \OCP\App\IAppManager */ public function getAppManager() { - return $this->query('AppManager'); + return $this->query(IAppManager::class); } /** * Creates a new mailer * - * @return \OCP\Mail\IMailer + * @return IMailer */ public function getMailer() { - return $this->query('Mailer'); + return $this->query(IMailer::class); } /** @@ -1864,24 +1903,24 @@ class Server extends ServerContainer implements IServerContainer { } /** - * @return \OCP\IDateTimeZone + * @return IDateTimeZone */ public function getDateTimeZone() { - return $this->query('DateTimeZone'); + return $this->query(IDateTimeZone::class); } /** - * @return \OCP\IDateTimeFormatter + * @return IDateTimeFormatter */ public function getDateTimeFormatter() { - return $this->query('DateTimeFormatter'); + return $this->query(IDateTimeFormatter::class); } /** - * @return \OCP\Files\Config\IMountProviderCollection + * @return IMountProviderCollection */ public function getMountProviderCollection() { - return $this->query('MountConfigManager'); + return $this->query(IMountProviderCollection::class); } /** @@ -1912,50 +1951,52 @@ class Server extends ServerContainer implements IServerContainer { /** * Get the locking provider * - * @return \OCP\Lock\ILockingProvider + * @return ILockingProvider * @since 8.1.0 */ public function getLockingProvider() { - return $this->query('LockingProvider'); + return $this->query(ILockingProvider::class); } /** - * @return \OCP\Files\Mount\IMountManager + * @return IMountManager **/ function getMountManager() { - return $this->query('MountManager'); + return $this->query(IMountManager::class); } - /** @return \OCP\Files\Config\IUserMountCache */ + /** + * @return IUserMountCache + */ function getUserMountCache() { - return $this->query('UserMountCache'); + return $this->query(IUserMountCache::class); } /** * Get the MimeTypeDetector * - * @return \OCP\Files\IMimeTypeDetector + * @return IMimeTypeDetector */ public function getMimeTypeDetector() { - return $this->query('MimeTypeDetector'); + return $this->query(IMimeTypeDetector::class); } /** * Get the MimeTypeLoader * - * @return \OCP\Files\IMimeTypeLoader + * @return IMimeTypeLoader */ public function getMimeTypeLoader() { - return $this->query('MimeTypeLoader'); + return $this->query(IMimeTypeLoader::class); } /** * Get the manager of all the capabilities * - * @return \OC\CapabilitiesManager + * @return CapabilitiesManager */ public function getCapabilitiesManager() { - return $this->query('CapabilitiesManager'); + return $this->query(CapabilitiesManager::class); } /** @@ -1976,14 +2017,14 @@ class Server extends ServerContainer implements IServerContainer { * @since 8.2.0 */ public function getNotificationManager() { - return $this->query('NotificationManager'); + return $this->query(\OCP\Notification\IManager::class); } /** - * @return \OCP\Comments\ICommentsManager + * @return ICommentsManager */ public function getCommentsManager() { - return $this->query('CommentsManager'); + return $this->query(ICommentsManager::class); } /** @@ -2018,14 +2059,14 @@ class Server extends ServerContainer implements IServerContainer { * @return Throttler */ public function getBruteForceThrottler() { - return $this->query('Throttler'); + return $this->query(Throttler::class); } /** * @return IContentSecurityPolicyManager */ public function getContentSecurityPolicyManager() { - return $this->query('ContentSecurityPolicyManager'); + return $this->query(ContentSecurityPolicyManager::class); } /** @@ -2041,7 +2082,7 @@ class Server extends ServerContainer implements IServerContainer { * @return \OCA\Files_External\Service\BackendService */ public function getStoragesBackendService() { - return $this->query('OCA\\Files_External\\Service\\BackendService'); + return $this->query(BackendService::class); } /** @@ -2050,7 +2091,7 @@ class Server extends ServerContainer implements IServerContainer { * @return \OCA\Files_External\Service\GlobalStoragesService */ public function getGlobalStoragesService() { - return $this->query('OCA\\Files_External\\Service\\GlobalStoragesService'); + return $this->query(GlobalStoragesService::class); } /** @@ -2059,7 +2100,7 @@ class Server extends ServerContainer implements IServerContainer { * @return \OCA\Files_External\Service\UserGlobalStoragesService */ public function getUserGlobalStoragesService() { - return $this->query('OCA\\Files_External\\Service\\UserGlobalStoragesService'); + return $this->query(UserGlobalStoragesService::class); } /** @@ -2068,21 +2109,21 @@ class Server extends ServerContainer implements IServerContainer { * @return \OCA\Files_External\Service\UserStoragesService */ public function getUserStoragesService() { - return $this->query('OCA\\Files_External\\Service\\UserStoragesService'); + return $this->query(UserStoragesService::class); } /** * @return \OCP\Share\IManager */ public function getShareManager() { - return $this->query('ShareManager'); + return $this->query(\OCP\Share\IManager::class); } /** * @return \OCP\Collaboration\Collaborators\ISearch */ public function getCollaboratorSearch() { - return $this->query('CollaboratorSearch'); + return $this->query(\OCP\Collaboration\Collaborators\ISearch::class); } /** |