diff options
author | Georg Ehrke <developer@georgehrke.com> | 2018-06-28 14:07:33 +0300 |
---|---|---|
committer | Georg Ehrke <developer@georgehrke.com> | 2018-11-07 15:25:14 +0300 |
commit | 30d13bb760b233eb4b55b46066deb4bf05d41ce4 (patch) | |
tree | 0d7af03bab6ce7ca549df78eeb2d87163c597320 /apps/dav/appinfo | |
parent | b56cb41e2fc5bd8ec4ef4661009b6feb4c75b7dc (diff) |
cache webcal calendars on server
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
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> |