diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2025-02-24 12:44:50 +0100 |
---|---|---|
committer | Côme Chilliet <91878298+come-nc@users.noreply.github.com> | 2025-02-24 17:48:34 +0100 |
commit | 34139987d609386c3351c46fd60b0f932795b6df (patch) | |
tree | 762348727684498a9c3364a93e3cecc681ec4e8c /lib | |
parent | 03ba09241926801733113d8225d64909712e2e6f (diff) | |
download | nextcloud-server-34139987d609386c3351c46fd60b0f932795b6df.tar.gz nextcloud-server-34139987d609386c3351c46fd60b0f932795b6df.zip |
fix: Replace OC_App calls by IAppManager
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/base.php | 23 | ||||
-rw-r--r-- | lib/private/Route/Router.php | 6 | ||||
-rw-r--r-- | lib/private/Server.php | 2 |
3 files changed, 18 insertions, 13 deletions
diff --git a/lib/base.php b/lib/base.php index 546a119479b..811055c982b 100644 --- a/lib/base.php +++ b/lib/base.php @@ -675,7 +675,10 @@ class OC { throw new \OCP\HintException('The PHP SimpleXML/PHP-XML extension is not installed.', 'Install the extension or make sure it is enabled.'); } - OC_App::loadApps(['session']); + $appManager = Server::get(\OCP\App\IAppManager::class); + if ($systemConfig->getValue('installed', false)) { + $appManager->loadApps(['session']); + } if (!self::$CLI) { self::initSession(); } @@ -759,7 +762,7 @@ class OC { // Make sure that the application class is not loaded before the database is setup if ($systemConfig->getValue('installed', false)) { - OC_App::loadApp('settings'); + $appManager->loadApp('settings'); /* Build core application to make sure that listeners are registered */ Server::get(\OC\Core\Application::class); } @@ -1002,19 +1005,21 @@ class OC { } } + $appManager = Server::get(\OCP\App\IAppManager::class); + // Always load authentication apps - OC_App::loadApps(['authentication']); - OC_App::loadApps(['extended_authentication']); + $appManager->loadApps(['authentication']); + $appManager->loadApps(['extended_authentication']); // Load minimum set of apps if (!\OCP\Util::needUpgrade() && !((bool)$systemConfig->getValue('maintenance', false))) { // For logged-in users: Load everything if (Server::get(IUserSession::class)->isLoggedIn()) { - OC_App::loadApps(); + $appManager->loadApps(); } else { // For guests: Load only filesystem and logging - OC_App::loadApps(['filesystem', 'logging']); + $appManager->loadApps(['filesystem', 'logging']); // Don't try to login when a client is trying to get a OAuth token. // OAuth needs to support basic auth too, so the login is not valid @@ -1027,9 +1032,9 @@ class OC { if (!self::$CLI) { try { - if (!((bool)$systemConfig->getValue('maintenance', false)) && !\OCP\Util::needUpgrade()) { - OC_App::loadApps(['filesystem', 'logging']); - OC_App::loadApps(); + if (!\OCP\Util::needUpgrade()) { + $appManager->loadApps(['filesystem', 'logging']); + $appManager->loadApps(); } Server::get(\OC\Route\Router::class)->match($request->getRawPathInfo()); return; diff --git a/lib/private/Route/Router.php b/lib/private/Route/Router.php index 3277b983d0f..d073132516d 100644 --- a/lib/private/Route/Router.php +++ b/lib/private/Route/Router.php @@ -142,7 +142,7 @@ class Router implements IRouter { foreach ($routingFiles as $app => $file) { if (!isset($this->loadedApps[$app])) { - if (!\OC_App::isAppLoaded($app)) { + if (!$this->appManager->isAppLoaded($app)) { // app MUST be loaded before app routes // try again next time loadRoutes() is called $this->loaded = false; @@ -257,8 +257,8 @@ class Router implements IRouter { $this->loadRoutes('settings'); } elseif (str_starts_with($url, '/core/')) { \OC::$REQUESTEDAPP = $url; - if (!$this->config->getSystemValueBool('maintenance') && !Util::needUpgrade()) { - \OC_App::loadApps(); + if ($this->config->getSystemValueBool('installed', false) && !Util::needUpgrade()) { + $this->appManager->loadApps(); } $this->loadRoutes('core'); } else { diff --git a/lib/private/Server.php b/lib/private/Server.php index 77759de30c5..8c5ec8ed252 100644 --- a/lib/private/Server.php +++ b/lib/private/Server.php @@ -838,7 +838,7 @@ class Server extends ServerContainer implements IServerContainer { if ($busClass) { [$app, $class] = explode('::', $busClass, 2); if ($c->get(IAppManager::class)->isEnabledForUser($app)) { - \OC_App::loadApp($app); + $c->get(IAppManager::class)->loadApp($app); return $c->get($class); } else { throw new ServiceUnavailableException("The app providing the command bus ($app) is not enabled"); |