Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2020-07-16 18:08:03 +0300
committerMorris Jobke <hey@morrisjobke.de>2020-07-21 21:43:18 +0300
commit91e7f12088cb87ffef5660429ece404364167978 (patch)
treebaf44ebc7b240bd49eb0f6bf615cbb1ed99d13db /apps/lookup_server_connector
parente029055e766298c5852eedabf06ff42b06a50198 (diff)
Adjust apps' code to use the ContainerInterface
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/lookup_server_connector')
-rw-r--r--apps/lookup_server_connector/lib/AppInfo/Application.php19
1 files changed, 13 insertions, 6 deletions
diff --git a/apps/lookup_server_connector/lib/AppInfo/Application.php b/apps/lookup_server_connector/lib/AppInfo/Application.php
index c2bb61000c1..df5ddcbab87 100644
--- a/apps/lookup_server_connector/lib/AppInfo/Application.php
+++ b/apps/lookup_server_connector/lib/AppInfo/Application.php
@@ -28,12 +28,15 @@ declare(strict_types=1);
namespace OCA\LookupServerConnector\AppInfo;
+use Closure;
use OCA\LookupServerConnector\UpdateLookupServer;
use OCP\AppFramework\App;
use OCP\AppFramework\Bootstrap\IBootContext;
use OCP\AppFramework\Bootstrap\IBootstrap;
use OCP\AppFramework\Bootstrap\IRegistrationContext;
+use OCP\EventDispatcher\IEventDispatcher;
use OCP\IUser;
+use Psr\Container\ContainerInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
class Application extends App implements IBootstrap {
@@ -47,16 +50,20 @@ class Application extends App implements IBootstrap {
}
public function boot(IBootContext $context): void {
- /*
- * @todo move the OCP events and then move the registration to `register`
- */
- $dispatcher = $context->getServerContainer()->getEventDispatcher();
- $dispatcher->addListener('OC\AccountManager::userUpdated', function (GenericEvent $event) use ($context) {
+ $context->injectFn(Closure::fromCallable([$this, 'registerEventListeners']));
+ }
+
+ /**
+ * @todo move the OCP events and then move the registration to `register`
+ */
+ private function registerEventListeners(IEventDispatcher $dispatcher,
+ ContainerInterface $container): void {
+ $dispatcher->addListener('OC\AccountManager::userUpdated', function (GenericEvent $event) use ($container) {
/** @var IUser $user */
$user = $event->getSubject();
/** @var UpdateLookupServer $updateLookupServer */
- $updateLookupServer = $context->getServerContainer()->query(UpdateLookupServer::class);
+ $updateLookupServer = $container->get(UpdateLookupServer::class);
$updateLookupServer->userUpdated($user);
});
}