Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion apps/dav/lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
use OCA\DAV\UserMigration\CalendarMigrator;
use OCA\DAV\UserMigration\ContactsMigrator;
use OCP\Accounts\UserUpdatedEvent;
use OCP\App\IAppManager;
use OCP\AppFramework\App;
use OCP\AppFramework\Bootstrap\IBootContext;
use OCP\AppFramework\Bootstrap\IBootstrap;
Expand Down Expand Up @@ -217,7 +218,7 @@ public function register(IRegistrationContext $context): void {

public function boot(IBootContext $context): void {
// Load all dav apps
\OC_App::loadApps(['dav']);
$context->getServerContainer()->get(IAppManager::class)->loadApps(['dav']);

$context->injectFn($this->registerContactsManager(...));
$context->injectFn($this->registerCalendarManager(...));
Expand Down
13 changes: 8 additions & 5 deletions apps/dav/tests/unit/bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
<?php

declare(strict_types=1);

/**
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
* SPDX-License-Identifier: AGPL-3.0-only
*/

use OCP\App\IAppManager;
use OCP\Server;

if (!defined('PHPUNIT_RUN')) {
define('PHPUNIT_RUN', 1);
}

require_once __DIR__ . '/../../../../lib/base.php';
require_once __DIR__ . '/../../../../tests/autoload.php';

\OC::$composerAutoloader->addPsr4('Test\\', OC::$SERVERROOT . '/tests/lib/', true);

\OC_App::loadApp('dav');

OC_Hook::clear();
Server::get(IAppManager::class)->loadApp('dav');
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

use OC\ServerNotAvailableException;
use OCA\User_LDAP\LDAP;
use OCP\App\IAppManager;
use OCP\Server;

/**
* Class ExceptionOnLostConnection
Expand Down Expand Up @@ -63,7 +65,7 @@ public function __destruct() {
*/
public function setUp(): void {
require_once __DIR__ . '/../../../../lib/base.php';
\OC_App::loadApps(['user_ldap']);
Server::get(IAppManager::class)->loadApps(['user_ldap']);

$ch = $this->getCurl();
$proxyInfoJson = curl_exec($ch);
Expand Down
11 changes: 6 additions & 5 deletions apps/user_status/tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

use OCP\App\IAppManager;
use OCP\Server;

if (!defined('PHPUNIT_RUN')) {
define('PHPUNIT_RUN', 1);
}

require_once __DIR__ . '/../../../lib/base.php';
require_once __DIR__ . '/../../../tests/autoload.php';

\OC::$composerAutoloader->addPsr4('Test\\', OC::$SERVERROOT . '/tests/lib/', true);

\OC_App::loadApp('user_status');

OC_Hook::clear();
Server::get(IAppManager::class)->loadApp('user_status');
11 changes: 0 additions & 11 deletions build/psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@
<code><![CDATA[IAppContainer]]></code>
</DeprecatedInterface>
<DeprecatedMethod>
<code><![CDATA[\OC_App::loadApps(['dav'])]]></code>
<code><![CDATA[getServer]]></code>
<code><![CDATA[getServer]]></code>
<code><![CDATA[getURLGenerator]]></code>
Expand Down Expand Up @@ -2925,8 +2924,6 @@
</file>
<file src="core/Command/Db/ConvertType.php">
<DeprecatedMethod>
<code><![CDATA[\OC_App::getAllApps()]]></code>
<code><![CDATA[\OC_App::loadApp($app)]]></code>
<code><![CDATA[execute]]></code>
<code><![CDATA[getName]]></code>
<code><![CDATA[getPrimaryKeyColumns]]></code>
Expand Down Expand Up @@ -4473,14 +4470,6 @@
<code><![CDATA[getRequest]]></code>
</DeprecatedMethod>
</file>
<file src="ocs/v1.php">
<DeprecatedMethod>
<code><![CDATA[OC_App::loadApps()]]></code>
<code><![CDATA[OC_App::loadApps(['authentication'])]]></code>
<code><![CDATA[OC_App::loadApps(['extended_authentication'])]]></code>
<code><![CDATA[OC_App::loadApps(['session'])]]></code>
</DeprecatedMethod>
</file>
<file src="public.php">
<DeprecatedMethod>
<code><![CDATA[getAppValue]]></code>
Expand Down
8 changes: 6 additions & 2 deletions core/Command/Db/ConvertType.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use OC\DB\ConnectionFactory;
use OC\DB\MigrationService;
use OC\DB\PgSqlTools;
use OCP\App\IAppManager;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\DB\Types;
use OCP\IConfig;
Expand All @@ -38,6 +39,7 @@ class ConvertType extends Command implements CompletionAwareInterface {
public function __construct(
protected IConfig $config,
protected ConnectionFactory $connectionFactory,
protected IAppManager $appManager,
) {
parent::__construct();
}
Expand Down Expand Up @@ -208,11 +210,13 @@ protected function createSchema(Connection $fromDB, Connection $toDB, InputInter
$toMS->migrate($currentMigration);
}

$apps = $input->getOption('all-apps') ? \OC_App::getAllApps() : \OC_App::getEnabledApps();
$apps = $input->getOption('all-apps')
? $this->appManager->getAllAppsInAppsFolders()
: $this->appManager->getEnabledApps();
foreach ($apps as $app) {
$output->writeln('<info> - ' . $app . '</info>');
// Make sure autoloading works...
\OC_App::loadApp($app);
$this->appManager->loadApp($app);
$fromMS = new MigrationService($app, $fromDB);
$currentMigration = $fromMS->getMigration('current');
if ($currentMigration !== '0') {
Expand Down
5 changes: 3 additions & 2 deletions lib/private/Files/SetupManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
use OC\Lockdown\Filesystem\NullStorage;
use OC\Share\Share;
use OC\Share20\ShareDisableChecker;
use OC_App;
use OC_Hook;
use OCA\Files_External\Config\ExternalMountPoint;
use OCA\Files_Sharing\External\Mount;
use OCA\Files_Sharing\ISharedMountPoint;
use OCA\Files_Sharing\SharedMount;
use OCP\App\IAppManager;
use OCP\Constants;
use OCP\Diagnostics\IEventLogger;
use OCP\EventDispatcher\IEventDispatcher;
Expand Down Expand Up @@ -81,6 +81,7 @@ public function __construct(
private LoggerInterface $logger,
private IConfig $config,
private ShareDisableChecker $shareDisableChecker,
private IAppManager $appManager,
) {
$this->cache = $cacheFactory->createDistributed('setupmanager::');
$this->listeningForProviders = false;
Expand All @@ -104,7 +105,7 @@ private function setupBuiltinWrappers() {
$this->setupBuiltinWrappersDone = true;

// load all filesystem apps before, so no setup-hook gets lost
OC_App::loadApps(['filesystem']);
$this->appManager->loadApps(['filesystem']);
$prevLogging = Filesystem::logWarningWhenAddingStorageWrapper(false);

Filesystem::addStorageWrapper('mount_options', function ($mountPoint, IStorage $storage, IMountPoint $mount) {
Expand Down
3 changes: 3 additions & 0 deletions lib/private/Files/SetupManagerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
namespace OC\Files;

use OC\Share20\ShareDisableChecker;
use OCP\App\IAppManager;
use OCP\Diagnostics\IEventLogger;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\Config\IMountProviderCollection;
Expand Down Expand Up @@ -36,6 +37,7 @@ public function __construct(
private LoggerInterface $logger,
private IConfig $config,
private ShareDisableChecker $shareDisableChecker,
private IAppManager $appManager,
) {
$this->setupManager = null;
}
Expand All @@ -55,6 +57,7 @@ public function create(IMountManager $mountManager): SetupManager {
$this->logger,
$this->config,
$this->shareDisableChecker,
$this->appManager,
);
}
return $this->setupManager;
Expand Down
25 changes: 13 additions & 12 deletions ocs/v1.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@

declare(strict_types=1);

use OC\Route\Router;
use OC\SystemConfig;
use OC\User\LoginException;
use OCP\IConfig;
use OCP\IRequest;
use OCP\IUserSession;
use OCP\Server;

/**
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
Expand All @@ -20,9 +12,17 @@
require_once __DIR__ . '/../lib/base.php';

use OC\OCS\ApiHelper;
use OC\Route\Router;
use OC\SystemConfig;
use OC\User\LoginException;
use OCP\App\IAppManager;
use OCP\AppFramework\Http;
use OCP\AppFramework\OCSController;
use OCP\IConfig;
use OCP\IRequest;
use OCP\IUserSession;
use OCP\Security\Bruteforce\MaxDelayReached;
use OCP\Server;
use OCP\Util;
use Psr\Log\LoggerInterface;
use Symfony\Component\Routing\Exception\MethodNotAllowedException;
Expand All @@ -41,14 +41,15 @@
* Try the appframework routes
*/
try {
OC_App::loadApps(['session']);
OC_App::loadApps(['authentication']);
OC_App::loadApps(['extended_authentication']);
$appManager = Server::get(IAppManager::class);
$appManager->loadApps(['session']);
$appManager->loadApps(['authentication']);
$appManager->loadApps(['extended_authentication']);

// load all apps to get all api routes properly setup
// FIXME: this should ideally appear after handleLogin but will cause
// side effects in existing apps
OC_App::loadApps();
$appManager->loadApps();

$request = Server::get(IRequest::class);
$request->throwDecodingExceptionIfAny();
Expand Down
9 changes: 8 additions & 1 deletion tests/bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
<?php

declare(strict_types=1);

/**
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
* SPDX-License-Identifier: AGPL-3.0-only
*/

use OCP\App\IAppManager;
use OCP\Server;

define('PHPUNIT_RUN', 1);

$configDir = getenv('CONFIG_DIR');
Expand All @@ -18,11 +24,12 @@
\OC::$composerAutoloader->addPsr4('Tests\\', OC::$SERVERROOT . '/tests/', true);

// load all apps
$appManager = Server::get(IAppManager::class);
foreach (new \DirectoryIterator(__DIR__ . '/../apps/') as $file) {
if ($file->isDot()) {
continue;
}
\OC_App::loadApp($file->getFilename());
$appManager->loadApp($file->getFilename());
}

OC_Hook::clear();
Expand Down
3 changes: 2 additions & 1 deletion tests/lib/Traits/EncryptionTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use OCA\Encryption\Crypto\Encryption;
use OCA\Encryption\KeyManager;
use OCA\Encryption\Users\Setup;
use OCP\App\IAppManager;
use OCP\Encryption\IManager;
use OCP\IConfig;
use OCP\IUserManager;
Expand Down Expand Up @@ -102,7 +103,7 @@ protected function setUpEncryptionTrait() {
$this->userManager = Server::get(IUserManager::class);
$this->setupManager = Server::get(SetupManager::class);

\OC_App::loadApp('encryption');
Server::get(IAppManager::class)->loadApp('encryption');

$this->encryptionApp = new Application([], $isReady);

Expand Down
Loading