Merge pull request #21866 from nextcloud/techdebt/ldap-psr-container

Migrate LDAP to the PSR container
This commit is contained in:
Morris Jobke 2020-07-20 16:28:54 +02:00 committed by GitHub
commit f88a4b5604
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 12 deletions

View File

@ -41,8 +41,9 @@ use OCP\AppFramework\App;
use OCP\AppFramework\Bootstrap\IBootContext; use OCP\AppFramework\Bootstrap\IBootContext;
use OCP\AppFramework\Bootstrap\IBootstrap; use OCP\AppFramework\Bootstrap\IBootstrap;
use OCP\AppFramework\Bootstrap\IRegistrationContext; use OCP\AppFramework\Bootstrap\IRegistrationContext;
use OCP\AppFramework\IAppContainer;
use OCP\IL10N; use OCP\IL10N;
use OCP\IServerContainer;
use Psr\Container\ContainerInterface;
class Application extends App implements IBootstrap { class Application extends App implements IBootstrap {
public function __construct() { public function __construct() {
@ -52,17 +53,17 @@ class Application extends App implements IBootstrap {
/** /**
* Controller * Controller
*/ */
$container->registerService('RenewPasswordController', function (IAppContainer $c) { $container->registerService('RenewPasswordController', function (ContainerInterface $c) {
/** @var \OC\Server $server */ /** @var IServerContainer $server */
$server = $c->query('ServerContainer'); $server = $c->get(IServerContainer::class);
return new RenewPasswordController( return new RenewPasswordController(
$c->getAppName(), $c->get('AppName'),
$server->getRequest(), $server->getRequest(),
$c->query('UserManager'), $c->get('UserManager'),
$server->getConfig(), $server->getConfig(),
$c->query(IL10N::class), $c->get(IL10N::class),
$c->query('Session'), $c->get('Session'),
$server->getURLGenerator() $server->getURLGenerator()
); );
}); });
@ -114,13 +115,15 @@ class Application extends App implements IBootstrap {
); );
} }
public function registerBackendDependents(IAppContainer $appContainer) { public function registerBackendDependents(ContainerInterface $appContainer) {
$appContainer->getServer()->getEventDispatcher()->addListener( /** @var IServerContainer $serverContainer */
$serverContainer = $appContainer->get(IServerContainer::class);
$serverContainer->getEventDispatcher()->addListener(
'OCA\\Files_External::loadAdditionalBackends', 'OCA\\Files_External::loadAdditionalBackends',
function () use ($appContainer) { function () use ($appContainer) {
$storagesBackendService = $appContainer->query(BackendService::class); $storagesBackendService = $appContainer->get(BackendService::class);
$storagesBackendService->registerConfigHandler('home', function () use ($appContainer) { $storagesBackendService->registerConfigHandler('home', function () use ($appContainer) {
return $appContainer->query(ExtStorageConfigHandler::class); return $appContainer->get(ExtStorageConfigHandler::class);
}); });
} }
); );