From ce74bdcda244172cbe90dc792e30128802a78828 Mon Sep 17 00:00:00 2001 From: Andrew Summers <18727110+summersab@users.noreply.github.com> Date: Tue, 29 Aug 2023 18:54:23 -0500 Subject: [PATCH] Refactor `OC\Server::getThemingDefaults` Signed-off-by: Andrew Summers <18727110+summersab@users.noreply.github.com> --- lib/private/AppFramework/DependencyInjection/DIContainer.php | 2 +- lib/private/Console/Application.php | 2 +- lib/private/Server.php | 2 +- lib/private/URLGenerator.php | 4 ++-- lib/public/Defaults.php | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/private/AppFramework/DependencyInjection/DIContainer.php b/lib/private/AppFramework/DependencyInjection/DIContainer.php index a012d1e8ea69f..e4a06d9d4e084 100644 --- a/lib/private/AppFramework/DependencyInjection/DIContainer.php +++ b/lib/private/AppFramework/DependencyInjection/DIContainer.php @@ -173,7 +173,7 @@ public function __construct(string $appName, array $urlParams = [], ServerContai }); $this->registerService('OC_Defaults', function (ContainerInterface $c) { - return $c->get(IServerContainer::class)->getThemingDefaults(); + return $c->get(IServerContainer::class)->get('ThemingDefaults'); }); $this->registerService('Protocol', function (ContainerInterface $c) { diff --git a/lib/private/Console/Application.php b/lib/private/Console/Application.php index 113f0507ef534..c18a38ce82c99 100644 --- a/lib/private/Console/Application.php +++ b/lib/private/Console/Application.php @@ -64,7 +64,7 @@ public function __construct(IConfig $config, IRequest $request, LoggerInterface $logger, MemoryInfo $memoryInfo) { - $defaults = \OC::$server->getThemingDefaults(); + $defaults = \OC::$server->get('ThemingDefaults'); $this->config = $config; $this->application = new SymfonyApplication($defaults->getName(), \OC_Util::getVersionString()); $this->dispatcher = $dispatcher; diff --git a/lib/private/Server.php b/lib/private/Server.php index e8ade23d8fe6d..3629c266517ef 100644 --- a/lib/private/Server.php +++ b/lib/private/Server.php @@ -1341,7 +1341,7 @@ public function __construct($webRoot, \OC\Config $config) { $this->registerService(Defaults::class, function (Server $c) { return new Defaults( - $c->getThemingDefaults() + $c->get('ThemingDefaults') ); }); /** @deprecated 19.0.0 */ diff --git a/lib/private/URLGenerator.php b/lib/private/URLGenerator.php index 3a52b99889c05..187deb9915032 100644 --- a/lib/private/URLGenerator.php +++ b/lib/private/URLGenerator.php @@ -217,7 +217,7 @@ public function imagePath(string $appName, string $file): string { $themingEnabled = $this->config->getSystemValueBool('installed', false) && $this->getAppManager()->isEnabledForUser('theming'); $themingImagePath = false; if ($themingEnabled) { - $themingDefaults = \OC::$server->getThemingDefaults(); + $themingDefaults = \OC::$server->get('ThemingDefaults'); if ($themingDefaults instanceof ThemingDefaults) { $themingImagePath = $themingDefaults->replaceImagePath($appName, $file); } @@ -290,7 +290,7 @@ public function getAbsoluteURL(string $url): string { * @return string url to the online documentation */ public function linkToDocs(string $key): string { - $theme = \OC::$server->getThemingDefaults(); + $theme = \OC::$server->get('ThemingDefaults'); return $theme->buildDocLinkToKey($key); } diff --git a/lib/public/Defaults.php b/lib/public/Defaults.php index a295db120ade4..63568b272941b 100644 --- a/lib/public/Defaults.php +++ b/lib/public/Defaults.php @@ -52,7 +52,7 @@ class Defaults { */ public function __construct(\OC_Defaults $defaults = null) { if ($defaults === null) { - $defaults = \OC::$server->getThemingDefaults(); + $defaults = \OC::$server->get('ThemingDefaults'); } $this->defaults = $defaults; }