diff --git a/lib/private/Installer.php b/lib/private/Installer.php index 1f22224964d..8fbbd0b9bd0 100644 --- a/lib/private/Installer.php +++ b/lib/private/Installer.php @@ -43,6 +43,7 @@ class Installer { private ITempManager $tempManager, private LoggerInterface $logger, private IConfig $config, + private IAppManager $appManager, private bool $isCLI, ) { } @@ -68,7 +69,7 @@ class Installer { } $l = \OCP\Util::getL10N('core'); - $info = \OCP\Server::get(IAppManager::class)->getAppInfoByPath($basedir . '/appinfo/info.xml', $l->getLanguageCode()); + $info = $this->appManager->getAppInfoByPath($basedir . '/appinfo/info.xml', $l->getLanguageCode()); if (!is_array($info)) { throw new \Exception( @@ -120,7 +121,7 @@ class Installer { $config = \OCP\Server::get(IConfig::class); //set the installed version - $config->setAppValue($info['id'], 'installed_version', \OCP\Server::get(IAppManager::class)->getAppVersion($info['id'], false)); + $config->setAppValue($info['id'], 'installed_version', $this->appManager->getAppVersion($info['id'], false)); $config->setAppValue($info['id'], 'enabled', 'no'); //set remote/public handlers @@ -347,7 +348,7 @@ class Installer { } // Check if the version is lower than before - $currentVersion = \OCP\Server::get(IAppManager::class)->getAppVersion($appId, true); + $currentVersion = $this->appManager->getAppVersion($appId, true); $newVersion = (string)$xml->version; if (version_compare($currentVersion, $newVersion) === 1) { throw new \Exception( @@ -424,7 +425,7 @@ class Installer { foreach ($this->apps as $app) { if ($app['id'] === $appId) { - $currentVersion = \OCP\Server::get(IAppManager::class)->getAppVersion($appId, true); + $currentVersion = $this->appManager->getAppVersion($appId, true); if (!isset($app['releases'][0]['version'])) { return false; @@ -487,7 +488,7 @@ class Installer { */ public function removeApp(string $appId): bool { if ($this->isDownloaded($appId)) { - if (\OCP\Server::get(IAppManager::class)->isShipped($appId)) { + if ($this->appManager->isShipped($appId)) { return false; } diff --git a/lib/private/Server.php b/lib/private/Server.php index 49bda19a738..9ec57247625 100644 --- a/lib/private/Server.php +++ b/lib/private/Server.php @@ -12,7 +12,6 @@ use NCU\Security\Signature\ISignatureManager; use OC\Accounts\AccountManager; use OC\App\AppManager; use OC\App\AppStore\Bundles\BundleFetcher; -use OC\App\AppStore\Fetcher\AppFetcher; use OC\AppFramework\Bootstrap\Coordinator; use OC\AppFramework\Http\Request; use OC\AppFramework\Http\RequestId; @@ -1171,17 +1170,6 @@ class Server extends ServerContainer implements IServerContainer { ); }); - $this->registerService(Installer::class, function (ContainerInterface $c) { - return new Installer( - $c->get(AppFetcher::class), - $c->get(IClientService::class), - $c->get(ITempManager::class), - $c->get(LoggerInterface::class), - $c->get(\OCP\IConfig::class), - \OC::$CLI - ); - }); - $this->registerService(IApiFactory::class, function (ContainerInterface $c) { return new ApiFactory($c->get(IClientService::class)); });