mirror of
https://github.com/nextcloud/server.git
synced 2026-02-18 18:28:50 -05:00
fix: Replace OC_App calls by IAppManager
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
parent
03ba092419
commit
34139987d6
6 changed files with 24 additions and 19 deletions
|
|
@ -5,7 +5,6 @@
|
|||
*/
|
||||
namespace OCA\DAV\CalDAV\Activity\Provider;
|
||||
|
||||
use OC_App;
|
||||
use OCP\Activity\Exceptions\UnknownActivityException;
|
||||
use OCP\Activity\IEvent;
|
||||
use OCP\Activity\IEventMerger;
|
||||
|
|
@ -67,7 +66,7 @@ class Event extends Base {
|
|||
if (isset($eventData['link']) && is_array($eventData['link']) && $this->appManager->isEnabledForUser('calendar')) {
|
||||
try {
|
||||
// The calendar app needs to be manually loaded for the routes to be loaded
|
||||
OC_App::loadApp('calendar');
|
||||
$this->appManager->loadApp('calendar');
|
||||
$linkData = $eventData['link'];
|
||||
$calendarUri = $this->urlencodeLowerHex($linkData['calendar_uri']);
|
||||
if ($affectedUser === $linkData['owner']) {
|
||||
|
|
|
|||
|
|
@ -59,8 +59,9 @@ class UpdaterTest extends TestCase {
|
|||
* that the mount point doesn't end up at the trash bin
|
||||
*/
|
||||
public function testDeleteParentFolder(): void {
|
||||
$status = Server::get(IAppManager::class)->isEnabledForUser('files_trashbin');
|
||||
(new \OC_App())->enable('files_trashbin');
|
||||
$appManager = Server::get(IAppManager::class);
|
||||
$status = $appManager->isEnabledForUser('files_trashbin');
|
||||
$appManager->enableApp('files_trashbin');
|
||||
|
||||
// register trashbin hooks
|
||||
$trashbinApp = new Application();
|
||||
|
|
@ -116,7 +117,7 @@ class UpdaterTest extends TestCase {
|
|||
$rootView->deleteAll('files_trashin');
|
||||
|
||||
if ($status === false) {
|
||||
Server::get(IAppManager::class)->disableApp('files_trashbin');
|
||||
$appManager->disableApp('files_trashbin');
|
||||
}
|
||||
|
||||
Filesystem::getLoader()->removeStorageWrapper('oc_trashbin');
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ class Repair extends Command {
|
|||
if (!is_array($info)) {
|
||||
continue;
|
||||
}
|
||||
\OC_App::loadApp($app);
|
||||
$this->appManager->loadApp($app);
|
||||
$steps = $info['repair-steps']['post-migration'];
|
||||
foreach ($steps as $step) {
|
||||
try {
|
||||
|
|
|
|||
23
lib/base.php
23
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;
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
Loading…
Reference in a new issue