diff options
Diffstat (limited to 'apps/dav/appinfo')
-rw-r--r-- | apps/dav/appinfo/app.php | 28 | ||||
-rw-r--r-- | apps/dav/appinfo/info.xml | 1 |
2 files changed, 29 insertions, 0 deletions
diff --git a/apps/dav/appinfo/app.php b/apps/dav/appinfo/app.php index 089aaeb6c78..36b3a39ab17 100644 --- a/apps/dav/appinfo/app.php +++ b/apps/dav/appinfo/app.php @@ -48,6 +48,34 @@ $eventDispatcher->addListener('OCP\Federation\TrustedServerEvent::remove', } ); +$eventDispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::createSubscription', + function(GenericEvent $event) use ($app) { + $jobList = $app->getContainer()->getServer()->getJobList(); + $subscriptionData = $event->getArgument('subscriptionData'); + + $jobList->add(\OCA\DAV\BackgroundJob\RefreshWebcalJob::class, [ + 'principaluri' => $subscriptionData['principaluri'], + 'uri' => $subscriptionData['uri'] + ]); + } +); + +$eventDispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::deleteSubscription', + function(GenericEvent $event) use ($app) { + $jobList = $app->getContainer()->getServer()->getJobList(); + $subscriptionData = $event->getArgument('subscriptionData'); + + $jobList->remove(\OCA\DAV\BackgroundJob\RefreshWebcalJob::class, [ + 'principaluri' => $subscriptionData['principaluri'], + 'uri' => $subscriptionData['uri'] + ]); + + /** @var \OCA\DAV\CalDAV\CalDavBackend $calDavBackend */ + $calDavBackend = $app->getContainer()->query(\OCA\DAV\CalDAV\CalDavBackend::class); + $calDavBackend->purgeAllCachedEventsForSubscription($subscriptionData['id']); + } +); + $eventHandler = function() use ($app) { try { $job = $app->getContainer()->query(\OCA\DAV\BackgroundJob\UpdateCalendarResourcesRoomsBackgroundJob::class); diff --git a/apps/dav/appinfo/info.xml b/apps/dav/appinfo/info.xml index f4fc58e230c..47b6a77c109 100644 --- a/apps/dav/appinfo/info.xml +++ b/apps/dav/appinfo/info.xml @@ -30,6 +30,7 @@ <step>OCA\DAV\Migration\FixBirthdayCalendarComponent</step> <step>OCA\DAV\Migration\CalDAVRemoveEmptyValue</step> <step>OCA\DAV\Migration\BuildCalendarSearchIndex</step> + <step>OCA\DAV\Migration\RefreshWebcalJobRegistrar</step> </post-migration> </repair-steps> |