From c92b9ce2c43c1a5d1ff645e922bfa8d8b1e8c0d4 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Mon, 20 Mar 2017 10:16:56 +0100 Subject: [PATCH] Fix settings tests Signed-off-by: Roeland Jago Douma --- .../DependencyInjection/DIContainer.php | 14 ++----------- lib/private/Server.php | 20 ++++++++++++++++--- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/lib/private/AppFramework/DependencyInjection/DIContainer.php b/lib/private/AppFramework/DependencyInjection/DIContainer.php index 3bfc64e85b5..d196eda946a 100644 --- a/lib/private/AppFramework/DependencyInjection/DIContainer.php +++ b/lib/private/AppFramework/DependencyInjection/DIContainer.php @@ -92,10 +92,6 @@ class DIContainer extends SimpleContainer implements IAppContainer { /** * Core services */ - $this->registerService('OCP\\App\\IAppManager', function($c) { - return $this->getServer()->getAppManager(); - }); - $this->registerService('OCP\\AppFramework\\Http\\IOutput', function($c){ return new Output($this->getServer()->getWebRoot()); }); @@ -119,10 +115,6 @@ class DIContainer extends SimpleContainer implements IAppContainer { return $this->getServer()->getCache(); }); - $this->registerService('OCP\\ICacheFactory', function($c) { - return $this->getServer()->getMemCacheFactory(); - }); - $this->registerService('OC\\CapabilitiesManager', function($c) { return $this->getServer()->getCapabilitiesManager(); }); @@ -243,10 +235,6 @@ class DIContainer extends SimpleContainer implements IAppContainer { return $this->getServer()->getTagManager(); }); - $this->registerService('OCP\\ITempManager', function($c) { - return $this->getServer()->getTempManager(); - }); - $this->registerAlias('OCP\\AppFramework\\Utility\\ITimeFactory', 'OC\AppFramework\Utility\TimeFactory'); $this->registerAlias('TimeFactory', 'OCP\\AppFramework\\Utility\\ITimeFactory'); @@ -580,6 +568,8 @@ class DIContainer extends SimpleContainer implements IAppContainer { if (strtolower($segments[1]) === strtolower($this['AppName'])) { return parent::query($name); } + } else if ($this['AppName'] === 'settings' && strpos($name, 'OC\\Settings\\') === 0) { + return parent::query($name); } } diff --git a/lib/private/Server.php b/lib/private/Server.php index 8aaecf1d256..bbfc7ab14c4 100644 --- a/lib/private/Server.php +++ b/lib/private/Server.php @@ -42,6 +42,7 @@ namespace OC; use bantu\IniGetWrapper\IniGetWrapper; +use OC\App\AppManager; use OC\App\AppStore\Fetcher\AppFetcher; use OC\App\AppStore\Fetcher\CategoryFetcher; use OC\AppFramework\Http\Request; @@ -73,6 +74,7 @@ use OC\Lock\NoopLockingProvider; use OC\Lockdown\LockdownManager; use OC\Mail\Mailer; use OC\Memcache\ArrayCache; +use OC\Memcache\Factory; use OC\Notification\Manager; use OC\Repair\NC11\CleanPreviewsBackgroundJob; use OC\RichObjectStrings\Validator; @@ -91,11 +93,14 @@ use OC\Security\TrustedDomainHelper; use OC\Session\CryptoWrapper; use OC\Tagging\TagMapper; use OCA\Theming\ThemingDefaults; +use OCP\App\IAppManager; use OCP\Federation\ICloudIdManager; use OCP\Authentication\LoginCredentials\IStore; +use OCP\ICacheFactory; use OCP\IDBConnection; use OCP\IL10N; use OCP\IServerContainer; +use OCP\ITempManager; use OCP\RichObjectStrings\IValidator; use OCP\Security\IContentSecurityPolicyManager; use Symfony\Component\EventDispatcher\EventDispatcher; @@ -396,7 +401,7 @@ class Server extends ServerContainer implements IServerContainer { $this->registerService('UserCache', function ($c) { return new Cache\File(); }); - $this->registerService('MemCacheFactory', function (Server $c) { + $this->registerService(Factory::class, function (Server $c) { $config = $c->getConfig(); if ($config->getSystemValue('installed', false) && !(defined('PHPUNIT_RUN') && PHPUNIT_RUN)) { @@ -419,6 +424,9 @@ class Server extends ServerContainer implements IServerContainer { '\\OC\\Memcache\\ArrayCache' ); }); + $this->registerAlias('MemCacheFactory', Factory::class); + $this->registerAlias(ICacheFactory::class, Factory::class); + $this->registerService('RedisFactory', function (Server $c) { $systemConfig = $c->getSystemConfig(); return new RedisFactory($systemConfig); @@ -528,13 +536,16 @@ class Server extends ServerContainer implements IServerContainer { return new NullQueryLogger(); } }); - $this->registerService('TempManager', function (Server $c) { + $this->registerService(TempManager::class, function (Server $c) { return new TempManager( $c->getLogger(), $c->getConfig() ); }); - $this->registerService('AppManager', function (Server $c) { + $this->registerAlias('TempManager', TempManager::class); + $this->registerAlias(ITempManager::class, TempManager::class); + + $this->registerService(AppManager::class, function (Server $c) { return new \OC\App\AppManager( $c->getUserSession(), $c->getAppConfig(), @@ -543,6 +554,9 @@ class Server extends ServerContainer implements IServerContainer { $c->getEventDispatcher() ); }); + $this->registerAlias('AppManager', AppManager::class); + $this->registerAlias(IAppManager::class, AppManager::class); + $this->registerService('DateTimeZone', function (Server $c) { return new DateTimeZone( $c->getConfig(), -- 2.39.5