diff options
author | Carl Schwan <carl@carlschwan.eu> | 2022-06-24 15:24:16 +0200 |
---|---|---|
committer | Carl Schwan <carl@carlschwan.eu> | 2022-06-24 15:39:52 +0200 |
commit | a9cfa72d1cf5eccb352b34eb823559ac52f8e22c (patch) | |
tree | 29335b912f39ca2f780a2c904d4b0cb97c533920 /apps/dav/lib/AppInfo | |
parent | b282fe1e6f5587a6440d170df245ad5acb8dc976 (diff) | |
download | nextcloud-server-a9cfa72d1cf5eccb352b34eb823559ac52f8e22c.tar.gz nextcloud-server-a9cfa72d1cf5eccb352b34eb823559ac52f8e22c.zip |
Summer cleanup of the federation app
- Use IEventDispatcher instead of deprecated symfony dispatcher
- Use LoggerInterface where possible
- Use php 7.4 properties
- Add type hinting where possible
- Move federation hooks to a seperate listener
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Diffstat (limited to 'apps/dav/lib/AppInfo')
-rw-r--r-- | apps/dav/lib/AppInfo/Application.php | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/apps/dav/lib/AppInfo/Application.php b/apps/dav/lib/AppInfo/Application.php index 10f0c52c79c..fe8405e09e2 100644 --- a/apps/dav/lib/AppInfo/Application.php +++ b/apps/dav/lib/AppInfo/Application.php @@ -71,6 +71,7 @@ use OCA\DAV\Events\CardDeletedEvent; use OCA\DAV\Events\CardUpdatedEvent; use OCA\DAV\Events\SubscriptionCreatedEvent; use OCA\DAV\Events\SubscriptionDeletedEvent; +use OCP\Federation\Events\TrustedServerRemovedEvent; use OCA\DAV\HookManager; use OCA\DAV\Listener\ActivityUpdaterListener; use OCA\DAV\Listener\AddressbookListener; @@ -83,6 +84,7 @@ use OCA\DAV\Listener\CalendarShareUpdateListener; use OCA\DAV\Listener\CardListener; use OCA\DAV\Listener\ClearPhotoCacheListener; use OCA\DAV\Listener\SubscriptionListener; +use OCA\DAV\Listener\TrustedServerRemovedListener; use OCA\DAV\Search\ContactsSearchProvider; use OCA\DAV\Search\EventsSearchProvider; use OCA\DAV\Search\TasksSearchProvider; @@ -182,6 +184,7 @@ class Application extends App implements IBootstrap { $context->registerEventListener(CardUpdatedEvent::class, BirthdayListener::class); $context->registerEventListener(CardDeletedEvent::class, ClearPhotoCacheListener::class); $context->registerEventListener(CardUpdatedEvent::class, ClearPhotoCacheListener::class); + $context->registerEventListener(TrustedServerRemovedEvent::class, TrustedServerRemovedListener::class); $context->registerNotifierService(Notifier::class); @@ -235,18 +238,6 @@ class Application extends App implements IBootstrap { // Here we should recalculate if reminders should be sent to new or old sharees }); - $dispatcher->addListener('OCP\Federation\TrustedServerEvent::remove', - function (GenericEvent $event) { - /** @var CardDavBackend $cardDavBackend */ - $cardDavBackend = \OC::$server->query(CardDavBackend::class); - $addressBookUri = $event->getSubject(); - $addressBook = $cardDavBackend->getAddressBooksByUri('principals/system/system', $addressBookUri); - if (!is_null($addressBook)) { - $cardDavBackend->deleteAddressBook($addressBook['id']); - } - } - ); - $eventHandler = function () use ($container, $serverContainer): void { try { /** @var UpdateCalendarResourcesRoomsBackgroundJob $job */ |