Skip to content

Commit f88a4b5

Browse files
authored
Merge pull request #21866 from nextcloud/techdebt/ldap-psr-container
Migrate LDAP to the PSR container
2 parents 5563a95 + 35e966c commit f88a4b5

1 file changed

Lines changed: 15 additions & 12 deletions

File tree

apps/user_ldap/lib/AppInfo/Application.php

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,9 @@
4141
use OCP\AppFramework\Bootstrap\IBootContext;
4242
use OCP\AppFramework\Bootstrap\IBootstrap;
4343
use OCP\AppFramework\Bootstrap\IRegistrationContext;
44-
use OCP\AppFramework\IAppContainer;
4544
use OCP\IL10N;
45+
use OCP\IServerContainer;
46+
use Psr\Container\ContainerInterface;
4647

4748
class Application extends App implements IBootstrap {
4849
public function __construct() {
@@ -52,17 +53,17 @@ public function __construct() {
5253
/**
5354
* Controller
5455
*/
55-
$container->registerService('RenewPasswordController', function (IAppContainer $c) {
56-
/** @var \OC\Server $server */
57-
$server = $c->query('ServerContainer');
56+
$container->registerService('RenewPasswordController', function (ContainerInterface $c) {
57+
/** @var IServerContainer $server */
58+
$server = $c->get(IServerContainer::class);
5859

5960
return new RenewPasswordController(
60-
$c->getAppName(),
61+
$c->get('AppName'),
6162
$server->getRequest(),
62-
$c->query('UserManager'),
63+
$c->get('UserManager'),
6364
$server->getConfig(),
64-
$c->query(IL10N::class),
65-
$c->query('Session'),
65+
$c->get(IL10N::class),
66+
$c->get('Session'),
6667
$server->getURLGenerator()
6768
);
6869
});
@@ -114,13 +115,15 @@ public function boot(IBootContext $context): void {
114115
);
115116
}
116117

117-
public function registerBackendDependents(IAppContainer $appContainer) {
118-
$appContainer->getServer()->getEventDispatcher()->addListener(
118+
public function registerBackendDependents(ContainerInterface $appContainer) {
119+
/** @var IServerContainer $serverContainer */
120+
$serverContainer = $appContainer->get(IServerContainer::class);
121+
$serverContainer->getEventDispatcher()->addListener(
119122
'OCA\\Files_External::loadAdditionalBackends',
120123
function () use ($appContainer) {
121-
$storagesBackendService = $appContainer->query(BackendService::class);
124+
$storagesBackendService = $appContainer->get(BackendService::class);
122125
$storagesBackendService->registerConfigHandler('home', function () use ($appContainer) {
123-
return $appContainer->query(ExtStorageConfigHandler::class);
126+
return $appContainer->get(ExtStorageConfigHandler::class);
124127
});
125128
}
126129
);

0 commit comments

Comments
 (0)