@@ -6,264 +6,264 @@ |
||
| 6 | 6 | $baseDir = $vendorDir; |
| 7 | 7 | |
| 8 | 8 | return array( |
| 9 | - 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php', |
|
| 10 | - 'OCA\\DAV\\AppInfo\\Application' => $baseDir . '/../lib/AppInfo/Application.php', |
|
| 11 | - 'OCA\\DAV\\AppInfo\\PluginManager' => $baseDir . '/../lib/AppInfo/PluginManager.php', |
|
| 12 | - 'OCA\\DAV\\Avatars\\AvatarHome' => $baseDir . '/../lib/Avatars/AvatarHome.php', |
|
| 13 | - 'OCA\\DAV\\Avatars\\AvatarNode' => $baseDir . '/../lib/Avatars/AvatarNode.php', |
|
| 14 | - 'OCA\\DAV\\Avatars\\RootCollection' => $baseDir . '/../lib/Avatars/RootCollection.php', |
|
| 15 | - 'OCA\\DAV\\BackgroundJob\\BuildReminderIndexBackgroundJob' => $baseDir . '/../lib/BackgroundJob/BuildReminderIndexBackgroundJob.php', |
|
| 16 | - 'OCA\\DAV\\BackgroundJob\\CleanupDirectLinksJob' => $baseDir . '/../lib/BackgroundJob/CleanupDirectLinksJob.php', |
|
| 17 | - 'OCA\\DAV\\BackgroundJob\\CleanupInvitationTokenJob' => $baseDir . '/../lib/BackgroundJob/CleanupInvitationTokenJob.php', |
|
| 18 | - 'OCA\\DAV\\BackgroundJob\\EventReminderJob' => $baseDir . '/../lib/BackgroundJob/EventReminderJob.php', |
|
| 19 | - 'OCA\\DAV\\BackgroundJob\\GenerateBirthdayCalendarBackgroundJob' => $baseDir . '/../lib/BackgroundJob/GenerateBirthdayCalendarBackgroundJob.php', |
|
| 20 | - 'OCA\\DAV\\BackgroundJob\\RefreshWebcalJob' => $baseDir . '/../lib/BackgroundJob/RefreshWebcalJob.php', |
|
| 21 | - 'OCA\\DAV\\BackgroundJob\\RegisterRegenerateBirthdayCalendars' => $baseDir . '/../lib/BackgroundJob/RegisterRegenerateBirthdayCalendars.php', |
|
| 22 | - 'OCA\\DAV\\BackgroundJob\\UpdateCalendarResourcesRoomsBackgroundJob' => $baseDir . '/../lib/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJob.php', |
|
| 23 | - 'OCA\\DAV\\BackgroundJob\\UploadCleanup' => $baseDir . '/../lib/BackgroundJob/UploadCleanup.php', |
|
| 24 | - 'OCA\\DAV\\CalDAV\\Activity\\Backend' => $baseDir . '/../lib/CalDAV/Activity/Backend.php', |
|
| 25 | - 'OCA\\DAV\\CalDAV\\Activity\\Filter\\Calendar' => $baseDir . '/../lib/CalDAV/Activity/Filter/Calendar.php', |
|
| 26 | - 'OCA\\DAV\\CalDAV\\Activity\\Filter\\Todo' => $baseDir . '/../lib/CalDAV/Activity/Filter/Todo.php', |
|
| 27 | - 'OCA\\DAV\\CalDAV\\Activity\\Provider\\Base' => $baseDir . '/../lib/CalDAV/Activity/Provider/Base.php', |
|
| 28 | - 'OCA\\DAV\\CalDAV\\Activity\\Provider\\Calendar' => $baseDir . '/../lib/CalDAV/Activity/Provider/Calendar.php', |
|
| 29 | - 'OCA\\DAV\\CalDAV\\Activity\\Provider\\Event' => $baseDir . '/../lib/CalDAV/Activity/Provider/Event.php', |
|
| 30 | - 'OCA\\DAV\\CalDAV\\Activity\\Provider\\Todo' => $baseDir . '/../lib/CalDAV/Activity/Provider/Todo.php', |
|
| 31 | - 'OCA\\DAV\\CalDAV\\Activity\\Setting\\CalDAVSetting' => $baseDir . '/../lib/CalDAV/Activity/Setting/CalDAVSetting.php', |
|
| 32 | - 'OCA\\DAV\\CalDAV\\Activity\\Setting\\Calendar' => $baseDir . '/../lib/CalDAV/Activity/Setting/Calendar.php', |
|
| 33 | - 'OCA\\DAV\\CalDAV\\Activity\\Setting\\Event' => $baseDir . '/../lib/CalDAV/Activity/Setting/Event.php', |
|
| 34 | - 'OCA\\DAV\\CalDAV\\Activity\\Setting\\Todo' => $baseDir . '/../lib/CalDAV/Activity/Setting/Todo.php', |
|
| 35 | - 'OCA\\DAV\\CalDAV\\BirthdayCalendar\\EnablePlugin' => $baseDir . '/../lib/CalDAV/BirthdayCalendar/EnablePlugin.php', |
|
| 36 | - 'OCA\\DAV\\CalDAV\\BirthdayService' => $baseDir . '/../lib/CalDAV/BirthdayService.php', |
|
| 37 | - 'OCA\\DAV\\CalDAV\\CachedSubscription' => $baseDir . '/../lib/CalDAV/CachedSubscription.php', |
|
| 38 | - 'OCA\\DAV\\CalDAV\\CachedSubscriptionObject' => $baseDir . '/../lib/CalDAV/CachedSubscriptionObject.php', |
|
| 39 | - 'OCA\\DAV\\CalDAV\\CalDavBackend' => $baseDir . '/../lib/CalDAV/CalDavBackend.php', |
|
| 40 | - 'OCA\\DAV\\CalDAV\\Calendar' => $baseDir . '/../lib/CalDAV/Calendar.php', |
|
| 41 | - 'OCA\\DAV\\CalDAV\\CalendarHome' => $baseDir . '/../lib/CalDAV/CalendarHome.php', |
|
| 42 | - 'OCA\\DAV\\CalDAV\\CalendarImpl' => $baseDir . '/../lib/CalDAV/CalendarImpl.php', |
|
| 43 | - 'OCA\\DAV\\CalDAV\\CalendarManager' => $baseDir . '/../lib/CalDAV/CalendarManager.php', |
|
| 44 | - 'OCA\\DAV\\CalDAV\\CalendarObject' => $baseDir . '/../lib/CalDAV/CalendarObject.php', |
|
| 45 | - 'OCA\\DAV\\CalDAV\\CalendarRoot' => $baseDir . '/../lib/CalDAV/CalendarRoot.php', |
|
| 46 | - 'OCA\\DAV\\CalDAV\\ICSExportPlugin\\ICSExportPlugin' => $baseDir . '/../lib/CalDAV/ICSExportPlugin/ICSExportPlugin.php', |
|
| 47 | - 'OCA\\DAV\\CalDAV\\Integration\\ExternalCalendar' => $baseDir . '/../lib/CalDAV/Integration/ExternalCalendar.php', |
|
| 48 | - 'OCA\\DAV\\CalDAV\\Integration\\ICalendarProvider' => $baseDir . '/../lib/CalDAV/Integration/ICalendarProvider.php', |
|
| 49 | - 'OCA\\DAV\\CalDAV\\InvitationResponse\\InvitationResponseServer' => $baseDir . '/../lib/CalDAV/InvitationResponse/InvitationResponseServer.php', |
|
| 50 | - 'OCA\\DAV\\CalDAV\\Outbox' => $baseDir . '/../lib/CalDAV/Outbox.php', |
|
| 51 | - 'OCA\\DAV\\CalDAV\\Plugin' => $baseDir . '/../lib/CalDAV/Plugin.php', |
|
| 52 | - 'OCA\\DAV\\CalDAV\\Principal\\Collection' => $baseDir . '/../lib/CalDAV/Principal/Collection.php', |
|
| 53 | - 'OCA\\DAV\\CalDAV\\Principal\\User' => $baseDir . '/../lib/CalDAV/Principal/User.php', |
|
| 54 | - 'OCA\\DAV\\CalDAV\\Proxy\\Proxy' => $baseDir . '/../lib/CalDAV/Proxy/Proxy.php', |
|
| 55 | - 'OCA\\DAV\\CalDAV\\Proxy\\ProxyMapper' => $baseDir . '/../lib/CalDAV/Proxy/ProxyMapper.php', |
|
| 56 | - 'OCA\\DAV\\CalDAV\\PublicCalendar' => $baseDir . '/../lib/CalDAV/PublicCalendar.php', |
|
| 57 | - 'OCA\\DAV\\CalDAV\\PublicCalendarObject' => $baseDir . '/../lib/CalDAV/PublicCalendarObject.php', |
|
| 58 | - 'OCA\\DAV\\CalDAV\\PublicCalendarRoot' => $baseDir . '/../lib/CalDAV/PublicCalendarRoot.php', |
|
| 59 | - 'OCA\\DAV\\CalDAV\\Publishing\\PublishPlugin' => $baseDir . '/../lib/CalDAV/Publishing/PublishPlugin.php', |
|
| 60 | - 'OCA\\DAV\\CalDAV\\Publishing\\Xml\\Publisher' => $baseDir . '/../lib/CalDAV/Publishing/Xml/Publisher.php', |
|
| 61 | - 'OCA\\DAV\\CalDAV\\Reminder\\Backend' => $baseDir . '/../lib/CalDAV/Reminder/Backend.php', |
|
| 62 | - 'OCA\\DAV\\CalDAV\\Reminder\\INotificationProvider' => $baseDir . '/../lib/CalDAV/Reminder/INotificationProvider.php', |
|
| 63 | - 'OCA\\DAV\\CalDAV\\Reminder\\NotificationProviderManager' => $baseDir . '/../lib/CalDAV/Reminder/NotificationProviderManager.php', |
|
| 64 | - 'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\AbstractProvider' => $baseDir . '/../lib/CalDAV/Reminder/NotificationProvider/AbstractProvider.php', |
|
| 65 | - 'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\AudioProvider' => $baseDir . '/../lib/CalDAV/Reminder/NotificationProvider/AudioProvider.php', |
|
| 66 | - 'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\EmailProvider' => $baseDir . '/../lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php', |
|
| 67 | - 'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\ProviderNotAvailableException' => $baseDir . '/../lib/CalDAV/Reminder/NotificationProvider/ProviderNotAvailableException.php', |
|
| 68 | - 'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\PushProvider' => $baseDir . '/../lib/CalDAV/Reminder/NotificationProvider/PushProvider.php', |
|
| 69 | - 'OCA\\DAV\\CalDAV\\Reminder\\NotificationTypeDoesNotExistException' => $baseDir . '/../lib/CalDAV/Reminder/NotificationTypeDoesNotExistException.php', |
|
| 70 | - 'OCA\\DAV\\CalDAV\\Reminder\\Notifier' => $baseDir . '/../lib/CalDAV/Reminder/Notifier.php', |
|
| 71 | - 'OCA\\DAV\\CalDAV\\Reminder\\ReminderService' => $baseDir . '/../lib/CalDAV/Reminder/ReminderService.php', |
|
| 72 | - 'OCA\\DAV\\CalDAV\\ResourceBooking\\AbstractPrincipalBackend' => $baseDir . '/../lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php', |
|
| 73 | - 'OCA\\DAV\\CalDAV\\ResourceBooking\\ResourcePrincipalBackend' => $baseDir . '/../lib/CalDAV/ResourceBooking/ResourcePrincipalBackend.php', |
|
| 74 | - 'OCA\\DAV\\CalDAV\\ResourceBooking\\RoomPrincipalBackend' => $baseDir . '/../lib/CalDAV/ResourceBooking/RoomPrincipalBackend.php', |
|
| 75 | - 'OCA\\DAV\\CalDAV\\Schedule\\IMipPlugin' => $baseDir . '/../lib/CalDAV/Schedule/IMipPlugin.php', |
|
| 76 | - 'OCA\\DAV\\CalDAV\\Schedule\\Plugin' => $baseDir . '/../lib/CalDAV/Schedule/Plugin.php', |
|
| 77 | - 'OCA\\DAV\\CalDAV\\Search\\SearchPlugin' => $baseDir . '/../lib/CalDAV/Search/SearchPlugin.php', |
|
| 78 | - 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\CompFilter' => $baseDir . '/../lib/CalDAV/Search/Xml/Filter/CompFilter.php', |
|
| 79 | - 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\LimitFilter' => $baseDir . '/../lib/CalDAV/Search/Xml/Filter/LimitFilter.php', |
|
| 80 | - 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\OffsetFilter' => $baseDir . '/../lib/CalDAV/Search/Xml/Filter/OffsetFilter.php', |
|
| 81 | - 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\ParamFilter' => $baseDir . '/../lib/CalDAV/Search/Xml/Filter/ParamFilter.php', |
|
| 82 | - 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\PropFilter' => $baseDir . '/../lib/CalDAV/Search/Xml/Filter/PropFilter.php', |
|
| 83 | - 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\SearchTermFilter' => $baseDir . '/../lib/CalDAV/Search/Xml/Filter/SearchTermFilter.php', |
|
| 84 | - 'OCA\\DAV\\CalDAV\\Search\\Xml\\Request\\CalendarSearchReport' => $baseDir . '/../lib/CalDAV/Search/Xml/Request/CalendarSearchReport.php', |
|
| 85 | - 'OCA\\DAV\\CalDAV\\WebcalCaching\\Plugin' => $baseDir . '/../lib/CalDAV/WebcalCaching/Plugin.php', |
|
| 86 | - 'OCA\\DAV\\CalDAV\\WebcalCaching\\RefreshWebcalService' => $baseDir . '/../lib/CalDAV/WebcalCaching/RefreshWebcalService.php', |
|
| 87 | - 'OCA\\DAV\\Capabilities' => $baseDir . '/../lib/Capabilities.php', |
|
| 88 | - 'OCA\\DAV\\CardDAV\\AddressBook' => $baseDir . '/../lib/CardDAV/AddressBook.php', |
|
| 89 | - 'OCA\\DAV\\CardDAV\\AddressBookImpl' => $baseDir . '/../lib/CardDAV/AddressBookImpl.php', |
|
| 90 | - 'OCA\\DAV\\CardDAV\\AddressBookRoot' => $baseDir . '/../lib/CardDAV/AddressBookRoot.php', |
|
| 91 | - 'OCA\\DAV\\CardDAV\\CardDavBackend' => $baseDir . '/../lib/CardDAV/CardDavBackend.php', |
|
| 92 | - 'OCA\\DAV\\CardDAV\\ContactsManager' => $baseDir . '/../lib/CardDAV/ContactsManager.php', |
|
| 93 | - 'OCA\\DAV\\CardDAV\\Converter' => $baseDir . '/../lib/CardDAV/Converter.php', |
|
| 94 | - 'OCA\\DAV\\CardDAV\\HasPhotoPlugin' => $baseDir . '/../lib/CardDAV/HasPhotoPlugin.php', |
|
| 95 | - 'OCA\\DAV\\CardDAV\\ImageExportPlugin' => $baseDir . '/../lib/CardDAV/ImageExportPlugin.php', |
|
| 96 | - 'OCA\\DAV\\CardDAV\\Integration\\ExternalAddressBook' => $baseDir . '/../lib/CardDAV/Integration/ExternalAddressBook.php', |
|
| 97 | - 'OCA\\DAV\\CardDAV\\Integration\\IAddressBookProvider' => $baseDir . '/../lib/CardDAV/Integration/IAddressBookProvider.php', |
|
| 98 | - 'OCA\\DAV\\CardDAV\\MultiGetExportPlugin' => $baseDir . '/../lib/CardDAV/MultiGetExportPlugin.php', |
|
| 99 | - 'OCA\\DAV\\CardDAV\\PhotoCache' => $baseDir . '/../lib/CardDAV/PhotoCache.php', |
|
| 100 | - 'OCA\\DAV\\CardDAV\\Plugin' => $baseDir . '/../lib/CardDAV/Plugin.php', |
|
| 101 | - 'OCA\\DAV\\CardDAV\\SyncService' => $baseDir . '/../lib/CardDAV/SyncService.php', |
|
| 102 | - 'OCA\\DAV\\CardDAV\\SystemAddressbook' => $baseDir . '/../lib/CardDAV/SystemAddressbook.php', |
|
| 103 | - 'OCA\\DAV\\CardDAV\\UserAddressBooks' => $baseDir . '/../lib/CardDAV/UserAddressBooks.php', |
|
| 104 | - 'OCA\\DAV\\CardDAV\\Xml\\Groups' => $baseDir . '/../lib/CardDAV/Xml/Groups.php', |
|
| 105 | - 'OCA\\DAV\\Command\\CreateAddressBook' => $baseDir . '/../lib/Command/CreateAddressBook.php', |
|
| 106 | - 'OCA\\DAV\\Command\\CreateCalendar' => $baseDir . '/../lib/Command/CreateCalendar.php', |
|
| 107 | - 'OCA\\DAV\\Command\\ListCalendars' => $baseDir . '/../lib/Command/ListCalendars.php', |
|
| 108 | - 'OCA\\DAV\\Command\\MoveCalendar' => $baseDir . '/../lib/Command/MoveCalendar.php', |
|
| 109 | - 'OCA\\DAV\\Command\\RemoveInvalidShares' => $baseDir . '/../lib/Command/RemoveInvalidShares.php', |
|
| 110 | - 'OCA\\DAV\\Command\\SendEventReminders' => $baseDir . '/../lib/Command/SendEventReminders.php', |
|
| 111 | - 'OCA\\DAV\\Command\\SyncBirthdayCalendar' => $baseDir . '/../lib/Command/SyncBirthdayCalendar.php', |
|
| 112 | - 'OCA\\DAV\\Command\\SyncSystemAddressBook' => $baseDir . '/../lib/Command/SyncSystemAddressBook.php', |
|
| 113 | - 'OCA\\DAV\\Comments\\CommentNode' => $baseDir . '/../lib/Comments/CommentNode.php', |
|
| 114 | - 'OCA\\DAV\\Comments\\CommentsPlugin' => $baseDir . '/../lib/Comments/CommentsPlugin.php', |
|
| 115 | - 'OCA\\DAV\\Comments\\EntityCollection' => $baseDir . '/../lib/Comments/EntityCollection.php', |
|
| 116 | - 'OCA\\DAV\\Comments\\EntityTypeCollection' => $baseDir . '/../lib/Comments/EntityTypeCollection.php', |
|
| 117 | - 'OCA\\DAV\\Comments\\RootCollection' => $baseDir . '/../lib/Comments/RootCollection.php', |
|
| 118 | - 'OCA\\DAV\\Connector\\LegacyDAVACL' => $baseDir . '/../lib/Connector/LegacyDAVACL.php', |
|
| 119 | - 'OCA\\DAV\\Connector\\PublicAuth' => $baseDir . '/../lib/Connector/PublicAuth.php', |
|
| 120 | - 'OCA\\DAV\\Connector\\Sabre\\AnonymousOptionsPlugin' => $baseDir . '/../lib/Connector/Sabre/AnonymousOptionsPlugin.php', |
|
| 121 | - 'OCA\\DAV\\Connector\\Sabre\\AppEnabledPlugin' => $baseDir . '/../lib/Connector/Sabre/AppEnabledPlugin.php', |
|
| 122 | - 'OCA\\DAV\\Connector\\Sabre\\Auth' => $baseDir . '/../lib/Connector/Sabre/Auth.php', |
|
| 123 | - 'OCA\\DAV\\Connector\\Sabre\\BearerAuth' => $baseDir . '/../lib/Connector/Sabre/BearerAuth.php', |
|
| 124 | - 'OCA\\DAV\\Connector\\Sabre\\BlockLegacyClientPlugin' => $baseDir . '/../lib/Connector/Sabre/BlockLegacyClientPlugin.php', |
|
| 125 | - 'OCA\\DAV\\Connector\\Sabre\\CachingTree' => $baseDir . '/../lib/Connector/Sabre/CachingTree.php', |
|
| 126 | - 'OCA\\DAV\\Connector\\Sabre\\ChecksumList' => $baseDir . '/../lib/Connector/Sabre/ChecksumList.php', |
|
| 127 | - 'OCA\\DAV\\Connector\\Sabre\\CommentPropertiesPlugin' => $baseDir . '/../lib/Connector/Sabre/CommentPropertiesPlugin.php', |
|
| 128 | - 'OCA\\DAV\\Connector\\Sabre\\CopyEtagHeaderPlugin' => $baseDir . '/../lib/Connector/Sabre/CopyEtagHeaderPlugin.php', |
|
| 129 | - 'OCA\\DAV\\Connector\\Sabre\\DavAclPlugin' => $baseDir . '/../lib/Connector/Sabre/DavAclPlugin.php', |
|
| 130 | - 'OCA\\DAV\\Connector\\Sabre\\Directory' => $baseDir . '/../lib/Connector/Sabre/Directory.php', |
|
| 131 | - 'OCA\\DAV\\Connector\\Sabre\\DummyGetResponsePlugin' => $baseDir . '/../lib/Connector/Sabre/DummyGetResponsePlugin.php', |
|
| 132 | - 'OCA\\DAV\\Connector\\Sabre\\ExceptionLoggerPlugin' => $baseDir . '/../lib/Connector/Sabre/ExceptionLoggerPlugin.php', |
|
| 133 | - 'OCA\\DAV\\Connector\\Sabre\\Exception\\EntityTooLarge' => $baseDir . '/../lib/Connector/Sabre/Exception/EntityTooLarge.php', |
|
| 134 | - 'OCA\\DAV\\Connector\\Sabre\\Exception\\FileLocked' => $baseDir . '/../lib/Connector/Sabre/Exception/FileLocked.php', |
|
| 135 | - 'OCA\\DAV\\Connector\\Sabre\\Exception\\Forbidden' => $baseDir . '/../lib/Connector/Sabre/Exception/Forbidden.php', |
|
| 136 | - 'OCA\\DAV\\Connector\\Sabre\\Exception\\InvalidPath' => $baseDir . '/../lib/Connector/Sabre/Exception/InvalidPath.php', |
|
| 137 | - 'OCA\\DAV\\Connector\\Sabre\\Exception\\PasswordLoginForbidden' => $baseDir . '/../lib/Connector/Sabre/Exception/PasswordLoginForbidden.php', |
|
| 138 | - 'OCA\\DAV\\Connector\\Sabre\\Exception\\UnsupportedMediaType' => $baseDir . '/../lib/Connector/Sabre/Exception/UnsupportedMediaType.php', |
|
| 139 | - 'OCA\\DAV\\Connector\\Sabre\\FakeLockerPlugin' => $baseDir . '/../lib/Connector/Sabre/FakeLockerPlugin.php', |
|
| 140 | - 'OCA\\DAV\\Connector\\Sabre\\File' => $baseDir . '/../lib/Connector/Sabre/File.php', |
|
| 141 | - 'OCA\\DAV\\Connector\\Sabre\\FilesPlugin' => $baseDir . '/../lib/Connector/Sabre/FilesPlugin.php', |
|
| 142 | - 'OCA\\DAV\\Connector\\Sabre\\FilesReportPlugin' => $baseDir . '/../lib/Connector/Sabre/FilesReportPlugin.php', |
|
| 143 | - 'OCA\\DAV\\Connector\\Sabre\\LockPlugin' => $baseDir . '/../lib/Connector/Sabre/LockPlugin.php', |
|
| 144 | - 'OCA\\DAV\\Connector\\Sabre\\MaintenancePlugin' => $baseDir . '/../lib/Connector/Sabre/MaintenancePlugin.php', |
|
| 145 | - 'OCA\\DAV\\Connector\\Sabre\\Node' => $baseDir . '/../lib/Connector/Sabre/Node.php', |
|
| 146 | - 'OCA\\DAV\\Connector\\Sabre\\ObjectTree' => $baseDir . '/../lib/Connector/Sabre/ObjectTree.php', |
|
| 147 | - 'OCA\\DAV\\Connector\\Sabre\\Principal' => $baseDir . '/../lib/Connector/Sabre/Principal.php', |
|
| 148 | - 'OCA\\DAV\\Connector\\Sabre\\PropfindCompressionPlugin' => $baseDir . '/../lib/Connector/Sabre/PropfindCompressionPlugin.php', |
|
| 149 | - 'OCA\\DAV\\Connector\\Sabre\\QuotaPlugin' => $baseDir . '/../lib/Connector/Sabre/QuotaPlugin.php', |
|
| 150 | - 'OCA\\DAV\\Connector\\Sabre\\Server' => $baseDir . '/../lib/Connector/Sabre/Server.php', |
|
| 151 | - 'OCA\\DAV\\Connector\\Sabre\\ServerFactory' => $baseDir . '/../lib/Connector/Sabre/ServerFactory.php', |
|
| 152 | - 'OCA\\DAV\\Connector\\Sabre\\ShareTypeList' => $baseDir . '/../lib/Connector/Sabre/ShareTypeList.php', |
|
| 153 | - 'OCA\\DAV\\Connector\\Sabre\\ShareeList' => $baseDir . '/../lib/Connector/Sabre/ShareeList.php', |
|
| 154 | - 'OCA\\DAV\\Connector\\Sabre\\SharesPlugin' => $baseDir . '/../lib/Connector/Sabre/SharesPlugin.php', |
|
| 155 | - 'OCA\\DAV\\Connector\\Sabre\\TagList' => $baseDir . '/../lib/Connector/Sabre/TagList.php', |
|
| 156 | - 'OCA\\DAV\\Connector\\Sabre\\TagsPlugin' => $baseDir . '/../lib/Connector/Sabre/TagsPlugin.php', |
|
| 157 | - 'OCA\\DAV\\Controller\\BirthdayCalendarController' => $baseDir . '/../lib/Controller/BirthdayCalendarController.php', |
|
| 158 | - 'OCA\\DAV\\Controller\\DirectController' => $baseDir . '/../lib/Controller/DirectController.php', |
|
| 159 | - 'OCA\\DAV\\Controller\\InvitationResponseController' => $baseDir . '/../lib/Controller/InvitationResponseController.php', |
|
| 160 | - 'OCA\\DAV\\DAV\\CustomPropertiesBackend' => $baseDir . '/../lib/DAV/CustomPropertiesBackend.php', |
|
| 161 | - 'OCA\\DAV\\DAV\\GroupPrincipalBackend' => $baseDir . '/../lib/DAV/GroupPrincipalBackend.php', |
|
| 162 | - 'OCA\\DAV\\DAV\\PublicAuth' => $baseDir . '/../lib/DAV/PublicAuth.php', |
|
| 163 | - 'OCA\\DAV\\DAV\\Sharing\\Backend' => $baseDir . '/../lib/DAV/Sharing/Backend.php', |
|
| 164 | - 'OCA\\DAV\\DAV\\Sharing\\IShareable' => $baseDir . '/../lib/DAV/Sharing/IShareable.php', |
|
| 165 | - 'OCA\\DAV\\DAV\\Sharing\\Plugin' => $baseDir . '/../lib/DAV/Sharing/Plugin.php', |
|
| 166 | - 'OCA\\DAV\\DAV\\Sharing\\Xml\\Invite' => $baseDir . '/../lib/DAV/Sharing/Xml/Invite.php', |
|
| 167 | - 'OCA\\DAV\\DAV\\Sharing\\Xml\\ShareRequest' => $baseDir . '/../lib/DAV/Sharing/Xml/ShareRequest.php', |
|
| 168 | - 'OCA\\DAV\\DAV\\SystemPrincipalBackend' => $baseDir . '/../lib/DAV/SystemPrincipalBackend.php', |
|
| 169 | - 'OCA\\DAV\\Db\\Direct' => $baseDir . '/../lib/Db/Direct.php', |
|
| 170 | - 'OCA\\DAV\\Db\\DirectMapper' => $baseDir . '/../lib/Db/DirectMapper.php', |
|
| 171 | - 'OCA\\DAV\\Direct\\DirectFile' => $baseDir . '/../lib/Direct/DirectFile.php', |
|
| 172 | - 'OCA\\DAV\\Direct\\DirectHome' => $baseDir . '/../lib/Direct/DirectHome.php', |
|
| 173 | - 'OCA\\DAV\\Direct\\Server' => $baseDir . '/../lib/Direct/Server.php', |
|
| 174 | - 'OCA\\DAV\\Direct\\ServerFactory' => $baseDir . '/../lib/Direct/ServerFactory.php', |
|
| 175 | - 'OCA\\DAV\\Events\\AddressBookCreatedEvent' => $baseDir . '/../lib/Events/AddressBookCreatedEvent.php', |
|
| 176 | - 'OCA\\DAV\\Events\\AddressBookDeletedEvent' => $baseDir . '/../lib/Events/AddressBookDeletedEvent.php', |
|
| 177 | - 'OCA\\DAV\\Events\\AddressBookShareUpdatedEvent' => $baseDir . '/../lib/Events/AddressBookShareUpdatedEvent.php', |
|
| 178 | - 'OCA\\DAV\\Events\\AddressBookUpdatedEvent' => $baseDir . '/../lib/Events/AddressBookUpdatedEvent.php', |
|
| 179 | - 'OCA\\DAV\\Events\\BeforeFileDirectDownloadedEvent' => $baseDir . '/../lib/Events/BeforeFileDirectDownloadedEvent.php', |
|
| 180 | - 'OCA\\DAV\\Events\\CachedCalendarObjectCreatedEvent' => $baseDir . '/../lib/Events/CachedCalendarObjectCreatedEvent.php', |
|
| 181 | - 'OCA\\DAV\\Events\\CachedCalendarObjectDeletedEvent' => $baseDir . '/../lib/Events/CachedCalendarObjectDeletedEvent.php', |
|
| 182 | - 'OCA\\DAV\\Events\\CachedCalendarObjectUpdatedEvent' => $baseDir . '/../lib/Events/CachedCalendarObjectUpdatedEvent.php', |
|
| 183 | - 'OCA\\DAV\\Events\\CalendarCreatedEvent' => $baseDir . '/../lib/Events/CalendarCreatedEvent.php', |
|
| 184 | - 'OCA\\DAV\\Events\\CalendarDeletedEvent' => $baseDir . '/../lib/Events/CalendarDeletedEvent.php', |
|
| 185 | - 'OCA\\DAV\\Events\\CalendarObjectCreatedEvent' => $baseDir . '/../lib/Events/CalendarObjectCreatedEvent.php', |
|
| 186 | - 'OCA\\DAV\\Events\\CalendarObjectDeletedEvent' => $baseDir . '/../lib/Events/CalendarObjectDeletedEvent.php', |
|
| 187 | - 'OCA\\DAV\\Events\\CalendarObjectUpdatedEvent' => $baseDir . '/../lib/Events/CalendarObjectUpdatedEvent.php', |
|
| 188 | - 'OCA\\DAV\\Events\\CalendarPublishedEvent' => $baseDir . '/../lib/Events/CalendarPublishedEvent.php', |
|
| 189 | - 'OCA\\DAV\\Events\\CalendarShareUpdatedEvent' => $baseDir . '/../lib/Events/CalendarShareUpdatedEvent.php', |
|
| 190 | - 'OCA\\DAV\\Events\\CalendarUnpublishedEvent' => $baseDir . '/../lib/Events/CalendarUnpublishedEvent.php', |
|
| 191 | - 'OCA\\DAV\\Events\\CalendarUpdatedEvent' => $baseDir . '/../lib/Events/CalendarUpdatedEvent.php', |
|
| 192 | - 'OCA\\DAV\\Events\\CardCreatedEvent' => $baseDir . '/../lib/Events/CardCreatedEvent.php', |
|
| 193 | - 'OCA\\DAV\\Events\\CardDeletedEvent' => $baseDir . '/../lib/Events/CardDeletedEvent.php', |
|
| 194 | - 'OCA\\DAV\\Events\\CardUpdatedEvent' => $baseDir . '/../lib/Events/CardUpdatedEvent.php', |
|
| 195 | - 'OCA\\DAV\\Events\\SabrePluginAuthInitEvent' => $baseDir . '/../lib/Events/SabrePluginAuthInitEvent.php', |
|
| 196 | - 'OCA\\DAV\\Events\\SubscriptionCreatedEvent' => $baseDir . '/../lib/Events/SubscriptionCreatedEvent.php', |
|
| 197 | - 'OCA\\DAV\\Events\\SubscriptionDeletedEvent' => $baseDir . '/../lib/Events/SubscriptionDeletedEvent.php', |
|
| 198 | - 'OCA\\DAV\\Events\\SubscriptionUpdatedEvent' => $baseDir . '/../lib/Events/SubscriptionUpdatedEvent.php', |
|
| 199 | - 'OCA\\DAV\\Exception\\UnsupportedLimitOnInitialSyncException' => $baseDir . '/../lib/Exception/UnsupportedLimitOnInitialSyncException.php', |
|
| 200 | - 'OCA\\DAV\\Files\\BrowserErrorPagePlugin' => $baseDir . '/../lib/Files/BrowserErrorPagePlugin.php', |
|
| 201 | - 'OCA\\DAV\\Files\\FileSearchBackend' => $baseDir . '/../lib/Files/FileSearchBackend.php', |
|
| 202 | - 'OCA\\DAV\\Files\\FilesHome' => $baseDir . '/../lib/Files/FilesHome.php', |
|
| 203 | - 'OCA\\DAV\\Files\\LazySearchBackend' => $baseDir . '/../lib/Files/LazySearchBackend.php', |
|
| 204 | - 'OCA\\DAV\\Files\\RootCollection' => $baseDir . '/../lib/Files/RootCollection.php', |
|
| 205 | - 'OCA\\DAV\\Files\\Sharing\\FilesDropPlugin' => $baseDir . '/../lib/Files/Sharing/FilesDropPlugin.php', |
|
| 206 | - 'OCA\\DAV\\Files\\Sharing\\PublicLinkCheckPlugin' => $baseDir . '/../lib/Files/Sharing/PublicLinkCheckPlugin.php', |
|
| 207 | - 'OCA\\DAV\\HookManager' => $baseDir . '/../lib/HookManager.php', |
|
| 208 | - 'OCA\\DAV\\Listener\\ActivityUpdaterListener' => $baseDir . '/../lib/Listener/ActivityUpdaterListener.php', |
|
| 209 | - 'OCA\\DAV\\Listener\\CalendarContactInteractionListener' => $baseDir . '/../lib/Listener/CalendarContactInteractionListener.php', |
|
| 210 | - 'OCA\\DAV\\Listener\\CalendarDeletionDefaultUpdaterListener' => $baseDir . '/../lib/Listener/CalendarDeletionDefaultUpdaterListener.php', |
|
| 211 | - 'OCA\\DAV\\Listener\\CalendarObjectReminderUpdaterListener' => $baseDir . '/../lib/Listener/CalendarObjectReminderUpdaterListener.php', |
|
| 212 | - 'OCA\\DAV\\Migration\\BuildCalendarSearchIndex' => $baseDir . '/../lib/Migration/BuildCalendarSearchIndex.php', |
|
| 213 | - 'OCA\\DAV\\Migration\\BuildCalendarSearchIndexBackgroundJob' => $baseDir . '/../lib/Migration/BuildCalendarSearchIndexBackgroundJob.php', |
|
| 214 | - 'OCA\\DAV\\Migration\\BuildSocialSearchIndex' => $baseDir . '/../lib/Migration/BuildSocialSearchIndex.php', |
|
| 215 | - 'OCA\\DAV\\Migration\\BuildSocialSearchIndexBackgroundJob' => $baseDir . '/../lib/Migration/BuildSocialSearchIndexBackgroundJob.php', |
|
| 216 | - 'OCA\\DAV\\Migration\\CalDAVRemoveEmptyValue' => $baseDir . '/../lib/Migration/CalDAVRemoveEmptyValue.php', |
|
| 217 | - 'OCA\\DAV\\Migration\\ChunkCleanup' => $baseDir . '/../lib/Migration/ChunkCleanup.php', |
|
| 218 | - 'OCA\\DAV\\Migration\\FixBirthdayCalendarComponent' => $baseDir . '/../lib/Migration/FixBirthdayCalendarComponent.php', |
|
| 219 | - 'OCA\\DAV\\Migration\\RefreshWebcalJobRegistrar' => $baseDir . '/../lib/Migration/RefreshWebcalJobRegistrar.php', |
|
| 220 | - 'OCA\\DAV\\Migration\\RegenerateBirthdayCalendars' => $baseDir . '/../lib/Migration/RegenerateBirthdayCalendars.php', |
|
| 221 | - 'OCA\\DAV\\Migration\\RegisterBuildReminderIndexBackgroundJob' => $baseDir . '/../lib/Migration/RegisterBuildReminderIndexBackgroundJob.php', |
|
| 222 | - 'OCA\\DAV\\Migration\\RemoveClassifiedEventActivity' => $baseDir . '/../lib/Migration/RemoveClassifiedEventActivity.php', |
|
| 223 | - 'OCA\\DAV\\Migration\\RemoveOrphanEventsAndContacts' => $baseDir . '/../lib/Migration/RemoveOrphanEventsAndContacts.php', |
|
| 224 | - 'OCA\\DAV\\Migration\\Version1004Date20170825134824' => $baseDir . '/../lib/Migration/Version1004Date20170825134824.php', |
|
| 225 | - 'OCA\\DAV\\Migration\\Version1004Date20170919104507' => $baseDir . '/../lib/Migration/Version1004Date20170919104507.php', |
|
| 226 | - 'OCA\\DAV\\Migration\\Version1004Date20170924124212' => $baseDir . '/../lib/Migration/Version1004Date20170924124212.php', |
|
| 227 | - 'OCA\\DAV\\Migration\\Version1004Date20170926103422' => $baseDir . '/../lib/Migration/Version1004Date20170926103422.php', |
|
| 228 | - 'OCA\\DAV\\Migration\\Version1005Date20180413093149' => $baseDir . '/../lib/Migration/Version1005Date20180413093149.php', |
|
| 229 | - 'OCA\\DAV\\Migration\\Version1005Date20180530124431' => $baseDir . '/../lib/Migration/Version1005Date20180530124431.php', |
|
| 230 | - 'OCA\\DAV\\Migration\\Version1006Date20180619154313' => $baseDir . '/../lib/Migration/Version1006Date20180619154313.php', |
|
| 231 | - 'OCA\\DAV\\Migration\\Version1006Date20180628111625' => $baseDir . '/../lib/Migration/Version1006Date20180628111625.php', |
|
| 232 | - 'OCA\\DAV\\Migration\\Version1008Date20181030113700' => $baseDir . '/../lib/Migration/Version1008Date20181030113700.php', |
|
| 233 | - 'OCA\\DAV\\Migration\\Version1008Date20181105104826' => $baseDir . '/../lib/Migration/Version1008Date20181105104826.php', |
|
| 234 | - 'OCA\\DAV\\Migration\\Version1008Date20181105104833' => $baseDir . '/../lib/Migration/Version1008Date20181105104833.php', |
|
| 235 | - 'OCA\\DAV\\Migration\\Version1008Date20181105110300' => $baseDir . '/../lib/Migration/Version1008Date20181105110300.php', |
|
| 236 | - 'OCA\\DAV\\Migration\\Version1008Date20181105112049' => $baseDir . '/../lib/Migration/Version1008Date20181105112049.php', |
|
| 237 | - 'OCA\\DAV\\Migration\\Version1008Date20181114084440' => $baseDir . '/../lib/Migration/Version1008Date20181114084440.php', |
|
| 238 | - 'OCA\\DAV\\Migration\\Version1011Date20190725113607' => $baseDir . '/../lib/Migration/Version1011Date20190725113607.php', |
|
| 239 | - 'OCA\\DAV\\Migration\\Version1011Date20190806104428' => $baseDir . '/../lib/Migration/Version1011Date20190806104428.php', |
|
| 240 | - 'OCA\\DAV\\Migration\\Version1012Date20190808122342' => $baseDir . '/../lib/Migration/Version1012Date20190808122342.php', |
|
| 241 | - 'OCA\\DAV\\Migration\\Version1016Date20201109085907' => $baseDir . '/../lib/Migration/Version1016Date20201109085907.php', |
|
| 242 | - 'OCA\\DAV\\Migration\\Version1017Date20210216083742' => $baseDir . '/../lib/Migration/Version1017Date20210216083742.php', |
|
| 243 | - 'OCA\\DAV\\Provisioning\\Apple\\AppleProvisioningNode' => $baseDir . '/../lib/Provisioning/Apple/AppleProvisioningNode.php', |
|
| 244 | - 'OCA\\DAV\\Provisioning\\Apple\\AppleProvisioningPlugin' => $baseDir . '/../lib/Provisioning/Apple/AppleProvisioningPlugin.php', |
|
| 245 | - 'OCA\\DAV\\RootCollection' => $baseDir . '/../lib/RootCollection.php', |
|
| 246 | - 'OCA\\DAV\\Search\\ACalendarSearchProvider' => $baseDir . '/../lib/Search/ACalendarSearchProvider.php', |
|
| 247 | - 'OCA\\DAV\\Search\\ContactsSearchProvider' => $baseDir . '/../lib/Search/ContactsSearchProvider.php', |
|
| 248 | - 'OCA\\DAV\\Search\\EventsSearchProvider' => $baseDir . '/../lib/Search/EventsSearchProvider.php', |
|
| 249 | - 'OCA\\DAV\\Search\\TasksSearchProvider' => $baseDir . '/../lib/Search/TasksSearchProvider.php', |
|
| 250 | - 'OCA\\DAV\\Server' => $baseDir . '/../lib/Server.php', |
|
| 251 | - 'OCA\\DAV\\Settings\\CalDAVSettings' => $baseDir . '/../lib/Settings/CalDAVSettings.php', |
|
| 252 | - 'OCA\\DAV\\Storage\\PublicOwnerWrapper' => $baseDir . '/../lib/Storage/PublicOwnerWrapper.php', |
|
| 253 | - 'OCA\\DAV\\SystemTag\\SystemTagMappingNode' => $baseDir . '/../lib/SystemTag/SystemTagMappingNode.php', |
|
| 254 | - 'OCA\\DAV\\SystemTag\\SystemTagNode' => $baseDir . '/../lib/SystemTag/SystemTagNode.php', |
|
| 255 | - 'OCA\\DAV\\SystemTag\\SystemTagPlugin' => $baseDir . '/../lib/SystemTag/SystemTagPlugin.php', |
|
| 256 | - 'OCA\\DAV\\SystemTag\\SystemTagsByIdCollection' => $baseDir . '/../lib/SystemTag/SystemTagsByIdCollection.php', |
|
| 257 | - 'OCA\\DAV\\SystemTag\\SystemTagsObjectMappingCollection' => $baseDir . '/../lib/SystemTag/SystemTagsObjectMappingCollection.php', |
|
| 258 | - 'OCA\\DAV\\SystemTag\\SystemTagsObjectTypeCollection' => $baseDir . '/../lib/SystemTag/SystemTagsObjectTypeCollection.php', |
|
| 259 | - 'OCA\\DAV\\SystemTag\\SystemTagsRelationsCollection' => $baseDir . '/../lib/SystemTag/SystemTagsRelationsCollection.php', |
|
| 260 | - 'OCA\\DAV\\Traits\\PrincipalProxyTrait' => $baseDir . '/../lib/Traits/PrincipalProxyTrait.php', |
|
| 261 | - 'OCA\\DAV\\Upload\\AssemblyStream' => $baseDir . '/../lib/Upload/AssemblyStream.php', |
|
| 262 | - 'OCA\\DAV\\Upload\\ChunkingPlugin' => $baseDir . '/../lib/Upload/ChunkingPlugin.php', |
|
| 263 | - 'OCA\\DAV\\Upload\\CleanupService' => $baseDir . '/../lib/Upload/CleanupService.php', |
|
| 264 | - 'OCA\\DAV\\Upload\\FutureFile' => $baseDir . '/../lib/Upload/FutureFile.php', |
|
| 265 | - 'OCA\\DAV\\Upload\\RootCollection' => $baseDir . '/../lib/Upload/RootCollection.php', |
|
| 266 | - 'OCA\\DAV\\Upload\\UploadFile' => $baseDir . '/../lib/Upload/UploadFile.php', |
|
| 267 | - 'OCA\\DAV\\Upload\\UploadFolder' => $baseDir . '/../lib/Upload/UploadFolder.php', |
|
| 268 | - 'OCA\\DAV\\Upload\\UploadHome' => $baseDir . '/../lib/Upload/UploadHome.php', |
|
| 9 | + 'Composer\\InstalledVersions' => $vendorDir.'/composer/InstalledVersions.php', |
|
| 10 | + 'OCA\\DAV\\AppInfo\\Application' => $baseDir.'/../lib/AppInfo/Application.php', |
|
| 11 | + 'OCA\\DAV\\AppInfo\\PluginManager' => $baseDir.'/../lib/AppInfo/PluginManager.php', |
|
| 12 | + 'OCA\\DAV\\Avatars\\AvatarHome' => $baseDir.'/../lib/Avatars/AvatarHome.php', |
|
| 13 | + 'OCA\\DAV\\Avatars\\AvatarNode' => $baseDir.'/../lib/Avatars/AvatarNode.php', |
|
| 14 | + 'OCA\\DAV\\Avatars\\RootCollection' => $baseDir.'/../lib/Avatars/RootCollection.php', |
|
| 15 | + 'OCA\\DAV\\BackgroundJob\\BuildReminderIndexBackgroundJob' => $baseDir.'/../lib/BackgroundJob/BuildReminderIndexBackgroundJob.php', |
|
| 16 | + 'OCA\\DAV\\BackgroundJob\\CleanupDirectLinksJob' => $baseDir.'/../lib/BackgroundJob/CleanupDirectLinksJob.php', |
|
| 17 | + 'OCA\\DAV\\BackgroundJob\\CleanupInvitationTokenJob' => $baseDir.'/../lib/BackgroundJob/CleanupInvitationTokenJob.php', |
|
| 18 | + 'OCA\\DAV\\BackgroundJob\\EventReminderJob' => $baseDir.'/../lib/BackgroundJob/EventReminderJob.php', |
|
| 19 | + 'OCA\\DAV\\BackgroundJob\\GenerateBirthdayCalendarBackgroundJob' => $baseDir.'/../lib/BackgroundJob/GenerateBirthdayCalendarBackgroundJob.php', |
|
| 20 | + 'OCA\\DAV\\BackgroundJob\\RefreshWebcalJob' => $baseDir.'/../lib/BackgroundJob/RefreshWebcalJob.php', |
|
| 21 | + 'OCA\\DAV\\BackgroundJob\\RegisterRegenerateBirthdayCalendars' => $baseDir.'/../lib/BackgroundJob/RegisterRegenerateBirthdayCalendars.php', |
|
| 22 | + 'OCA\\DAV\\BackgroundJob\\UpdateCalendarResourcesRoomsBackgroundJob' => $baseDir.'/../lib/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJob.php', |
|
| 23 | + 'OCA\\DAV\\BackgroundJob\\UploadCleanup' => $baseDir.'/../lib/BackgroundJob/UploadCleanup.php', |
|
| 24 | + 'OCA\\DAV\\CalDAV\\Activity\\Backend' => $baseDir.'/../lib/CalDAV/Activity/Backend.php', |
|
| 25 | + 'OCA\\DAV\\CalDAV\\Activity\\Filter\\Calendar' => $baseDir.'/../lib/CalDAV/Activity/Filter/Calendar.php', |
|
| 26 | + 'OCA\\DAV\\CalDAV\\Activity\\Filter\\Todo' => $baseDir.'/../lib/CalDAV/Activity/Filter/Todo.php', |
|
| 27 | + 'OCA\\DAV\\CalDAV\\Activity\\Provider\\Base' => $baseDir.'/../lib/CalDAV/Activity/Provider/Base.php', |
|
| 28 | + 'OCA\\DAV\\CalDAV\\Activity\\Provider\\Calendar' => $baseDir.'/../lib/CalDAV/Activity/Provider/Calendar.php', |
|
| 29 | + 'OCA\\DAV\\CalDAV\\Activity\\Provider\\Event' => $baseDir.'/../lib/CalDAV/Activity/Provider/Event.php', |
|
| 30 | + 'OCA\\DAV\\CalDAV\\Activity\\Provider\\Todo' => $baseDir.'/../lib/CalDAV/Activity/Provider/Todo.php', |
|
| 31 | + 'OCA\\DAV\\CalDAV\\Activity\\Setting\\CalDAVSetting' => $baseDir.'/../lib/CalDAV/Activity/Setting/CalDAVSetting.php', |
|
| 32 | + 'OCA\\DAV\\CalDAV\\Activity\\Setting\\Calendar' => $baseDir.'/../lib/CalDAV/Activity/Setting/Calendar.php', |
|
| 33 | + 'OCA\\DAV\\CalDAV\\Activity\\Setting\\Event' => $baseDir.'/../lib/CalDAV/Activity/Setting/Event.php', |
|
| 34 | + 'OCA\\DAV\\CalDAV\\Activity\\Setting\\Todo' => $baseDir.'/../lib/CalDAV/Activity/Setting/Todo.php', |
|
| 35 | + 'OCA\\DAV\\CalDAV\\BirthdayCalendar\\EnablePlugin' => $baseDir.'/../lib/CalDAV/BirthdayCalendar/EnablePlugin.php', |
|
| 36 | + 'OCA\\DAV\\CalDAV\\BirthdayService' => $baseDir.'/../lib/CalDAV/BirthdayService.php', |
|
| 37 | + 'OCA\\DAV\\CalDAV\\CachedSubscription' => $baseDir.'/../lib/CalDAV/CachedSubscription.php', |
|
| 38 | + 'OCA\\DAV\\CalDAV\\CachedSubscriptionObject' => $baseDir.'/../lib/CalDAV/CachedSubscriptionObject.php', |
|
| 39 | + 'OCA\\DAV\\CalDAV\\CalDavBackend' => $baseDir.'/../lib/CalDAV/CalDavBackend.php', |
|
| 40 | + 'OCA\\DAV\\CalDAV\\Calendar' => $baseDir.'/../lib/CalDAV/Calendar.php', |
|
| 41 | + 'OCA\\DAV\\CalDAV\\CalendarHome' => $baseDir.'/../lib/CalDAV/CalendarHome.php', |
|
| 42 | + 'OCA\\DAV\\CalDAV\\CalendarImpl' => $baseDir.'/../lib/CalDAV/CalendarImpl.php', |
|
| 43 | + 'OCA\\DAV\\CalDAV\\CalendarManager' => $baseDir.'/../lib/CalDAV/CalendarManager.php', |
|
| 44 | + 'OCA\\DAV\\CalDAV\\CalendarObject' => $baseDir.'/../lib/CalDAV/CalendarObject.php', |
|
| 45 | + 'OCA\\DAV\\CalDAV\\CalendarRoot' => $baseDir.'/../lib/CalDAV/CalendarRoot.php', |
|
| 46 | + 'OCA\\DAV\\CalDAV\\ICSExportPlugin\\ICSExportPlugin' => $baseDir.'/../lib/CalDAV/ICSExportPlugin/ICSExportPlugin.php', |
|
| 47 | + 'OCA\\DAV\\CalDAV\\Integration\\ExternalCalendar' => $baseDir.'/../lib/CalDAV/Integration/ExternalCalendar.php', |
|
| 48 | + 'OCA\\DAV\\CalDAV\\Integration\\ICalendarProvider' => $baseDir.'/../lib/CalDAV/Integration/ICalendarProvider.php', |
|
| 49 | + 'OCA\\DAV\\CalDAV\\InvitationResponse\\InvitationResponseServer' => $baseDir.'/../lib/CalDAV/InvitationResponse/InvitationResponseServer.php', |
|
| 50 | + 'OCA\\DAV\\CalDAV\\Outbox' => $baseDir.'/../lib/CalDAV/Outbox.php', |
|
| 51 | + 'OCA\\DAV\\CalDAV\\Plugin' => $baseDir.'/../lib/CalDAV/Plugin.php', |
|
| 52 | + 'OCA\\DAV\\CalDAV\\Principal\\Collection' => $baseDir.'/../lib/CalDAV/Principal/Collection.php', |
|
| 53 | + 'OCA\\DAV\\CalDAV\\Principal\\User' => $baseDir.'/../lib/CalDAV/Principal/User.php', |
|
| 54 | + 'OCA\\DAV\\CalDAV\\Proxy\\Proxy' => $baseDir.'/../lib/CalDAV/Proxy/Proxy.php', |
|
| 55 | + 'OCA\\DAV\\CalDAV\\Proxy\\ProxyMapper' => $baseDir.'/../lib/CalDAV/Proxy/ProxyMapper.php', |
|
| 56 | + 'OCA\\DAV\\CalDAV\\PublicCalendar' => $baseDir.'/../lib/CalDAV/PublicCalendar.php', |
|
| 57 | + 'OCA\\DAV\\CalDAV\\PublicCalendarObject' => $baseDir.'/../lib/CalDAV/PublicCalendarObject.php', |
|
| 58 | + 'OCA\\DAV\\CalDAV\\PublicCalendarRoot' => $baseDir.'/../lib/CalDAV/PublicCalendarRoot.php', |
|
| 59 | + 'OCA\\DAV\\CalDAV\\Publishing\\PublishPlugin' => $baseDir.'/../lib/CalDAV/Publishing/PublishPlugin.php', |
|
| 60 | + 'OCA\\DAV\\CalDAV\\Publishing\\Xml\\Publisher' => $baseDir.'/../lib/CalDAV/Publishing/Xml/Publisher.php', |
|
| 61 | + 'OCA\\DAV\\CalDAV\\Reminder\\Backend' => $baseDir.'/../lib/CalDAV/Reminder/Backend.php', |
|
| 62 | + 'OCA\\DAV\\CalDAV\\Reminder\\INotificationProvider' => $baseDir.'/../lib/CalDAV/Reminder/INotificationProvider.php', |
|
| 63 | + 'OCA\\DAV\\CalDAV\\Reminder\\NotificationProviderManager' => $baseDir.'/../lib/CalDAV/Reminder/NotificationProviderManager.php', |
|
| 64 | + 'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\AbstractProvider' => $baseDir.'/../lib/CalDAV/Reminder/NotificationProvider/AbstractProvider.php', |
|
| 65 | + 'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\AudioProvider' => $baseDir.'/../lib/CalDAV/Reminder/NotificationProvider/AudioProvider.php', |
|
| 66 | + 'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\EmailProvider' => $baseDir.'/../lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php', |
|
| 67 | + 'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\ProviderNotAvailableException' => $baseDir.'/../lib/CalDAV/Reminder/NotificationProvider/ProviderNotAvailableException.php', |
|
| 68 | + 'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\PushProvider' => $baseDir.'/../lib/CalDAV/Reminder/NotificationProvider/PushProvider.php', |
|
| 69 | + 'OCA\\DAV\\CalDAV\\Reminder\\NotificationTypeDoesNotExistException' => $baseDir.'/../lib/CalDAV/Reminder/NotificationTypeDoesNotExistException.php', |
|
| 70 | + 'OCA\\DAV\\CalDAV\\Reminder\\Notifier' => $baseDir.'/../lib/CalDAV/Reminder/Notifier.php', |
|
| 71 | + 'OCA\\DAV\\CalDAV\\Reminder\\ReminderService' => $baseDir.'/../lib/CalDAV/Reminder/ReminderService.php', |
|
| 72 | + 'OCA\\DAV\\CalDAV\\ResourceBooking\\AbstractPrincipalBackend' => $baseDir.'/../lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php', |
|
| 73 | + 'OCA\\DAV\\CalDAV\\ResourceBooking\\ResourcePrincipalBackend' => $baseDir.'/../lib/CalDAV/ResourceBooking/ResourcePrincipalBackend.php', |
|
| 74 | + 'OCA\\DAV\\CalDAV\\ResourceBooking\\RoomPrincipalBackend' => $baseDir.'/../lib/CalDAV/ResourceBooking/RoomPrincipalBackend.php', |
|
| 75 | + 'OCA\\DAV\\CalDAV\\Schedule\\IMipPlugin' => $baseDir.'/../lib/CalDAV/Schedule/IMipPlugin.php', |
|
| 76 | + 'OCA\\DAV\\CalDAV\\Schedule\\Plugin' => $baseDir.'/../lib/CalDAV/Schedule/Plugin.php', |
|
| 77 | + 'OCA\\DAV\\CalDAV\\Search\\SearchPlugin' => $baseDir.'/../lib/CalDAV/Search/SearchPlugin.php', |
|
| 78 | + 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\CompFilter' => $baseDir.'/../lib/CalDAV/Search/Xml/Filter/CompFilter.php', |
|
| 79 | + 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\LimitFilter' => $baseDir.'/../lib/CalDAV/Search/Xml/Filter/LimitFilter.php', |
|
| 80 | + 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\OffsetFilter' => $baseDir.'/../lib/CalDAV/Search/Xml/Filter/OffsetFilter.php', |
|
| 81 | + 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\ParamFilter' => $baseDir.'/../lib/CalDAV/Search/Xml/Filter/ParamFilter.php', |
|
| 82 | + 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\PropFilter' => $baseDir.'/../lib/CalDAV/Search/Xml/Filter/PropFilter.php', |
|
| 83 | + 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\SearchTermFilter' => $baseDir.'/../lib/CalDAV/Search/Xml/Filter/SearchTermFilter.php', |
|
| 84 | + 'OCA\\DAV\\CalDAV\\Search\\Xml\\Request\\CalendarSearchReport' => $baseDir.'/../lib/CalDAV/Search/Xml/Request/CalendarSearchReport.php', |
|
| 85 | + 'OCA\\DAV\\CalDAV\\WebcalCaching\\Plugin' => $baseDir.'/../lib/CalDAV/WebcalCaching/Plugin.php', |
|
| 86 | + 'OCA\\DAV\\CalDAV\\WebcalCaching\\RefreshWebcalService' => $baseDir.'/../lib/CalDAV/WebcalCaching/RefreshWebcalService.php', |
|
| 87 | + 'OCA\\DAV\\Capabilities' => $baseDir.'/../lib/Capabilities.php', |
|
| 88 | + 'OCA\\DAV\\CardDAV\\AddressBook' => $baseDir.'/../lib/CardDAV/AddressBook.php', |
|
| 89 | + 'OCA\\DAV\\CardDAV\\AddressBookImpl' => $baseDir.'/../lib/CardDAV/AddressBookImpl.php', |
|
| 90 | + 'OCA\\DAV\\CardDAV\\AddressBookRoot' => $baseDir.'/../lib/CardDAV/AddressBookRoot.php', |
|
| 91 | + 'OCA\\DAV\\CardDAV\\CardDavBackend' => $baseDir.'/../lib/CardDAV/CardDavBackend.php', |
|
| 92 | + 'OCA\\DAV\\CardDAV\\ContactsManager' => $baseDir.'/../lib/CardDAV/ContactsManager.php', |
|
| 93 | + 'OCA\\DAV\\CardDAV\\Converter' => $baseDir.'/../lib/CardDAV/Converter.php', |
|
| 94 | + 'OCA\\DAV\\CardDAV\\HasPhotoPlugin' => $baseDir.'/../lib/CardDAV/HasPhotoPlugin.php', |
|
| 95 | + 'OCA\\DAV\\CardDAV\\ImageExportPlugin' => $baseDir.'/../lib/CardDAV/ImageExportPlugin.php', |
|
| 96 | + 'OCA\\DAV\\CardDAV\\Integration\\ExternalAddressBook' => $baseDir.'/../lib/CardDAV/Integration/ExternalAddressBook.php', |
|
| 97 | + 'OCA\\DAV\\CardDAV\\Integration\\IAddressBookProvider' => $baseDir.'/../lib/CardDAV/Integration/IAddressBookProvider.php', |
|
| 98 | + 'OCA\\DAV\\CardDAV\\MultiGetExportPlugin' => $baseDir.'/../lib/CardDAV/MultiGetExportPlugin.php', |
|
| 99 | + 'OCA\\DAV\\CardDAV\\PhotoCache' => $baseDir.'/../lib/CardDAV/PhotoCache.php', |
|
| 100 | + 'OCA\\DAV\\CardDAV\\Plugin' => $baseDir.'/../lib/CardDAV/Plugin.php', |
|
| 101 | + 'OCA\\DAV\\CardDAV\\SyncService' => $baseDir.'/../lib/CardDAV/SyncService.php', |
|
| 102 | + 'OCA\\DAV\\CardDAV\\SystemAddressbook' => $baseDir.'/../lib/CardDAV/SystemAddressbook.php', |
|
| 103 | + 'OCA\\DAV\\CardDAV\\UserAddressBooks' => $baseDir.'/../lib/CardDAV/UserAddressBooks.php', |
|
| 104 | + 'OCA\\DAV\\CardDAV\\Xml\\Groups' => $baseDir.'/../lib/CardDAV/Xml/Groups.php', |
|
| 105 | + 'OCA\\DAV\\Command\\CreateAddressBook' => $baseDir.'/../lib/Command/CreateAddressBook.php', |
|
| 106 | + 'OCA\\DAV\\Command\\CreateCalendar' => $baseDir.'/../lib/Command/CreateCalendar.php', |
|
| 107 | + 'OCA\\DAV\\Command\\ListCalendars' => $baseDir.'/../lib/Command/ListCalendars.php', |
|
| 108 | + 'OCA\\DAV\\Command\\MoveCalendar' => $baseDir.'/../lib/Command/MoveCalendar.php', |
|
| 109 | + 'OCA\\DAV\\Command\\RemoveInvalidShares' => $baseDir.'/../lib/Command/RemoveInvalidShares.php', |
|
| 110 | + 'OCA\\DAV\\Command\\SendEventReminders' => $baseDir.'/../lib/Command/SendEventReminders.php', |
|
| 111 | + 'OCA\\DAV\\Command\\SyncBirthdayCalendar' => $baseDir.'/../lib/Command/SyncBirthdayCalendar.php', |
|
| 112 | + 'OCA\\DAV\\Command\\SyncSystemAddressBook' => $baseDir.'/../lib/Command/SyncSystemAddressBook.php', |
|
| 113 | + 'OCA\\DAV\\Comments\\CommentNode' => $baseDir.'/../lib/Comments/CommentNode.php', |
|
| 114 | + 'OCA\\DAV\\Comments\\CommentsPlugin' => $baseDir.'/../lib/Comments/CommentsPlugin.php', |
|
| 115 | + 'OCA\\DAV\\Comments\\EntityCollection' => $baseDir.'/../lib/Comments/EntityCollection.php', |
|
| 116 | + 'OCA\\DAV\\Comments\\EntityTypeCollection' => $baseDir.'/../lib/Comments/EntityTypeCollection.php', |
|
| 117 | + 'OCA\\DAV\\Comments\\RootCollection' => $baseDir.'/../lib/Comments/RootCollection.php', |
|
| 118 | + 'OCA\\DAV\\Connector\\LegacyDAVACL' => $baseDir.'/../lib/Connector/LegacyDAVACL.php', |
|
| 119 | + 'OCA\\DAV\\Connector\\PublicAuth' => $baseDir.'/../lib/Connector/PublicAuth.php', |
|
| 120 | + 'OCA\\DAV\\Connector\\Sabre\\AnonymousOptionsPlugin' => $baseDir.'/../lib/Connector/Sabre/AnonymousOptionsPlugin.php', |
|
| 121 | + 'OCA\\DAV\\Connector\\Sabre\\AppEnabledPlugin' => $baseDir.'/../lib/Connector/Sabre/AppEnabledPlugin.php', |
|
| 122 | + 'OCA\\DAV\\Connector\\Sabre\\Auth' => $baseDir.'/../lib/Connector/Sabre/Auth.php', |
|
| 123 | + 'OCA\\DAV\\Connector\\Sabre\\BearerAuth' => $baseDir.'/../lib/Connector/Sabre/BearerAuth.php', |
|
| 124 | + 'OCA\\DAV\\Connector\\Sabre\\BlockLegacyClientPlugin' => $baseDir.'/../lib/Connector/Sabre/BlockLegacyClientPlugin.php', |
|
| 125 | + 'OCA\\DAV\\Connector\\Sabre\\CachingTree' => $baseDir.'/../lib/Connector/Sabre/CachingTree.php', |
|
| 126 | + 'OCA\\DAV\\Connector\\Sabre\\ChecksumList' => $baseDir.'/../lib/Connector/Sabre/ChecksumList.php', |
|
| 127 | + 'OCA\\DAV\\Connector\\Sabre\\CommentPropertiesPlugin' => $baseDir.'/../lib/Connector/Sabre/CommentPropertiesPlugin.php', |
|
| 128 | + 'OCA\\DAV\\Connector\\Sabre\\CopyEtagHeaderPlugin' => $baseDir.'/../lib/Connector/Sabre/CopyEtagHeaderPlugin.php', |
|
| 129 | + 'OCA\\DAV\\Connector\\Sabre\\DavAclPlugin' => $baseDir.'/../lib/Connector/Sabre/DavAclPlugin.php', |
|
| 130 | + 'OCA\\DAV\\Connector\\Sabre\\Directory' => $baseDir.'/../lib/Connector/Sabre/Directory.php', |
|
| 131 | + 'OCA\\DAV\\Connector\\Sabre\\DummyGetResponsePlugin' => $baseDir.'/../lib/Connector/Sabre/DummyGetResponsePlugin.php', |
|
| 132 | + 'OCA\\DAV\\Connector\\Sabre\\ExceptionLoggerPlugin' => $baseDir.'/../lib/Connector/Sabre/ExceptionLoggerPlugin.php', |
|
| 133 | + 'OCA\\DAV\\Connector\\Sabre\\Exception\\EntityTooLarge' => $baseDir.'/../lib/Connector/Sabre/Exception/EntityTooLarge.php', |
|
| 134 | + 'OCA\\DAV\\Connector\\Sabre\\Exception\\FileLocked' => $baseDir.'/../lib/Connector/Sabre/Exception/FileLocked.php', |
|
| 135 | + 'OCA\\DAV\\Connector\\Sabre\\Exception\\Forbidden' => $baseDir.'/../lib/Connector/Sabre/Exception/Forbidden.php', |
|
| 136 | + 'OCA\\DAV\\Connector\\Sabre\\Exception\\InvalidPath' => $baseDir.'/../lib/Connector/Sabre/Exception/InvalidPath.php', |
|
| 137 | + 'OCA\\DAV\\Connector\\Sabre\\Exception\\PasswordLoginForbidden' => $baseDir.'/../lib/Connector/Sabre/Exception/PasswordLoginForbidden.php', |
|
| 138 | + 'OCA\\DAV\\Connector\\Sabre\\Exception\\UnsupportedMediaType' => $baseDir.'/../lib/Connector/Sabre/Exception/UnsupportedMediaType.php', |
|
| 139 | + 'OCA\\DAV\\Connector\\Sabre\\FakeLockerPlugin' => $baseDir.'/../lib/Connector/Sabre/FakeLockerPlugin.php', |
|
| 140 | + 'OCA\\DAV\\Connector\\Sabre\\File' => $baseDir.'/../lib/Connector/Sabre/File.php', |
|
| 141 | + 'OCA\\DAV\\Connector\\Sabre\\FilesPlugin' => $baseDir.'/../lib/Connector/Sabre/FilesPlugin.php', |
|
| 142 | + 'OCA\\DAV\\Connector\\Sabre\\FilesReportPlugin' => $baseDir.'/../lib/Connector/Sabre/FilesReportPlugin.php', |
|
| 143 | + 'OCA\\DAV\\Connector\\Sabre\\LockPlugin' => $baseDir.'/../lib/Connector/Sabre/LockPlugin.php', |
|
| 144 | + 'OCA\\DAV\\Connector\\Sabre\\MaintenancePlugin' => $baseDir.'/../lib/Connector/Sabre/MaintenancePlugin.php', |
|
| 145 | + 'OCA\\DAV\\Connector\\Sabre\\Node' => $baseDir.'/../lib/Connector/Sabre/Node.php', |
|
| 146 | + 'OCA\\DAV\\Connector\\Sabre\\ObjectTree' => $baseDir.'/../lib/Connector/Sabre/ObjectTree.php', |
|
| 147 | + 'OCA\\DAV\\Connector\\Sabre\\Principal' => $baseDir.'/../lib/Connector/Sabre/Principal.php', |
|
| 148 | + 'OCA\\DAV\\Connector\\Sabre\\PropfindCompressionPlugin' => $baseDir.'/../lib/Connector/Sabre/PropfindCompressionPlugin.php', |
|
| 149 | + 'OCA\\DAV\\Connector\\Sabre\\QuotaPlugin' => $baseDir.'/../lib/Connector/Sabre/QuotaPlugin.php', |
|
| 150 | + 'OCA\\DAV\\Connector\\Sabre\\Server' => $baseDir.'/../lib/Connector/Sabre/Server.php', |
|
| 151 | + 'OCA\\DAV\\Connector\\Sabre\\ServerFactory' => $baseDir.'/../lib/Connector/Sabre/ServerFactory.php', |
|
| 152 | + 'OCA\\DAV\\Connector\\Sabre\\ShareTypeList' => $baseDir.'/../lib/Connector/Sabre/ShareTypeList.php', |
|
| 153 | + 'OCA\\DAV\\Connector\\Sabre\\ShareeList' => $baseDir.'/../lib/Connector/Sabre/ShareeList.php', |
|
| 154 | + 'OCA\\DAV\\Connector\\Sabre\\SharesPlugin' => $baseDir.'/../lib/Connector/Sabre/SharesPlugin.php', |
|
| 155 | + 'OCA\\DAV\\Connector\\Sabre\\TagList' => $baseDir.'/../lib/Connector/Sabre/TagList.php', |
|
| 156 | + 'OCA\\DAV\\Connector\\Sabre\\TagsPlugin' => $baseDir.'/../lib/Connector/Sabre/TagsPlugin.php', |
|
| 157 | + 'OCA\\DAV\\Controller\\BirthdayCalendarController' => $baseDir.'/../lib/Controller/BirthdayCalendarController.php', |
|
| 158 | + 'OCA\\DAV\\Controller\\DirectController' => $baseDir.'/../lib/Controller/DirectController.php', |
|
| 159 | + 'OCA\\DAV\\Controller\\InvitationResponseController' => $baseDir.'/../lib/Controller/InvitationResponseController.php', |
|
| 160 | + 'OCA\\DAV\\DAV\\CustomPropertiesBackend' => $baseDir.'/../lib/DAV/CustomPropertiesBackend.php', |
|
| 161 | + 'OCA\\DAV\\DAV\\GroupPrincipalBackend' => $baseDir.'/../lib/DAV/GroupPrincipalBackend.php', |
|
| 162 | + 'OCA\\DAV\\DAV\\PublicAuth' => $baseDir.'/../lib/DAV/PublicAuth.php', |
|
| 163 | + 'OCA\\DAV\\DAV\\Sharing\\Backend' => $baseDir.'/../lib/DAV/Sharing/Backend.php', |
|
| 164 | + 'OCA\\DAV\\DAV\\Sharing\\IShareable' => $baseDir.'/../lib/DAV/Sharing/IShareable.php', |
|
| 165 | + 'OCA\\DAV\\DAV\\Sharing\\Plugin' => $baseDir.'/../lib/DAV/Sharing/Plugin.php', |
|
| 166 | + 'OCA\\DAV\\DAV\\Sharing\\Xml\\Invite' => $baseDir.'/../lib/DAV/Sharing/Xml/Invite.php', |
|
| 167 | + 'OCA\\DAV\\DAV\\Sharing\\Xml\\ShareRequest' => $baseDir.'/../lib/DAV/Sharing/Xml/ShareRequest.php', |
|
| 168 | + 'OCA\\DAV\\DAV\\SystemPrincipalBackend' => $baseDir.'/../lib/DAV/SystemPrincipalBackend.php', |
|
| 169 | + 'OCA\\DAV\\Db\\Direct' => $baseDir.'/../lib/Db/Direct.php', |
|
| 170 | + 'OCA\\DAV\\Db\\DirectMapper' => $baseDir.'/../lib/Db/DirectMapper.php', |
|
| 171 | + 'OCA\\DAV\\Direct\\DirectFile' => $baseDir.'/../lib/Direct/DirectFile.php', |
|
| 172 | + 'OCA\\DAV\\Direct\\DirectHome' => $baseDir.'/../lib/Direct/DirectHome.php', |
|
| 173 | + 'OCA\\DAV\\Direct\\Server' => $baseDir.'/../lib/Direct/Server.php', |
|
| 174 | + 'OCA\\DAV\\Direct\\ServerFactory' => $baseDir.'/../lib/Direct/ServerFactory.php', |
|
| 175 | + 'OCA\\DAV\\Events\\AddressBookCreatedEvent' => $baseDir.'/../lib/Events/AddressBookCreatedEvent.php', |
|
| 176 | + 'OCA\\DAV\\Events\\AddressBookDeletedEvent' => $baseDir.'/../lib/Events/AddressBookDeletedEvent.php', |
|
| 177 | + 'OCA\\DAV\\Events\\AddressBookShareUpdatedEvent' => $baseDir.'/../lib/Events/AddressBookShareUpdatedEvent.php', |
|
| 178 | + 'OCA\\DAV\\Events\\AddressBookUpdatedEvent' => $baseDir.'/../lib/Events/AddressBookUpdatedEvent.php', |
|
| 179 | + 'OCA\\DAV\\Events\\BeforeFileDirectDownloadedEvent' => $baseDir.'/../lib/Events/BeforeFileDirectDownloadedEvent.php', |
|
| 180 | + 'OCA\\DAV\\Events\\CachedCalendarObjectCreatedEvent' => $baseDir.'/../lib/Events/CachedCalendarObjectCreatedEvent.php', |
|
| 181 | + 'OCA\\DAV\\Events\\CachedCalendarObjectDeletedEvent' => $baseDir.'/../lib/Events/CachedCalendarObjectDeletedEvent.php', |
|
| 182 | + 'OCA\\DAV\\Events\\CachedCalendarObjectUpdatedEvent' => $baseDir.'/../lib/Events/CachedCalendarObjectUpdatedEvent.php', |
|
| 183 | + 'OCA\\DAV\\Events\\CalendarCreatedEvent' => $baseDir.'/../lib/Events/CalendarCreatedEvent.php', |
|
| 184 | + 'OCA\\DAV\\Events\\CalendarDeletedEvent' => $baseDir.'/../lib/Events/CalendarDeletedEvent.php', |
|
| 185 | + 'OCA\\DAV\\Events\\CalendarObjectCreatedEvent' => $baseDir.'/../lib/Events/CalendarObjectCreatedEvent.php', |
|
| 186 | + 'OCA\\DAV\\Events\\CalendarObjectDeletedEvent' => $baseDir.'/../lib/Events/CalendarObjectDeletedEvent.php', |
|
| 187 | + 'OCA\\DAV\\Events\\CalendarObjectUpdatedEvent' => $baseDir.'/../lib/Events/CalendarObjectUpdatedEvent.php', |
|
| 188 | + 'OCA\\DAV\\Events\\CalendarPublishedEvent' => $baseDir.'/../lib/Events/CalendarPublishedEvent.php', |
|
| 189 | + 'OCA\\DAV\\Events\\CalendarShareUpdatedEvent' => $baseDir.'/../lib/Events/CalendarShareUpdatedEvent.php', |
|
| 190 | + 'OCA\\DAV\\Events\\CalendarUnpublishedEvent' => $baseDir.'/../lib/Events/CalendarUnpublishedEvent.php', |
|
| 191 | + 'OCA\\DAV\\Events\\CalendarUpdatedEvent' => $baseDir.'/../lib/Events/CalendarUpdatedEvent.php', |
|
| 192 | + 'OCA\\DAV\\Events\\CardCreatedEvent' => $baseDir.'/../lib/Events/CardCreatedEvent.php', |
|
| 193 | + 'OCA\\DAV\\Events\\CardDeletedEvent' => $baseDir.'/../lib/Events/CardDeletedEvent.php', |
|
| 194 | + 'OCA\\DAV\\Events\\CardUpdatedEvent' => $baseDir.'/../lib/Events/CardUpdatedEvent.php', |
|
| 195 | + 'OCA\\DAV\\Events\\SabrePluginAuthInitEvent' => $baseDir.'/../lib/Events/SabrePluginAuthInitEvent.php', |
|
| 196 | + 'OCA\\DAV\\Events\\SubscriptionCreatedEvent' => $baseDir.'/../lib/Events/SubscriptionCreatedEvent.php', |
|
| 197 | + 'OCA\\DAV\\Events\\SubscriptionDeletedEvent' => $baseDir.'/../lib/Events/SubscriptionDeletedEvent.php', |
|
| 198 | + 'OCA\\DAV\\Events\\SubscriptionUpdatedEvent' => $baseDir.'/../lib/Events/SubscriptionUpdatedEvent.php', |
|
| 199 | + 'OCA\\DAV\\Exception\\UnsupportedLimitOnInitialSyncException' => $baseDir.'/../lib/Exception/UnsupportedLimitOnInitialSyncException.php', |
|
| 200 | + 'OCA\\DAV\\Files\\BrowserErrorPagePlugin' => $baseDir.'/../lib/Files/BrowserErrorPagePlugin.php', |
|
| 201 | + 'OCA\\DAV\\Files\\FileSearchBackend' => $baseDir.'/../lib/Files/FileSearchBackend.php', |
|
| 202 | + 'OCA\\DAV\\Files\\FilesHome' => $baseDir.'/../lib/Files/FilesHome.php', |
|
| 203 | + 'OCA\\DAV\\Files\\LazySearchBackend' => $baseDir.'/../lib/Files/LazySearchBackend.php', |
|
| 204 | + 'OCA\\DAV\\Files\\RootCollection' => $baseDir.'/../lib/Files/RootCollection.php', |
|
| 205 | + 'OCA\\DAV\\Files\\Sharing\\FilesDropPlugin' => $baseDir.'/../lib/Files/Sharing/FilesDropPlugin.php', |
|
| 206 | + 'OCA\\DAV\\Files\\Sharing\\PublicLinkCheckPlugin' => $baseDir.'/../lib/Files/Sharing/PublicLinkCheckPlugin.php', |
|
| 207 | + 'OCA\\DAV\\HookManager' => $baseDir.'/../lib/HookManager.php', |
|
| 208 | + 'OCA\\DAV\\Listener\\ActivityUpdaterListener' => $baseDir.'/../lib/Listener/ActivityUpdaterListener.php', |
|
| 209 | + 'OCA\\DAV\\Listener\\CalendarContactInteractionListener' => $baseDir.'/../lib/Listener/CalendarContactInteractionListener.php', |
|
| 210 | + 'OCA\\DAV\\Listener\\CalendarDeletionDefaultUpdaterListener' => $baseDir.'/../lib/Listener/CalendarDeletionDefaultUpdaterListener.php', |
|
| 211 | + 'OCA\\DAV\\Listener\\CalendarObjectReminderUpdaterListener' => $baseDir.'/../lib/Listener/CalendarObjectReminderUpdaterListener.php', |
|
| 212 | + 'OCA\\DAV\\Migration\\BuildCalendarSearchIndex' => $baseDir.'/../lib/Migration/BuildCalendarSearchIndex.php', |
|
| 213 | + 'OCA\\DAV\\Migration\\BuildCalendarSearchIndexBackgroundJob' => $baseDir.'/../lib/Migration/BuildCalendarSearchIndexBackgroundJob.php', |
|
| 214 | + 'OCA\\DAV\\Migration\\BuildSocialSearchIndex' => $baseDir.'/../lib/Migration/BuildSocialSearchIndex.php', |
|
| 215 | + 'OCA\\DAV\\Migration\\BuildSocialSearchIndexBackgroundJob' => $baseDir.'/../lib/Migration/BuildSocialSearchIndexBackgroundJob.php', |
|
| 216 | + 'OCA\\DAV\\Migration\\CalDAVRemoveEmptyValue' => $baseDir.'/../lib/Migration/CalDAVRemoveEmptyValue.php', |
|
| 217 | + 'OCA\\DAV\\Migration\\ChunkCleanup' => $baseDir.'/../lib/Migration/ChunkCleanup.php', |
|
| 218 | + 'OCA\\DAV\\Migration\\FixBirthdayCalendarComponent' => $baseDir.'/../lib/Migration/FixBirthdayCalendarComponent.php', |
|
| 219 | + 'OCA\\DAV\\Migration\\RefreshWebcalJobRegistrar' => $baseDir.'/../lib/Migration/RefreshWebcalJobRegistrar.php', |
|
| 220 | + 'OCA\\DAV\\Migration\\RegenerateBirthdayCalendars' => $baseDir.'/../lib/Migration/RegenerateBirthdayCalendars.php', |
|
| 221 | + 'OCA\\DAV\\Migration\\RegisterBuildReminderIndexBackgroundJob' => $baseDir.'/../lib/Migration/RegisterBuildReminderIndexBackgroundJob.php', |
|
| 222 | + 'OCA\\DAV\\Migration\\RemoveClassifiedEventActivity' => $baseDir.'/../lib/Migration/RemoveClassifiedEventActivity.php', |
|
| 223 | + 'OCA\\DAV\\Migration\\RemoveOrphanEventsAndContacts' => $baseDir.'/../lib/Migration/RemoveOrphanEventsAndContacts.php', |
|
| 224 | + 'OCA\\DAV\\Migration\\Version1004Date20170825134824' => $baseDir.'/../lib/Migration/Version1004Date20170825134824.php', |
|
| 225 | + 'OCA\\DAV\\Migration\\Version1004Date20170919104507' => $baseDir.'/../lib/Migration/Version1004Date20170919104507.php', |
|
| 226 | + 'OCA\\DAV\\Migration\\Version1004Date20170924124212' => $baseDir.'/../lib/Migration/Version1004Date20170924124212.php', |
|
| 227 | + 'OCA\\DAV\\Migration\\Version1004Date20170926103422' => $baseDir.'/../lib/Migration/Version1004Date20170926103422.php', |
|
| 228 | + 'OCA\\DAV\\Migration\\Version1005Date20180413093149' => $baseDir.'/../lib/Migration/Version1005Date20180413093149.php', |
|
| 229 | + 'OCA\\DAV\\Migration\\Version1005Date20180530124431' => $baseDir.'/../lib/Migration/Version1005Date20180530124431.php', |
|
| 230 | + 'OCA\\DAV\\Migration\\Version1006Date20180619154313' => $baseDir.'/../lib/Migration/Version1006Date20180619154313.php', |
|
| 231 | + 'OCA\\DAV\\Migration\\Version1006Date20180628111625' => $baseDir.'/../lib/Migration/Version1006Date20180628111625.php', |
|
| 232 | + 'OCA\\DAV\\Migration\\Version1008Date20181030113700' => $baseDir.'/../lib/Migration/Version1008Date20181030113700.php', |
|
| 233 | + 'OCA\\DAV\\Migration\\Version1008Date20181105104826' => $baseDir.'/../lib/Migration/Version1008Date20181105104826.php', |
|
| 234 | + 'OCA\\DAV\\Migration\\Version1008Date20181105104833' => $baseDir.'/../lib/Migration/Version1008Date20181105104833.php', |
|
| 235 | + 'OCA\\DAV\\Migration\\Version1008Date20181105110300' => $baseDir.'/../lib/Migration/Version1008Date20181105110300.php', |
|
| 236 | + 'OCA\\DAV\\Migration\\Version1008Date20181105112049' => $baseDir.'/../lib/Migration/Version1008Date20181105112049.php', |
|
| 237 | + 'OCA\\DAV\\Migration\\Version1008Date20181114084440' => $baseDir.'/../lib/Migration/Version1008Date20181114084440.php', |
|
| 238 | + 'OCA\\DAV\\Migration\\Version1011Date20190725113607' => $baseDir.'/../lib/Migration/Version1011Date20190725113607.php', |
|
| 239 | + 'OCA\\DAV\\Migration\\Version1011Date20190806104428' => $baseDir.'/../lib/Migration/Version1011Date20190806104428.php', |
|
| 240 | + 'OCA\\DAV\\Migration\\Version1012Date20190808122342' => $baseDir.'/../lib/Migration/Version1012Date20190808122342.php', |
|
| 241 | + 'OCA\\DAV\\Migration\\Version1016Date20201109085907' => $baseDir.'/../lib/Migration/Version1016Date20201109085907.php', |
|
| 242 | + 'OCA\\DAV\\Migration\\Version1017Date20210216083742' => $baseDir.'/../lib/Migration/Version1017Date20210216083742.php', |
|
| 243 | + 'OCA\\DAV\\Provisioning\\Apple\\AppleProvisioningNode' => $baseDir.'/../lib/Provisioning/Apple/AppleProvisioningNode.php', |
|
| 244 | + 'OCA\\DAV\\Provisioning\\Apple\\AppleProvisioningPlugin' => $baseDir.'/../lib/Provisioning/Apple/AppleProvisioningPlugin.php', |
|
| 245 | + 'OCA\\DAV\\RootCollection' => $baseDir.'/../lib/RootCollection.php', |
|
| 246 | + 'OCA\\DAV\\Search\\ACalendarSearchProvider' => $baseDir.'/../lib/Search/ACalendarSearchProvider.php', |
|
| 247 | + 'OCA\\DAV\\Search\\ContactsSearchProvider' => $baseDir.'/../lib/Search/ContactsSearchProvider.php', |
|
| 248 | + 'OCA\\DAV\\Search\\EventsSearchProvider' => $baseDir.'/../lib/Search/EventsSearchProvider.php', |
|
| 249 | + 'OCA\\DAV\\Search\\TasksSearchProvider' => $baseDir.'/../lib/Search/TasksSearchProvider.php', |
|
| 250 | + 'OCA\\DAV\\Server' => $baseDir.'/../lib/Server.php', |
|
| 251 | + 'OCA\\DAV\\Settings\\CalDAVSettings' => $baseDir.'/../lib/Settings/CalDAVSettings.php', |
|
| 252 | + 'OCA\\DAV\\Storage\\PublicOwnerWrapper' => $baseDir.'/../lib/Storage/PublicOwnerWrapper.php', |
|
| 253 | + 'OCA\\DAV\\SystemTag\\SystemTagMappingNode' => $baseDir.'/../lib/SystemTag/SystemTagMappingNode.php', |
|
| 254 | + 'OCA\\DAV\\SystemTag\\SystemTagNode' => $baseDir.'/../lib/SystemTag/SystemTagNode.php', |
|
| 255 | + 'OCA\\DAV\\SystemTag\\SystemTagPlugin' => $baseDir.'/../lib/SystemTag/SystemTagPlugin.php', |
|
| 256 | + 'OCA\\DAV\\SystemTag\\SystemTagsByIdCollection' => $baseDir.'/../lib/SystemTag/SystemTagsByIdCollection.php', |
|
| 257 | + 'OCA\\DAV\\SystemTag\\SystemTagsObjectMappingCollection' => $baseDir.'/../lib/SystemTag/SystemTagsObjectMappingCollection.php', |
|
| 258 | + 'OCA\\DAV\\SystemTag\\SystemTagsObjectTypeCollection' => $baseDir.'/../lib/SystemTag/SystemTagsObjectTypeCollection.php', |
|
| 259 | + 'OCA\\DAV\\SystemTag\\SystemTagsRelationsCollection' => $baseDir.'/../lib/SystemTag/SystemTagsRelationsCollection.php', |
|
| 260 | + 'OCA\\DAV\\Traits\\PrincipalProxyTrait' => $baseDir.'/../lib/Traits/PrincipalProxyTrait.php', |
|
| 261 | + 'OCA\\DAV\\Upload\\AssemblyStream' => $baseDir.'/../lib/Upload/AssemblyStream.php', |
|
| 262 | + 'OCA\\DAV\\Upload\\ChunkingPlugin' => $baseDir.'/../lib/Upload/ChunkingPlugin.php', |
|
| 263 | + 'OCA\\DAV\\Upload\\CleanupService' => $baseDir.'/../lib/Upload/CleanupService.php', |
|
| 264 | + 'OCA\\DAV\\Upload\\FutureFile' => $baseDir.'/../lib/Upload/FutureFile.php', |
|
| 265 | + 'OCA\\DAV\\Upload\\RootCollection' => $baseDir.'/../lib/Upload/RootCollection.php', |
|
| 266 | + 'OCA\\DAV\\Upload\\UploadFile' => $baseDir.'/../lib/Upload/UploadFile.php', |
|
| 267 | + 'OCA\\DAV\\Upload\\UploadFolder' => $baseDir.'/../lib/Upload/UploadFolder.php', |
|
| 268 | + 'OCA\\DAV\\Upload\\UploadHome' => $baseDir.'/../lib/Upload/UploadHome.php', |
|
| 269 | 269 | ); |
@@ -6,286 +6,286 @@ |
||
| 6 | 6 | |
| 7 | 7 | class ComposerStaticInitDAV |
| 8 | 8 | { |
| 9 | - public static $prefixLengthsPsr4 = array ( |
|
| 9 | + public static $prefixLengthsPsr4 = array( |
|
| 10 | 10 | 'O' => |
| 11 | - array ( |
|
| 11 | + array( |
|
| 12 | 12 | 'OCA\\DAV\\' => 8, |
| 13 | 13 | ), |
| 14 | 14 | ); |
| 15 | 15 | |
| 16 | - public static $prefixDirsPsr4 = array ( |
|
| 16 | + public static $prefixDirsPsr4 = array( |
|
| 17 | 17 | 'OCA\\DAV\\' => |
| 18 | - array ( |
|
| 19 | - 0 => __DIR__ . '/..' . '/../lib', |
|
| 18 | + array( |
|
| 19 | + 0 => __DIR__.'/..'.'/../lib', |
|
| 20 | 20 | ), |
| 21 | 21 | ); |
| 22 | 22 | |
| 23 | - public static $classMap = array ( |
|
| 24 | - 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', |
|
| 25 | - 'OCA\\DAV\\AppInfo\\Application' => __DIR__ . '/..' . '/../lib/AppInfo/Application.php', |
|
| 26 | - 'OCA\\DAV\\AppInfo\\PluginManager' => __DIR__ . '/..' . '/../lib/AppInfo/PluginManager.php', |
|
| 27 | - 'OCA\\DAV\\Avatars\\AvatarHome' => __DIR__ . '/..' . '/../lib/Avatars/AvatarHome.php', |
|
| 28 | - 'OCA\\DAV\\Avatars\\AvatarNode' => __DIR__ . '/..' . '/../lib/Avatars/AvatarNode.php', |
|
| 29 | - 'OCA\\DAV\\Avatars\\RootCollection' => __DIR__ . '/..' . '/../lib/Avatars/RootCollection.php', |
|
| 30 | - 'OCA\\DAV\\BackgroundJob\\BuildReminderIndexBackgroundJob' => __DIR__ . '/..' . '/../lib/BackgroundJob/BuildReminderIndexBackgroundJob.php', |
|
| 31 | - 'OCA\\DAV\\BackgroundJob\\CleanupDirectLinksJob' => __DIR__ . '/..' . '/../lib/BackgroundJob/CleanupDirectLinksJob.php', |
|
| 32 | - 'OCA\\DAV\\BackgroundJob\\CleanupInvitationTokenJob' => __DIR__ . '/..' . '/../lib/BackgroundJob/CleanupInvitationTokenJob.php', |
|
| 33 | - 'OCA\\DAV\\BackgroundJob\\EventReminderJob' => __DIR__ . '/..' . '/../lib/BackgroundJob/EventReminderJob.php', |
|
| 34 | - 'OCA\\DAV\\BackgroundJob\\GenerateBirthdayCalendarBackgroundJob' => __DIR__ . '/..' . '/../lib/BackgroundJob/GenerateBirthdayCalendarBackgroundJob.php', |
|
| 35 | - 'OCA\\DAV\\BackgroundJob\\RefreshWebcalJob' => __DIR__ . '/..' . '/../lib/BackgroundJob/RefreshWebcalJob.php', |
|
| 36 | - 'OCA\\DAV\\BackgroundJob\\RegisterRegenerateBirthdayCalendars' => __DIR__ . '/..' . '/../lib/BackgroundJob/RegisterRegenerateBirthdayCalendars.php', |
|
| 37 | - 'OCA\\DAV\\BackgroundJob\\UpdateCalendarResourcesRoomsBackgroundJob' => __DIR__ . '/..' . '/../lib/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJob.php', |
|
| 38 | - 'OCA\\DAV\\BackgroundJob\\UploadCleanup' => __DIR__ . '/..' . '/../lib/BackgroundJob/UploadCleanup.php', |
|
| 39 | - 'OCA\\DAV\\CalDAV\\Activity\\Backend' => __DIR__ . '/..' . '/../lib/CalDAV/Activity/Backend.php', |
|
| 40 | - 'OCA\\DAV\\CalDAV\\Activity\\Filter\\Calendar' => __DIR__ . '/..' . '/../lib/CalDAV/Activity/Filter/Calendar.php', |
|
| 41 | - 'OCA\\DAV\\CalDAV\\Activity\\Filter\\Todo' => __DIR__ . '/..' . '/../lib/CalDAV/Activity/Filter/Todo.php', |
|
| 42 | - 'OCA\\DAV\\CalDAV\\Activity\\Provider\\Base' => __DIR__ . '/..' . '/../lib/CalDAV/Activity/Provider/Base.php', |
|
| 43 | - 'OCA\\DAV\\CalDAV\\Activity\\Provider\\Calendar' => __DIR__ . '/..' . '/../lib/CalDAV/Activity/Provider/Calendar.php', |
|
| 44 | - 'OCA\\DAV\\CalDAV\\Activity\\Provider\\Event' => __DIR__ . '/..' . '/../lib/CalDAV/Activity/Provider/Event.php', |
|
| 45 | - 'OCA\\DAV\\CalDAV\\Activity\\Provider\\Todo' => __DIR__ . '/..' . '/../lib/CalDAV/Activity/Provider/Todo.php', |
|
| 46 | - 'OCA\\DAV\\CalDAV\\Activity\\Setting\\CalDAVSetting' => __DIR__ . '/..' . '/../lib/CalDAV/Activity/Setting/CalDAVSetting.php', |
|
| 47 | - 'OCA\\DAV\\CalDAV\\Activity\\Setting\\Calendar' => __DIR__ . '/..' . '/../lib/CalDAV/Activity/Setting/Calendar.php', |
|
| 48 | - 'OCA\\DAV\\CalDAV\\Activity\\Setting\\Event' => __DIR__ . '/..' . '/../lib/CalDAV/Activity/Setting/Event.php', |
|
| 49 | - 'OCA\\DAV\\CalDAV\\Activity\\Setting\\Todo' => __DIR__ . '/..' . '/../lib/CalDAV/Activity/Setting/Todo.php', |
|
| 50 | - 'OCA\\DAV\\CalDAV\\BirthdayCalendar\\EnablePlugin' => __DIR__ . '/..' . '/../lib/CalDAV/BirthdayCalendar/EnablePlugin.php', |
|
| 51 | - 'OCA\\DAV\\CalDAV\\BirthdayService' => __DIR__ . '/..' . '/../lib/CalDAV/BirthdayService.php', |
|
| 52 | - 'OCA\\DAV\\CalDAV\\CachedSubscription' => __DIR__ . '/..' . '/../lib/CalDAV/CachedSubscription.php', |
|
| 53 | - 'OCA\\DAV\\CalDAV\\CachedSubscriptionObject' => __DIR__ . '/..' . '/../lib/CalDAV/CachedSubscriptionObject.php', |
|
| 54 | - 'OCA\\DAV\\CalDAV\\CalDavBackend' => __DIR__ . '/..' . '/../lib/CalDAV/CalDavBackend.php', |
|
| 55 | - 'OCA\\DAV\\CalDAV\\Calendar' => __DIR__ . '/..' . '/../lib/CalDAV/Calendar.php', |
|
| 56 | - 'OCA\\DAV\\CalDAV\\CalendarHome' => __DIR__ . '/..' . '/../lib/CalDAV/CalendarHome.php', |
|
| 57 | - 'OCA\\DAV\\CalDAV\\CalendarImpl' => __DIR__ . '/..' . '/../lib/CalDAV/CalendarImpl.php', |
|
| 58 | - 'OCA\\DAV\\CalDAV\\CalendarManager' => __DIR__ . '/..' . '/../lib/CalDAV/CalendarManager.php', |
|
| 59 | - 'OCA\\DAV\\CalDAV\\CalendarObject' => __DIR__ . '/..' . '/../lib/CalDAV/CalendarObject.php', |
|
| 60 | - 'OCA\\DAV\\CalDAV\\CalendarRoot' => __DIR__ . '/..' . '/../lib/CalDAV/CalendarRoot.php', |
|
| 61 | - 'OCA\\DAV\\CalDAV\\ICSExportPlugin\\ICSExportPlugin' => __DIR__ . '/..' . '/../lib/CalDAV/ICSExportPlugin/ICSExportPlugin.php', |
|
| 62 | - 'OCA\\DAV\\CalDAV\\Integration\\ExternalCalendar' => __DIR__ . '/..' . '/../lib/CalDAV/Integration/ExternalCalendar.php', |
|
| 63 | - 'OCA\\DAV\\CalDAV\\Integration\\ICalendarProvider' => __DIR__ . '/..' . '/../lib/CalDAV/Integration/ICalendarProvider.php', |
|
| 64 | - 'OCA\\DAV\\CalDAV\\InvitationResponse\\InvitationResponseServer' => __DIR__ . '/..' . '/../lib/CalDAV/InvitationResponse/InvitationResponseServer.php', |
|
| 65 | - 'OCA\\DAV\\CalDAV\\Outbox' => __DIR__ . '/..' . '/../lib/CalDAV/Outbox.php', |
|
| 66 | - 'OCA\\DAV\\CalDAV\\Plugin' => __DIR__ . '/..' . '/../lib/CalDAV/Plugin.php', |
|
| 67 | - 'OCA\\DAV\\CalDAV\\Principal\\Collection' => __DIR__ . '/..' . '/../lib/CalDAV/Principal/Collection.php', |
|
| 68 | - 'OCA\\DAV\\CalDAV\\Principal\\User' => __DIR__ . '/..' . '/../lib/CalDAV/Principal/User.php', |
|
| 69 | - 'OCA\\DAV\\CalDAV\\Proxy\\Proxy' => __DIR__ . '/..' . '/../lib/CalDAV/Proxy/Proxy.php', |
|
| 70 | - 'OCA\\DAV\\CalDAV\\Proxy\\ProxyMapper' => __DIR__ . '/..' . '/../lib/CalDAV/Proxy/ProxyMapper.php', |
|
| 71 | - 'OCA\\DAV\\CalDAV\\PublicCalendar' => __DIR__ . '/..' . '/../lib/CalDAV/PublicCalendar.php', |
|
| 72 | - 'OCA\\DAV\\CalDAV\\PublicCalendarObject' => __DIR__ . '/..' . '/../lib/CalDAV/PublicCalendarObject.php', |
|
| 73 | - 'OCA\\DAV\\CalDAV\\PublicCalendarRoot' => __DIR__ . '/..' . '/../lib/CalDAV/PublicCalendarRoot.php', |
|
| 74 | - 'OCA\\DAV\\CalDAV\\Publishing\\PublishPlugin' => __DIR__ . '/..' . '/../lib/CalDAV/Publishing/PublishPlugin.php', |
|
| 75 | - 'OCA\\DAV\\CalDAV\\Publishing\\Xml\\Publisher' => __DIR__ . '/..' . '/../lib/CalDAV/Publishing/Xml/Publisher.php', |
|
| 76 | - 'OCA\\DAV\\CalDAV\\Reminder\\Backend' => __DIR__ . '/..' . '/../lib/CalDAV/Reminder/Backend.php', |
|
| 77 | - 'OCA\\DAV\\CalDAV\\Reminder\\INotificationProvider' => __DIR__ . '/..' . '/../lib/CalDAV/Reminder/INotificationProvider.php', |
|
| 78 | - 'OCA\\DAV\\CalDAV\\Reminder\\NotificationProviderManager' => __DIR__ . '/..' . '/../lib/CalDAV/Reminder/NotificationProviderManager.php', |
|
| 79 | - 'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\AbstractProvider' => __DIR__ . '/..' . '/../lib/CalDAV/Reminder/NotificationProvider/AbstractProvider.php', |
|
| 80 | - 'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\AudioProvider' => __DIR__ . '/..' . '/../lib/CalDAV/Reminder/NotificationProvider/AudioProvider.php', |
|
| 81 | - 'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\EmailProvider' => __DIR__ . '/..' . '/../lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php', |
|
| 82 | - 'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\ProviderNotAvailableException' => __DIR__ . '/..' . '/../lib/CalDAV/Reminder/NotificationProvider/ProviderNotAvailableException.php', |
|
| 83 | - 'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\PushProvider' => __DIR__ . '/..' . '/../lib/CalDAV/Reminder/NotificationProvider/PushProvider.php', |
|
| 84 | - 'OCA\\DAV\\CalDAV\\Reminder\\NotificationTypeDoesNotExistException' => __DIR__ . '/..' . '/../lib/CalDAV/Reminder/NotificationTypeDoesNotExistException.php', |
|
| 85 | - 'OCA\\DAV\\CalDAV\\Reminder\\Notifier' => __DIR__ . '/..' . '/../lib/CalDAV/Reminder/Notifier.php', |
|
| 86 | - 'OCA\\DAV\\CalDAV\\Reminder\\ReminderService' => __DIR__ . '/..' . '/../lib/CalDAV/Reminder/ReminderService.php', |
|
| 87 | - 'OCA\\DAV\\CalDAV\\ResourceBooking\\AbstractPrincipalBackend' => __DIR__ . '/..' . '/../lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php', |
|
| 88 | - 'OCA\\DAV\\CalDAV\\ResourceBooking\\ResourcePrincipalBackend' => __DIR__ . '/..' . '/../lib/CalDAV/ResourceBooking/ResourcePrincipalBackend.php', |
|
| 89 | - 'OCA\\DAV\\CalDAV\\ResourceBooking\\RoomPrincipalBackend' => __DIR__ . '/..' . '/../lib/CalDAV/ResourceBooking/RoomPrincipalBackend.php', |
|
| 90 | - 'OCA\\DAV\\CalDAV\\Schedule\\IMipPlugin' => __DIR__ . '/..' . '/../lib/CalDAV/Schedule/IMipPlugin.php', |
|
| 91 | - 'OCA\\DAV\\CalDAV\\Schedule\\Plugin' => __DIR__ . '/..' . '/../lib/CalDAV/Schedule/Plugin.php', |
|
| 92 | - 'OCA\\DAV\\CalDAV\\Search\\SearchPlugin' => __DIR__ . '/..' . '/../lib/CalDAV/Search/SearchPlugin.php', |
|
| 93 | - 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\CompFilter' => __DIR__ . '/..' . '/../lib/CalDAV/Search/Xml/Filter/CompFilter.php', |
|
| 94 | - 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\LimitFilter' => __DIR__ . '/..' . '/../lib/CalDAV/Search/Xml/Filter/LimitFilter.php', |
|
| 95 | - 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\OffsetFilter' => __DIR__ . '/..' . '/../lib/CalDAV/Search/Xml/Filter/OffsetFilter.php', |
|
| 96 | - 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\ParamFilter' => __DIR__ . '/..' . '/../lib/CalDAV/Search/Xml/Filter/ParamFilter.php', |
|
| 97 | - 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\PropFilter' => __DIR__ . '/..' . '/../lib/CalDAV/Search/Xml/Filter/PropFilter.php', |
|
| 98 | - 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\SearchTermFilter' => __DIR__ . '/..' . '/../lib/CalDAV/Search/Xml/Filter/SearchTermFilter.php', |
|
| 99 | - 'OCA\\DAV\\CalDAV\\Search\\Xml\\Request\\CalendarSearchReport' => __DIR__ . '/..' . '/../lib/CalDAV/Search/Xml/Request/CalendarSearchReport.php', |
|
| 100 | - 'OCA\\DAV\\CalDAV\\WebcalCaching\\Plugin' => __DIR__ . '/..' . '/../lib/CalDAV/WebcalCaching/Plugin.php', |
|
| 101 | - 'OCA\\DAV\\CalDAV\\WebcalCaching\\RefreshWebcalService' => __DIR__ . '/..' . '/../lib/CalDAV/WebcalCaching/RefreshWebcalService.php', |
|
| 102 | - 'OCA\\DAV\\Capabilities' => __DIR__ . '/..' . '/../lib/Capabilities.php', |
|
| 103 | - 'OCA\\DAV\\CardDAV\\AddressBook' => __DIR__ . '/..' . '/../lib/CardDAV/AddressBook.php', |
|
| 104 | - 'OCA\\DAV\\CardDAV\\AddressBookImpl' => __DIR__ . '/..' . '/../lib/CardDAV/AddressBookImpl.php', |
|
| 105 | - 'OCA\\DAV\\CardDAV\\AddressBookRoot' => __DIR__ . '/..' . '/../lib/CardDAV/AddressBookRoot.php', |
|
| 106 | - 'OCA\\DAV\\CardDAV\\CardDavBackend' => __DIR__ . '/..' . '/../lib/CardDAV/CardDavBackend.php', |
|
| 107 | - 'OCA\\DAV\\CardDAV\\ContactsManager' => __DIR__ . '/..' . '/../lib/CardDAV/ContactsManager.php', |
|
| 108 | - 'OCA\\DAV\\CardDAV\\Converter' => __DIR__ . '/..' . '/../lib/CardDAV/Converter.php', |
|
| 109 | - 'OCA\\DAV\\CardDAV\\HasPhotoPlugin' => __DIR__ . '/..' . '/../lib/CardDAV/HasPhotoPlugin.php', |
|
| 110 | - 'OCA\\DAV\\CardDAV\\ImageExportPlugin' => __DIR__ . '/..' . '/../lib/CardDAV/ImageExportPlugin.php', |
|
| 111 | - 'OCA\\DAV\\CardDAV\\Integration\\ExternalAddressBook' => __DIR__ . '/..' . '/../lib/CardDAV/Integration/ExternalAddressBook.php', |
|
| 112 | - 'OCA\\DAV\\CardDAV\\Integration\\IAddressBookProvider' => __DIR__ . '/..' . '/../lib/CardDAV/Integration/IAddressBookProvider.php', |
|
| 113 | - 'OCA\\DAV\\CardDAV\\MultiGetExportPlugin' => __DIR__ . '/..' . '/../lib/CardDAV/MultiGetExportPlugin.php', |
|
| 114 | - 'OCA\\DAV\\CardDAV\\PhotoCache' => __DIR__ . '/..' . '/../lib/CardDAV/PhotoCache.php', |
|
| 115 | - 'OCA\\DAV\\CardDAV\\Plugin' => __DIR__ . '/..' . '/../lib/CardDAV/Plugin.php', |
|
| 116 | - 'OCA\\DAV\\CardDAV\\SyncService' => __DIR__ . '/..' . '/../lib/CardDAV/SyncService.php', |
|
| 117 | - 'OCA\\DAV\\CardDAV\\SystemAddressbook' => __DIR__ . '/..' . '/../lib/CardDAV/SystemAddressbook.php', |
|
| 118 | - 'OCA\\DAV\\CardDAV\\UserAddressBooks' => __DIR__ . '/..' . '/../lib/CardDAV/UserAddressBooks.php', |
|
| 119 | - 'OCA\\DAV\\CardDAV\\Xml\\Groups' => __DIR__ . '/..' . '/../lib/CardDAV/Xml/Groups.php', |
|
| 120 | - 'OCA\\DAV\\Command\\CreateAddressBook' => __DIR__ . '/..' . '/../lib/Command/CreateAddressBook.php', |
|
| 121 | - 'OCA\\DAV\\Command\\CreateCalendar' => __DIR__ . '/..' . '/../lib/Command/CreateCalendar.php', |
|
| 122 | - 'OCA\\DAV\\Command\\ListCalendars' => __DIR__ . '/..' . '/../lib/Command/ListCalendars.php', |
|
| 123 | - 'OCA\\DAV\\Command\\MoveCalendar' => __DIR__ . '/..' . '/../lib/Command/MoveCalendar.php', |
|
| 124 | - 'OCA\\DAV\\Command\\RemoveInvalidShares' => __DIR__ . '/..' . '/../lib/Command/RemoveInvalidShares.php', |
|
| 125 | - 'OCA\\DAV\\Command\\SendEventReminders' => __DIR__ . '/..' . '/../lib/Command/SendEventReminders.php', |
|
| 126 | - 'OCA\\DAV\\Command\\SyncBirthdayCalendar' => __DIR__ . '/..' . '/../lib/Command/SyncBirthdayCalendar.php', |
|
| 127 | - 'OCA\\DAV\\Command\\SyncSystemAddressBook' => __DIR__ . '/..' . '/../lib/Command/SyncSystemAddressBook.php', |
|
| 128 | - 'OCA\\DAV\\Comments\\CommentNode' => __DIR__ . '/..' . '/../lib/Comments/CommentNode.php', |
|
| 129 | - 'OCA\\DAV\\Comments\\CommentsPlugin' => __DIR__ . '/..' . '/../lib/Comments/CommentsPlugin.php', |
|
| 130 | - 'OCA\\DAV\\Comments\\EntityCollection' => __DIR__ . '/..' . '/../lib/Comments/EntityCollection.php', |
|
| 131 | - 'OCA\\DAV\\Comments\\EntityTypeCollection' => __DIR__ . '/..' . '/../lib/Comments/EntityTypeCollection.php', |
|
| 132 | - 'OCA\\DAV\\Comments\\RootCollection' => __DIR__ . '/..' . '/../lib/Comments/RootCollection.php', |
|
| 133 | - 'OCA\\DAV\\Connector\\LegacyDAVACL' => __DIR__ . '/..' . '/../lib/Connector/LegacyDAVACL.php', |
|
| 134 | - 'OCA\\DAV\\Connector\\PublicAuth' => __DIR__ . '/..' . '/../lib/Connector/PublicAuth.php', |
|
| 135 | - 'OCA\\DAV\\Connector\\Sabre\\AnonymousOptionsPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/AnonymousOptionsPlugin.php', |
|
| 136 | - 'OCA\\DAV\\Connector\\Sabre\\AppEnabledPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/AppEnabledPlugin.php', |
|
| 137 | - 'OCA\\DAV\\Connector\\Sabre\\Auth' => __DIR__ . '/..' . '/../lib/Connector/Sabre/Auth.php', |
|
| 138 | - 'OCA\\DAV\\Connector\\Sabre\\BearerAuth' => __DIR__ . '/..' . '/../lib/Connector/Sabre/BearerAuth.php', |
|
| 139 | - 'OCA\\DAV\\Connector\\Sabre\\BlockLegacyClientPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/BlockLegacyClientPlugin.php', |
|
| 140 | - 'OCA\\DAV\\Connector\\Sabre\\CachingTree' => __DIR__ . '/..' . '/../lib/Connector/Sabre/CachingTree.php', |
|
| 141 | - 'OCA\\DAV\\Connector\\Sabre\\ChecksumList' => __DIR__ . '/..' . '/../lib/Connector/Sabre/ChecksumList.php', |
|
| 142 | - 'OCA\\DAV\\Connector\\Sabre\\CommentPropertiesPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/CommentPropertiesPlugin.php', |
|
| 143 | - 'OCA\\DAV\\Connector\\Sabre\\CopyEtagHeaderPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/CopyEtagHeaderPlugin.php', |
|
| 144 | - 'OCA\\DAV\\Connector\\Sabre\\DavAclPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/DavAclPlugin.php', |
|
| 145 | - 'OCA\\DAV\\Connector\\Sabre\\Directory' => __DIR__ . '/..' . '/../lib/Connector/Sabre/Directory.php', |
|
| 146 | - 'OCA\\DAV\\Connector\\Sabre\\DummyGetResponsePlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/DummyGetResponsePlugin.php', |
|
| 147 | - 'OCA\\DAV\\Connector\\Sabre\\ExceptionLoggerPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/ExceptionLoggerPlugin.php', |
|
| 148 | - 'OCA\\DAV\\Connector\\Sabre\\Exception\\EntityTooLarge' => __DIR__ . '/..' . '/../lib/Connector/Sabre/Exception/EntityTooLarge.php', |
|
| 149 | - 'OCA\\DAV\\Connector\\Sabre\\Exception\\FileLocked' => __DIR__ . '/..' . '/../lib/Connector/Sabre/Exception/FileLocked.php', |
|
| 150 | - 'OCA\\DAV\\Connector\\Sabre\\Exception\\Forbidden' => __DIR__ . '/..' . '/../lib/Connector/Sabre/Exception/Forbidden.php', |
|
| 151 | - 'OCA\\DAV\\Connector\\Sabre\\Exception\\InvalidPath' => __DIR__ . '/..' . '/../lib/Connector/Sabre/Exception/InvalidPath.php', |
|
| 152 | - 'OCA\\DAV\\Connector\\Sabre\\Exception\\PasswordLoginForbidden' => __DIR__ . '/..' . '/../lib/Connector/Sabre/Exception/PasswordLoginForbidden.php', |
|
| 153 | - 'OCA\\DAV\\Connector\\Sabre\\Exception\\UnsupportedMediaType' => __DIR__ . '/..' . '/../lib/Connector/Sabre/Exception/UnsupportedMediaType.php', |
|
| 154 | - 'OCA\\DAV\\Connector\\Sabre\\FakeLockerPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/FakeLockerPlugin.php', |
|
| 155 | - 'OCA\\DAV\\Connector\\Sabre\\File' => __DIR__ . '/..' . '/../lib/Connector/Sabre/File.php', |
|
| 156 | - 'OCA\\DAV\\Connector\\Sabre\\FilesPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/FilesPlugin.php', |
|
| 157 | - 'OCA\\DAV\\Connector\\Sabre\\FilesReportPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/FilesReportPlugin.php', |
|
| 158 | - 'OCA\\DAV\\Connector\\Sabre\\LockPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/LockPlugin.php', |
|
| 159 | - 'OCA\\DAV\\Connector\\Sabre\\MaintenancePlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/MaintenancePlugin.php', |
|
| 160 | - 'OCA\\DAV\\Connector\\Sabre\\Node' => __DIR__ . '/..' . '/../lib/Connector/Sabre/Node.php', |
|
| 161 | - 'OCA\\DAV\\Connector\\Sabre\\ObjectTree' => __DIR__ . '/..' . '/../lib/Connector/Sabre/ObjectTree.php', |
|
| 162 | - 'OCA\\DAV\\Connector\\Sabre\\Principal' => __DIR__ . '/..' . '/../lib/Connector/Sabre/Principal.php', |
|
| 163 | - 'OCA\\DAV\\Connector\\Sabre\\PropfindCompressionPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/PropfindCompressionPlugin.php', |
|
| 164 | - 'OCA\\DAV\\Connector\\Sabre\\QuotaPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/QuotaPlugin.php', |
|
| 165 | - 'OCA\\DAV\\Connector\\Sabre\\Server' => __DIR__ . '/..' . '/../lib/Connector/Sabre/Server.php', |
|
| 166 | - 'OCA\\DAV\\Connector\\Sabre\\ServerFactory' => __DIR__ . '/..' . '/../lib/Connector/Sabre/ServerFactory.php', |
|
| 167 | - 'OCA\\DAV\\Connector\\Sabre\\ShareTypeList' => __DIR__ . '/..' . '/../lib/Connector/Sabre/ShareTypeList.php', |
|
| 168 | - 'OCA\\DAV\\Connector\\Sabre\\ShareeList' => __DIR__ . '/..' . '/../lib/Connector/Sabre/ShareeList.php', |
|
| 169 | - 'OCA\\DAV\\Connector\\Sabre\\SharesPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/SharesPlugin.php', |
|
| 170 | - 'OCA\\DAV\\Connector\\Sabre\\TagList' => __DIR__ . '/..' . '/../lib/Connector/Sabre/TagList.php', |
|
| 171 | - 'OCA\\DAV\\Connector\\Sabre\\TagsPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/TagsPlugin.php', |
|
| 172 | - 'OCA\\DAV\\Controller\\BirthdayCalendarController' => __DIR__ . '/..' . '/../lib/Controller/BirthdayCalendarController.php', |
|
| 173 | - 'OCA\\DAV\\Controller\\DirectController' => __DIR__ . '/..' . '/../lib/Controller/DirectController.php', |
|
| 174 | - 'OCA\\DAV\\Controller\\InvitationResponseController' => __DIR__ . '/..' . '/../lib/Controller/InvitationResponseController.php', |
|
| 175 | - 'OCA\\DAV\\DAV\\CustomPropertiesBackend' => __DIR__ . '/..' . '/../lib/DAV/CustomPropertiesBackend.php', |
|
| 176 | - 'OCA\\DAV\\DAV\\GroupPrincipalBackend' => __DIR__ . '/..' . '/../lib/DAV/GroupPrincipalBackend.php', |
|
| 177 | - 'OCA\\DAV\\DAV\\PublicAuth' => __DIR__ . '/..' . '/../lib/DAV/PublicAuth.php', |
|
| 178 | - 'OCA\\DAV\\DAV\\Sharing\\Backend' => __DIR__ . '/..' . '/../lib/DAV/Sharing/Backend.php', |
|
| 179 | - 'OCA\\DAV\\DAV\\Sharing\\IShareable' => __DIR__ . '/..' . '/../lib/DAV/Sharing/IShareable.php', |
|
| 180 | - 'OCA\\DAV\\DAV\\Sharing\\Plugin' => __DIR__ . '/..' . '/../lib/DAV/Sharing/Plugin.php', |
|
| 181 | - 'OCA\\DAV\\DAV\\Sharing\\Xml\\Invite' => __DIR__ . '/..' . '/../lib/DAV/Sharing/Xml/Invite.php', |
|
| 182 | - 'OCA\\DAV\\DAV\\Sharing\\Xml\\ShareRequest' => __DIR__ . '/..' . '/../lib/DAV/Sharing/Xml/ShareRequest.php', |
|
| 183 | - 'OCA\\DAV\\DAV\\SystemPrincipalBackend' => __DIR__ . '/..' . '/../lib/DAV/SystemPrincipalBackend.php', |
|
| 184 | - 'OCA\\DAV\\Db\\Direct' => __DIR__ . '/..' . '/../lib/Db/Direct.php', |
|
| 185 | - 'OCA\\DAV\\Db\\DirectMapper' => __DIR__ . '/..' . '/../lib/Db/DirectMapper.php', |
|
| 186 | - 'OCA\\DAV\\Direct\\DirectFile' => __DIR__ . '/..' . '/../lib/Direct/DirectFile.php', |
|
| 187 | - 'OCA\\DAV\\Direct\\DirectHome' => __DIR__ . '/..' . '/../lib/Direct/DirectHome.php', |
|
| 188 | - 'OCA\\DAV\\Direct\\Server' => __DIR__ . '/..' . '/../lib/Direct/Server.php', |
|
| 189 | - 'OCA\\DAV\\Direct\\ServerFactory' => __DIR__ . '/..' . '/../lib/Direct/ServerFactory.php', |
|
| 190 | - 'OCA\\DAV\\Events\\AddressBookCreatedEvent' => __DIR__ . '/..' . '/../lib/Events/AddressBookCreatedEvent.php', |
|
| 191 | - 'OCA\\DAV\\Events\\AddressBookDeletedEvent' => __DIR__ . '/..' . '/../lib/Events/AddressBookDeletedEvent.php', |
|
| 192 | - 'OCA\\DAV\\Events\\AddressBookShareUpdatedEvent' => __DIR__ . '/..' . '/../lib/Events/AddressBookShareUpdatedEvent.php', |
|
| 193 | - 'OCA\\DAV\\Events\\AddressBookUpdatedEvent' => __DIR__ . '/..' . '/../lib/Events/AddressBookUpdatedEvent.php', |
|
| 194 | - 'OCA\\DAV\\Events\\BeforeFileDirectDownloadedEvent' => __DIR__ . '/..' . '/../lib/Events/BeforeFileDirectDownloadedEvent.php', |
|
| 195 | - 'OCA\\DAV\\Events\\CachedCalendarObjectCreatedEvent' => __DIR__ . '/..' . '/../lib/Events/CachedCalendarObjectCreatedEvent.php', |
|
| 196 | - 'OCA\\DAV\\Events\\CachedCalendarObjectDeletedEvent' => __DIR__ . '/..' . '/../lib/Events/CachedCalendarObjectDeletedEvent.php', |
|
| 197 | - 'OCA\\DAV\\Events\\CachedCalendarObjectUpdatedEvent' => __DIR__ . '/..' . '/../lib/Events/CachedCalendarObjectUpdatedEvent.php', |
|
| 198 | - 'OCA\\DAV\\Events\\CalendarCreatedEvent' => __DIR__ . '/..' . '/../lib/Events/CalendarCreatedEvent.php', |
|
| 199 | - 'OCA\\DAV\\Events\\CalendarDeletedEvent' => __DIR__ . '/..' . '/../lib/Events/CalendarDeletedEvent.php', |
|
| 200 | - 'OCA\\DAV\\Events\\CalendarObjectCreatedEvent' => __DIR__ . '/..' . '/../lib/Events/CalendarObjectCreatedEvent.php', |
|
| 201 | - 'OCA\\DAV\\Events\\CalendarObjectDeletedEvent' => __DIR__ . '/..' . '/../lib/Events/CalendarObjectDeletedEvent.php', |
|
| 202 | - 'OCA\\DAV\\Events\\CalendarObjectUpdatedEvent' => __DIR__ . '/..' . '/../lib/Events/CalendarObjectUpdatedEvent.php', |
|
| 203 | - 'OCA\\DAV\\Events\\CalendarPublishedEvent' => __DIR__ . '/..' . '/../lib/Events/CalendarPublishedEvent.php', |
|
| 204 | - 'OCA\\DAV\\Events\\CalendarShareUpdatedEvent' => __DIR__ . '/..' . '/../lib/Events/CalendarShareUpdatedEvent.php', |
|
| 205 | - 'OCA\\DAV\\Events\\CalendarUnpublishedEvent' => __DIR__ . '/..' . '/../lib/Events/CalendarUnpublishedEvent.php', |
|
| 206 | - 'OCA\\DAV\\Events\\CalendarUpdatedEvent' => __DIR__ . '/..' . '/../lib/Events/CalendarUpdatedEvent.php', |
|
| 207 | - 'OCA\\DAV\\Events\\CardCreatedEvent' => __DIR__ . '/..' . '/../lib/Events/CardCreatedEvent.php', |
|
| 208 | - 'OCA\\DAV\\Events\\CardDeletedEvent' => __DIR__ . '/..' . '/../lib/Events/CardDeletedEvent.php', |
|
| 209 | - 'OCA\\DAV\\Events\\CardUpdatedEvent' => __DIR__ . '/..' . '/../lib/Events/CardUpdatedEvent.php', |
|
| 210 | - 'OCA\\DAV\\Events\\SabrePluginAuthInitEvent' => __DIR__ . '/..' . '/../lib/Events/SabrePluginAuthInitEvent.php', |
|
| 211 | - 'OCA\\DAV\\Events\\SubscriptionCreatedEvent' => __DIR__ . '/..' . '/../lib/Events/SubscriptionCreatedEvent.php', |
|
| 212 | - 'OCA\\DAV\\Events\\SubscriptionDeletedEvent' => __DIR__ . '/..' . '/../lib/Events/SubscriptionDeletedEvent.php', |
|
| 213 | - 'OCA\\DAV\\Events\\SubscriptionUpdatedEvent' => __DIR__ . '/..' . '/../lib/Events/SubscriptionUpdatedEvent.php', |
|
| 214 | - 'OCA\\DAV\\Exception\\UnsupportedLimitOnInitialSyncException' => __DIR__ . '/..' . '/../lib/Exception/UnsupportedLimitOnInitialSyncException.php', |
|
| 215 | - 'OCA\\DAV\\Files\\BrowserErrorPagePlugin' => __DIR__ . '/..' . '/../lib/Files/BrowserErrorPagePlugin.php', |
|
| 216 | - 'OCA\\DAV\\Files\\FileSearchBackend' => __DIR__ . '/..' . '/../lib/Files/FileSearchBackend.php', |
|
| 217 | - 'OCA\\DAV\\Files\\FilesHome' => __DIR__ . '/..' . '/../lib/Files/FilesHome.php', |
|
| 218 | - 'OCA\\DAV\\Files\\LazySearchBackend' => __DIR__ . '/..' . '/../lib/Files/LazySearchBackend.php', |
|
| 219 | - 'OCA\\DAV\\Files\\RootCollection' => __DIR__ . '/..' . '/../lib/Files/RootCollection.php', |
|
| 220 | - 'OCA\\DAV\\Files\\Sharing\\FilesDropPlugin' => __DIR__ . '/..' . '/../lib/Files/Sharing/FilesDropPlugin.php', |
|
| 221 | - 'OCA\\DAV\\Files\\Sharing\\PublicLinkCheckPlugin' => __DIR__ . '/..' . '/../lib/Files/Sharing/PublicLinkCheckPlugin.php', |
|
| 222 | - 'OCA\\DAV\\HookManager' => __DIR__ . '/..' . '/../lib/HookManager.php', |
|
| 223 | - 'OCA\\DAV\\Listener\\ActivityUpdaterListener' => __DIR__ . '/..' . '/../lib/Listener/ActivityUpdaterListener.php', |
|
| 224 | - 'OCA\\DAV\\Listener\\CalendarContactInteractionListener' => __DIR__ . '/..' . '/../lib/Listener/CalendarContactInteractionListener.php', |
|
| 225 | - 'OCA\\DAV\\Listener\\CalendarDeletionDefaultUpdaterListener' => __DIR__ . '/..' . '/../lib/Listener/CalendarDeletionDefaultUpdaterListener.php', |
|
| 226 | - 'OCA\\DAV\\Listener\\CalendarObjectReminderUpdaterListener' => __DIR__ . '/..' . '/../lib/Listener/CalendarObjectReminderUpdaterListener.php', |
|
| 227 | - 'OCA\\DAV\\Migration\\BuildCalendarSearchIndex' => __DIR__ . '/..' . '/../lib/Migration/BuildCalendarSearchIndex.php', |
|
| 228 | - 'OCA\\DAV\\Migration\\BuildCalendarSearchIndexBackgroundJob' => __DIR__ . '/..' . '/../lib/Migration/BuildCalendarSearchIndexBackgroundJob.php', |
|
| 229 | - 'OCA\\DAV\\Migration\\BuildSocialSearchIndex' => __DIR__ . '/..' . '/../lib/Migration/BuildSocialSearchIndex.php', |
|
| 230 | - 'OCA\\DAV\\Migration\\BuildSocialSearchIndexBackgroundJob' => __DIR__ . '/..' . '/../lib/Migration/BuildSocialSearchIndexBackgroundJob.php', |
|
| 231 | - 'OCA\\DAV\\Migration\\CalDAVRemoveEmptyValue' => __DIR__ . '/..' . '/../lib/Migration/CalDAVRemoveEmptyValue.php', |
|
| 232 | - 'OCA\\DAV\\Migration\\ChunkCleanup' => __DIR__ . '/..' . '/../lib/Migration/ChunkCleanup.php', |
|
| 233 | - 'OCA\\DAV\\Migration\\FixBirthdayCalendarComponent' => __DIR__ . '/..' . '/../lib/Migration/FixBirthdayCalendarComponent.php', |
|
| 234 | - 'OCA\\DAV\\Migration\\RefreshWebcalJobRegistrar' => __DIR__ . '/..' . '/../lib/Migration/RefreshWebcalJobRegistrar.php', |
|
| 235 | - 'OCA\\DAV\\Migration\\RegenerateBirthdayCalendars' => __DIR__ . '/..' . '/../lib/Migration/RegenerateBirthdayCalendars.php', |
|
| 236 | - 'OCA\\DAV\\Migration\\RegisterBuildReminderIndexBackgroundJob' => __DIR__ . '/..' . '/../lib/Migration/RegisterBuildReminderIndexBackgroundJob.php', |
|
| 237 | - 'OCA\\DAV\\Migration\\RemoveClassifiedEventActivity' => __DIR__ . '/..' . '/../lib/Migration/RemoveClassifiedEventActivity.php', |
|
| 238 | - 'OCA\\DAV\\Migration\\RemoveOrphanEventsAndContacts' => __DIR__ . '/..' . '/../lib/Migration/RemoveOrphanEventsAndContacts.php', |
|
| 239 | - 'OCA\\DAV\\Migration\\Version1004Date20170825134824' => __DIR__ . '/..' . '/../lib/Migration/Version1004Date20170825134824.php', |
|
| 240 | - 'OCA\\DAV\\Migration\\Version1004Date20170919104507' => __DIR__ . '/..' . '/../lib/Migration/Version1004Date20170919104507.php', |
|
| 241 | - 'OCA\\DAV\\Migration\\Version1004Date20170924124212' => __DIR__ . '/..' . '/../lib/Migration/Version1004Date20170924124212.php', |
|
| 242 | - 'OCA\\DAV\\Migration\\Version1004Date20170926103422' => __DIR__ . '/..' . '/../lib/Migration/Version1004Date20170926103422.php', |
|
| 243 | - 'OCA\\DAV\\Migration\\Version1005Date20180413093149' => __DIR__ . '/..' . '/../lib/Migration/Version1005Date20180413093149.php', |
|
| 244 | - 'OCA\\DAV\\Migration\\Version1005Date20180530124431' => __DIR__ . '/..' . '/../lib/Migration/Version1005Date20180530124431.php', |
|
| 245 | - 'OCA\\DAV\\Migration\\Version1006Date20180619154313' => __DIR__ . '/..' . '/../lib/Migration/Version1006Date20180619154313.php', |
|
| 246 | - 'OCA\\DAV\\Migration\\Version1006Date20180628111625' => __DIR__ . '/..' . '/../lib/Migration/Version1006Date20180628111625.php', |
|
| 247 | - 'OCA\\DAV\\Migration\\Version1008Date20181030113700' => __DIR__ . '/..' . '/../lib/Migration/Version1008Date20181030113700.php', |
|
| 248 | - 'OCA\\DAV\\Migration\\Version1008Date20181105104826' => __DIR__ . '/..' . '/../lib/Migration/Version1008Date20181105104826.php', |
|
| 249 | - 'OCA\\DAV\\Migration\\Version1008Date20181105104833' => __DIR__ . '/..' . '/../lib/Migration/Version1008Date20181105104833.php', |
|
| 250 | - 'OCA\\DAV\\Migration\\Version1008Date20181105110300' => __DIR__ . '/..' . '/../lib/Migration/Version1008Date20181105110300.php', |
|
| 251 | - 'OCA\\DAV\\Migration\\Version1008Date20181105112049' => __DIR__ . '/..' . '/../lib/Migration/Version1008Date20181105112049.php', |
|
| 252 | - 'OCA\\DAV\\Migration\\Version1008Date20181114084440' => __DIR__ . '/..' . '/../lib/Migration/Version1008Date20181114084440.php', |
|
| 253 | - 'OCA\\DAV\\Migration\\Version1011Date20190725113607' => __DIR__ . '/..' . '/../lib/Migration/Version1011Date20190725113607.php', |
|
| 254 | - 'OCA\\DAV\\Migration\\Version1011Date20190806104428' => __DIR__ . '/..' . '/../lib/Migration/Version1011Date20190806104428.php', |
|
| 255 | - 'OCA\\DAV\\Migration\\Version1012Date20190808122342' => __DIR__ . '/..' . '/../lib/Migration/Version1012Date20190808122342.php', |
|
| 256 | - 'OCA\\DAV\\Migration\\Version1016Date20201109085907' => __DIR__ . '/..' . '/../lib/Migration/Version1016Date20201109085907.php', |
|
| 257 | - 'OCA\\DAV\\Migration\\Version1017Date20210216083742' => __DIR__ . '/..' . '/../lib/Migration/Version1017Date20210216083742.php', |
|
| 258 | - 'OCA\\DAV\\Provisioning\\Apple\\AppleProvisioningNode' => __DIR__ . '/..' . '/../lib/Provisioning/Apple/AppleProvisioningNode.php', |
|
| 259 | - 'OCA\\DAV\\Provisioning\\Apple\\AppleProvisioningPlugin' => __DIR__ . '/..' . '/../lib/Provisioning/Apple/AppleProvisioningPlugin.php', |
|
| 260 | - 'OCA\\DAV\\RootCollection' => __DIR__ . '/..' . '/../lib/RootCollection.php', |
|
| 261 | - 'OCA\\DAV\\Search\\ACalendarSearchProvider' => __DIR__ . '/..' . '/../lib/Search/ACalendarSearchProvider.php', |
|
| 262 | - 'OCA\\DAV\\Search\\ContactsSearchProvider' => __DIR__ . '/..' . '/../lib/Search/ContactsSearchProvider.php', |
|
| 263 | - 'OCA\\DAV\\Search\\EventsSearchProvider' => __DIR__ . '/..' . '/../lib/Search/EventsSearchProvider.php', |
|
| 264 | - 'OCA\\DAV\\Search\\TasksSearchProvider' => __DIR__ . '/..' . '/../lib/Search/TasksSearchProvider.php', |
|
| 265 | - 'OCA\\DAV\\Server' => __DIR__ . '/..' . '/../lib/Server.php', |
|
| 266 | - 'OCA\\DAV\\Settings\\CalDAVSettings' => __DIR__ . '/..' . '/../lib/Settings/CalDAVSettings.php', |
|
| 267 | - 'OCA\\DAV\\Storage\\PublicOwnerWrapper' => __DIR__ . '/..' . '/../lib/Storage/PublicOwnerWrapper.php', |
|
| 268 | - 'OCA\\DAV\\SystemTag\\SystemTagMappingNode' => __DIR__ . '/..' . '/../lib/SystemTag/SystemTagMappingNode.php', |
|
| 269 | - 'OCA\\DAV\\SystemTag\\SystemTagNode' => __DIR__ . '/..' . '/../lib/SystemTag/SystemTagNode.php', |
|
| 270 | - 'OCA\\DAV\\SystemTag\\SystemTagPlugin' => __DIR__ . '/..' . '/../lib/SystemTag/SystemTagPlugin.php', |
|
| 271 | - 'OCA\\DAV\\SystemTag\\SystemTagsByIdCollection' => __DIR__ . '/..' . '/../lib/SystemTag/SystemTagsByIdCollection.php', |
|
| 272 | - 'OCA\\DAV\\SystemTag\\SystemTagsObjectMappingCollection' => __DIR__ . '/..' . '/../lib/SystemTag/SystemTagsObjectMappingCollection.php', |
|
| 273 | - 'OCA\\DAV\\SystemTag\\SystemTagsObjectTypeCollection' => __DIR__ . '/..' . '/../lib/SystemTag/SystemTagsObjectTypeCollection.php', |
|
| 274 | - 'OCA\\DAV\\SystemTag\\SystemTagsRelationsCollection' => __DIR__ . '/..' . '/../lib/SystemTag/SystemTagsRelationsCollection.php', |
|
| 275 | - 'OCA\\DAV\\Traits\\PrincipalProxyTrait' => __DIR__ . '/..' . '/../lib/Traits/PrincipalProxyTrait.php', |
|
| 276 | - 'OCA\\DAV\\Upload\\AssemblyStream' => __DIR__ . '/..' . '/../lib/Upload/AssemblyStream.php', |
|
| 277 | - 'OCA\\DAV\\Upload\\ChunkingPlugin' => __DIR__ . '/..' . '/../lib/Upload/ChunkingPlugin.php', |
|
| 278 | - 'OCA\\DAV\\Upload\\CleanupService' => __DIR__ . '/..' . '/../lib/Upload/CleanupService.php', |
|
| 279 | - 'OCA\\DAV\\Upload\\FutureFile' => __DIR__ . '/..' . '/../lib/Upload/FutureFile.php', |
|
| 280 | - 'OCA\\DAV\\Upload\\RootCollection' => __DIR__ . '/..' . '/../lib/Upload/RootCollection.php', |
|
| 281 | - 'OCA\\DAV\\Upload\\UploadFile' => __DIR__ . '/..' . '/../lib/Upload/UploadFile.php', |
|
| 282 | - 'OCA\\DAV\\Upload\\UploadFolder' => __DIR__ . '/..' . '/../lib/Upload/UploadFolder.php', |
|
| 283 | - 'OCA\\DAV\\Upload\\UploadHome' => __DIR__ . '/..' . '/../lib/Upload/UploadHome.php', |
|
| 23 | + public static $classMap = array( |
|
| 24 | + 'Composer\\InstalledVersions' => __DIR__.'/..'.'/composer/InstalledVersions.php', |
|
| 25 | + 'OCA\\DAV\\AppInfo\\Application' => __DIR__.'/..'.'/../lib/AppInfo/Application.php', |
|
| 26 | + 'OCA\\DAV\\AppInfo\\PluginManager' => __DIR__.'/..'.'/../lib/AppInfo/PluginManager.php', |
|
| 27 | + 'OCA\\DAV\\Avatars\\AvatarHome' => __DIR__.'/..'.'/../lib/Avatars/AvatarHome.php', |
|
| 28 | + 'OCA\\DAV\\Avatars\\AvatarNode' => __DIR__.'/..'.'/../lib/Avatars/AvatarNode.php', |
|
| 29 | + 'OCA\\DAV\\Avatars\\RootCollection' => __DIR__.'/..'.'/../lib/Avatars/RootCollection.php', |
|
| 30 | + 'OCA\\DAV\\BackgroundJob\\BuildReminderIndexBackgroundJob' => __DIR__.'/..'.'/../lib/BackgroundJob/BuildReminderIndexBackgroundJob.php', |
|
| 31 | + 'OCA\\DAV\\BackgroundJob\\CleanupDirectLinksJob' => __DIR__.'/..'.'/../lib/BackgroundJob/CleanupDirectLinksJob.php', |
|
| 32 | + 'OCA\\DAV\\BackgroundJob\\CleanupInvitationTokenJob' => __DIR__.'/..'.'/../lib/BackgroundJob/CleanupInvitationTokenJob.php', |
|
| 33 | + 'OCA\\DAV\\BackgroundJob\\EventReminderJob' => __DIR__.'/..'.'/../lib/BackgroundJob/EventReminderJob.php', |
|
| 34 | + 'OCA\\DAV\\BackgroundJob\\GenerateBirthdayCalendarBackgroundJob' => __DIR__.'/..'.'/../lib/BackgroundJob/GenerateBirthdayCalendarBackgroundJob.php', |
|
| 35 | + 'OCA\\DAV\\BackgroundJob\\RefreshWebcalJob' => __DIR__.'/..'.'/../lib/BackgroundJob/RefreshWebcalJob.php', |
|
| 36 | + 'OCA\\DAV\\BackgroundJob\\RegisterRegenerateBirthdayCalendars' => __DIR__.'/..'.'/../lib/BackgroundJob/RegisterRegenerateBirthdayCalendars.php', |
|
| 37 | + 'OCA\\DAV\\BackgroundJob\\UpdateCalendarResourcesRoomsBackgroundJob' => __DIR__.'/..'.'/../lib/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJob.php', |
|
| 38 | + 'OCA\\DAV\\BackgroundJob\\UploadCleanup' => __DIR__.'/..'.'/../lib/BackgroundJob/UploadCleanup.php', |
|
| 39 | + 'OCA\\DAV\\CalDAV\\Activity\\Backend' => __DIR__.'/..'.'/../lib/CalDAV/Activity/Backend.php', |
|
| 40 | + 'OCA\\DAV\\CalDAV\\Activity\\Filter\\Calendar' => __DIR__.'/..'.'/../lib/CalDAV/Activity/Filter/Calendar.php', |
|
| 41 | + 'OCA\\DAV\\CalDAV\\Activity\\Filter\\Todo' => __DIR__.'/..'.'/../lib/CalDAV/Activity/Filter/Todo.php', |
|
| 42 | + 'OCA\\DAV\\CalDAV\\Activity\\Provider\\Base' => __DIR__.'/..'.'/../lib/CalDAV/Activity/Provider/Base.php', |
|
| 43 | + 'OCA\\DAV\\CalDAV\\Activity\\Provider\\Calendar' => __DIR__.'/..'.'/../lib/CalDAV/Activity/Provider/Calendar.php', |
|
| 44 | + 'OCA\\DAV\\CalDAV\\Activity\\Provider\\Event' => __DIR__.'/..'.'/../lib/CalDAV/Activity/Provider/Event.php', |
|
| 45 | + 'OCA\\DAV\\CalDAV\\Activity\\Provider\\Todo' => __DIR__.'/..'.'/../lib/CalDAV/Activity/Provider/Todo.php', |
|
| 46 | + 'OCA\\DAV\\CalDAV\\Activity\\Setting\\CalDAVSetting' => __DIR__.'/..'.'/../lib/CalDAV/Activity/Setting/CalDAVSetting.php', |
|
| 47 | + 'OCA\\DAV\\CalDAV\\Activity\\Setting\\Calendar' => __DIR__.'/..'.'/../lib/CalDAV/Activity/Setting/Calendar.php', |
|
| 48 | + 'OCA\\DAV\\CalDAV\\Activity\\Setting\\Event' => __DIR__.'/..'.'/../lib/CalDAV/Activity/Setting/Event.php', |
|
| 49 | + 'OCA\\DAV\\CalDAV\\Activity\\Setting\\Todo' => __DIR__.'/..'.'/../lib/CalDAV/Activity/Setting/Todo.php', |
|
| 50 | + 'OCA\\DAV\\CalDAV\\BirthdayCalendar\\EnablePlugin' => __DIR__.'/..'.'/../lib/CalDAV/BirthdayCalendar/EnablePlugin.php', |
|
| 51 | + 'OCA\\DAV\\CalDAV\\BirthdayService' => __DIR__.'/..'.'/../lib/CalDAV/BirthdayService.php', |
|
| 52 | + 'OCA\\DAV\\CalDAV\\CachedSubscription' => __DIR__.'/..'.'/../lib/CalDAV/CachedSubscription.php', |
|
| 53 | + 'OCA\\DAV\\CalDAV\\CachedSubscriptionObject' => __DIR__.'/..'.'/../lib/CalDAV/CachedSubscriptionObject.php', |
|
| 54 | + 'OCA\\DAV\\CalDAV\\CalDavBackend' => __DIR__.'/..'.'/../lib/CalDAV/CalDavBackend.php', |
|
| 55 | + 'OCA\\DAV\\CalDAV\\Calendar' => __DIR__.'/..'.'/../lib/CalDAV/Calendar.php', |
|
| 56 | + 'OCA\\DAV\\CalDAV\\CalendarHome' => __DIR__.'/..'.'/../lib/CalDAV/CalendarHome.php', |
|
| 57 | + 'OCA\\DAV\\CalDAV\\CalendarImpl' => __DIR__.'/..'.'/../lib/CalDAV/CalendarImpl.php', |
|
| 58 | + 'OCA\\DAV\\CalDAV\\CalendarManager' => __DIR__.'/..'.'/../lib/CalDAV/CalendarManager.php', |
|
| 59 | + 'OCA\\DAV\\CalDAV\\CalendarObject' => __DIR__.'/..'.'/../lib/CalDAV/CalendarObject.php', |
|
| 60 | + 'OCA\\DAV\\CalDAV\\CalendarRoot' => __DIR__.'/..'.'/../lib/CalDAV/CalendarRoot.php', |
|
| 61 | + 'OCA\\DAV\\CalDAV\\ICSExportPlugin\\ICSExportPlugin' => __DIR__.'/..'.'/../lib/CalDAV/ICSExportPlugin/ICSExportPlugin.php', |
|
| 62 | + 'OCA\\DAV\\CalDAV\\Integration\\ExternalCalendar' => __DIR__.'/..'.'/../lib/CalDAV/Integration/ExternalCalendar.php', |
|
| 63 | + 'OCA\\DAV\\CalDAV\\Integration\\ICalendarProvider' => __DIR__.'/..'.'/../lib/CalDAV/Integration/ICalendarProvider.php', |
|
| 64 | + 'OCA\\DAV\\CalDAV\\InvitationResponse\\InvitationResponseServer' => __DIR__.'/..'.'/../lib/CalDAV/InvitationResponse/InvitationResponseServer.php', |
|
| 65 | + 'OCA\\DAV\\CalDAV\\Outbox' => __DIR__.'/..'.'/../lib/CalDAV/Outbox.php', |
|
| 66 | + 'OCA\\DAV\\CalDAV\\Plugin' => __DIR__.'/..'.'/../lib/CalDAV/Plugin.php', |
|
| 67 | + 'OCA\\DAV\\CalDAV\\Principal\\Collection' => __DIR__.'/..'.'/../lib/CalDAV/Principal/Collection.php', |
|
| 68 | + 'OCA\\DAV\\CalDAV\\Principal\\User' => __DIR__.'/..'.'/../lib/CalDAV/Principal/User.php', |
|
| 69 | + 'OCA\\DAV\\CalDAV\\Proxy\\Proxy' => __DIR__.'/..'.'/../lib/CalDAV/Proxy/Proxy.php', |
|
| 70 | + 'OCA\\DAV\\CalDAV\\Proxy\\ProxyMapper' => __DIR__.'/..'.'/../lib/CalDAV/Proxy/ProxyMapper.php', |
|
| 71 | + 'OCA\\DAV\\CalDAV\\PublicCalendar' => __DIR__.'/..'.'/../lib/CalDAV/PublicCalendar.php', |
|
| 72 | + 'OCA\\DAV\\CalDAV\\PublicCalendarObject' => __DIR__.'/..'.'/../lib/CalDAV/PublicCalendarObject.php', |
|
| 73 | + 'OCA\\DAV\\CalDAV\\PublicCalendarRoot' => __DIR__.'/..'.'/../lib/CalDAV/PublicCalendarRoot.php', |
|
| 74 | + 'OCA\\DAV\\CalDAV\\Publishing\\PublishPlugin' => __DIR__.'/..'.'/../lib/CalDAV/Publishing/PublishPlugin.php', |
|
| 75 | + 'OCA\\DAV\\CalDAV\\Publishing\\Xml\\Publisher' => __DIR__.'/..'.'/../lib/CalDAV/Publishing/Xml/Publisher.php', |
|
| 76 | + 'OCA\\DAV\\CalDAV\\Reminder\\Backend' => __DIR__.'/..'.'/../lib/CalDAV/Reminder/Backend.php', |
|
| 77 | + 'OCA\\DAV\\CalDAV\\Reminder\\INotificationProvider' => __DIR__.'/..'.'/../lib/CalDAV/Reminder/INotificationProvider.php', |
|
| 78 | + 'OCA\\DAV\\CalDAV\\Reminder\\NotificationProviderManager' => __DIR__.'/..'.'/../lib/CalDAV/Reminder/NotificationProviderManager.php', |
|
| 79 | + 'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\AbstractProvider' => __DIR__.'/..'.'/../lib/CalDAV/Reminder/NotificationProvider/AbstractProvider.php', |
|
| 80 | + 'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\AudioProvider' => __DIR__.'/..'.'/../lib/CalDAV/Reminder/NotificationProvider/AudioProvider.php', |
|
| 81 | + 'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\EmailProvider' => __DIR__.'/..'.'/../lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php', |
|
| 82 | + 'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\ProviderNotAvailableException' => __DIR__.'/..'.'/../lib/CalDAV/Reminder/NotificationProvider/ProviderNotAvailableException.php', |
|
| 83 | + 'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\PushProvider' => __DIR__.'/..'.'/../lib/CalDAV/Reminder/NotificationProvider/PushProvider.php', |
|
| 84 | + 'OCA\\DAV\\CalDAV\\Reminder\\NotificationTypeDoesNotExistException' => __DIR__.'/..'.'/../lib/CalDAV/Reminder/NotificationTypeDoesNotExistException.php', |
|
| 85 | + 'OCA\\DAV\\CalDAV\\Reminder\\Notifier' => __DIR__.'/..'.'/../lib/CalDAV/Reminder/Notifier.php', |
|
| 86 | + 'OCA\\DAV\\CalDAV\\Reminder\\ReminderService' => __DIR__.'/..'.'/../lib/CalDAV/Reminder/ReminderService.php', |
|
| 87 | + 'OCA\\DAV\\CalDAV\\ResourceBooking\\AbstractPrincipalBackend' => __DIR__.'/..'.'/../lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php', |
|
| 88 | + 'OCA\\DAV\\CalDAV\\ResourceBooking\\ResourcePrincipalBackend' => __DIR__.'/..'.'/../lib/CalDAV/ResourceBooking/ResourcePrincipalBackend.php', |
|
| 89 | + 'OCA\\DAV\\CalDAV\\ResourceBooking\\RoomPrincipalBackend' => __DIR__.'/..'.'/../lib/CalDAV/ResourceBooking/RoomPrincipalBackend.php', |
|
| 90 | + 'OCA\\DAV\\CalDAV\\Schedule\\IMipPlugin' => __DIR__.'/..'.'/../lib/CalDAV/Schedule/IMipPlugin.php', |
|
| 91 | + 'OCA\\DAV\\CalDAV\\Schedule\\Plugin' => __DIR__.'/..'.'/../lib/CalDAV/Schedule/Plugin.php', |
|
| 92 | + 'OCA\\DAV\\CalDAV\\Search\\SearchPlugin' => __DIR__.'/..'.'/../lib/CalDAV/Search/SearchPlugin.php', |
|
| 93 | + 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\CompFilter' => __DIR__.'/..'.'/../lib/CalDAV/Search/Xml/Filter/CompFilter.php', |
|
| 94 | + 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\LimitFilter' => __DIR__.'/..'.'/../lib/CalDAV/Search/Xml/Filter/LimitFilter.php', |
|
| 95 | + 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\OffsetFilter' => __DIR__.'/..'.'/../lib/CalDAV/Search/Xml/Filter/OffsetFilter.php', |
|
| 96 | + 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\ParamFilter' => __DIR__.'/..'.'/../lib/CalDAV/Search/Xml/Filter/ParamFilter.php', |
|
| 97 | + 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\PropFilter' => __DIR__.'/..'.'/../lib/CalDAV/Search/Xml/Filter/PropFilter.php', |
|
| 98 | + 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\SearchTermFilter' => __DIR__.'/..'.'/../lib/CalDAV/Search/Xml/Filter/SearchTermFilter.php', |
|
| 99 | + 'OCA\\DAV\\CalDAV\\Search\\Xml\\Request\\CalendarSearchReport' => __DIR__.'/..'.'/../lib/CalDAV/Search/Xml/Request/CalendarSearchReport.php', |
|
| 100 | + 'OCA\\DAV\\CalDAV\\WebcalCaching\\Plugin' => __DIR__.'/..'.'/../lib/CalDAV/WebcalCaching/Plugin.php', |
|
| 101 | + 'OCA\\DAV\\CalDAV\\WebcalCaching\\RefreshWebcalService' => __DIR__.'/..'.'/../lib/CalDAV/WebcalCaching/RefreshWebcalService.php', |
|
| 102 | + 'OCA\\DAV\\Capabilities' => __DIR__.'/..'.'/../lib/Capabilities.php', |
|
| 103 | + 'OCA\\DAV\\CardDAV\\AddressBook' => __DIR__.'/..'.'/../lib/CardDAV/AddressBook.php', |
|
| 104 | + 'OCA\\DAV\\CardDAV\\AddressBookImpl' => __DIR__.'/..'.'/../lib/CardDAV/AddressBookImpl.php', |
|
| 105 | + 'OCA\\DAV\\CardDAV\\AddressBookRoot' => __DIR__.'/..'.'/../lib/CardDAV/AddressBookRoot.php', |
|
| 106 | + 'OCA\\DAV\\CardDAV\\CardDavBackend' => __DIR__.'/..'.'/../lib/CardDAV/CardDavBackend.php', |
|
| 107 | + 'OCA\\DAV\\CardDAV\\ContactsManager' => __DIR__.'/..'.'/../lib/CardDAV/ContactsManager.php', |
|
| 108 | + 'OCA\\DAV\\CardDAV\\Converter' => __DIR__.'/..'.'/../lib/CardDAV/Converter.php', |
|
| 109 | + 'OCA\\DAV\\CardDAV\\HasPhotoPlugin' => __DIR__.'/..'.'/../lib/CardDAV/HasPhotoPlugin.php', |
|
| 110 | + 'OCA\\DAV\\CardDAV\\ImageExportPlugin' => __DIR__.'/..'.'/../lib/CardDAV/ImageExportPlugin.php', |
|
| 111 | + 'OCA\\DAV\\CardDAV\\Integration\\ExternalAddressBook' => __DIR__.'/..'.'/../lib/CardDAV/Integration/ExternalAddressBook.php', |
|
| 112 | + 'OCA\\DAV\\CardDAV\\Integration\\IAddressBookProvider' => __DIR__.'/..'.'/../lib/CardDAV/Integration/IAddressBookProvider.php', |
|
| 113 | + 'OCA\\DAV\\CardDAV\\MultiGetExportPlugin' => __DIR__.'/..'.'/../lib/CardDAV/MultiGetExportPlugin.php', |
|
| 114 | + 'OCA\\DAV\\CardDAV\\PhotoCache' => __DIR__.'/..'.'/../lib/CardDAV/PhotoCache.php', |
|
| 115 | + 'OCA\\DAV\\CardDAV\\Plugin' => __DIR__.'/..'.'/../lib/CardDAV/Plugin.php', |
|
| 116 | + 'OCA\\DAV\\CardDAV\\SyncService' => __DIR__.'/..'.'/../lib/CardDAV/SyncService.php', |
|
| 117 | + 'OCA\\DAV\\CardDAV\\SystemAddressbook' => __DIR__.'/..'.'/../lib/CardDAV/SystemAddressbook.php', |
|
| 118 | + 'OCA\\DAV\\CardDAV\\UserAddressBooks' => __DIR__.'/..'.'/../lib/CardDAV/UserAddressBooks.php', |
|
| 119 | + 'OCA\\DAV\\CardDAV\\Xml\\Groups' => __DIR__.'/..'.'/../lib/CardDAV/Xml/Groups.php', |
|
| 120 | + 'OCA\\DAV\\Command\\CreateAddressBook' => __DIR__.'/..'.'/../lib/Command/CreateAddressBook.php', |
|
| 121 | + 'OCA\\DAV\\Command\\CreateCalendar' => __DIR__.'/..'.'/../lib/Command/CreateCalendar.php', |
|
| 122 | + 'OCA\\DAV\\Command\\ListCalendars' => __DIR__.'/..'.'/../lib/Command/ListCalendars.php', |
|
| 123 | + 'OCA\\DAV\\Command\\MoveCalendar' => __DIR__.'/..'.'/../lib/Command/MoveCalendar.php', |
|
| 124 | + 'OCA\\DAV\\Command\\RemoveInvalidShares' => __DIR__.'/..'.'/../lib/Command/RemoveInvalidShares.php', |
|
| 125 | + 'OCA\\DAV\\Command\\SendEventReminders' => __DIR__.'/..'.'/../lib/Command/SendEventReminders.php', |
|
| 126 | + 'OCA\\DAV\\Command\\SyncBirthdayCalendar' => __DIR__.'/..'.'/../lib/Command/SyncBirthdayCalendar.php', |
|
| 127 | + 'OCA\\DAV\\Command\\SyncSystemAddressBook' => __DIR__.'/..'.'/../lib/Command/SyncSystemAddressBook.php', |
|
| 128 | + 'OCA\\DAV\\Comments\\CommentNode' => __DIR__.'/..'.'/../lib/Comments/CommentNode.php', |
|
| 129 | + 'OCA\\DAV\\Comments\\CommentsPlugin' => __DIR__.'/..'.'/../lib/Comments/CommentsPlugin.php', |
|
| 130 | + 'OCA\\DAV\\Comments\\EntityCollection' => __DIR__.'/..'.'/../lib/Comments/EntityCollection.php', |
|
| 131 | + 'OCA\\DAV\\Comments\\EntityTypeCollection' => __DIR__.'/..'.'/../lib/Comments/EntityTypeCollection.php', |
|
| 132 | + 'OCA\\DAV\\Comments\\RootCollection' => __DIR__.'/..'.'/../lib/Comments/RootCollection.php', |
|
| 133 | + 'OCA\\DAV\\Connector\\LegacyDAVACL' => __DIR__.'/..'.'/../lib/Connector/LegacyDAVACL.php', |
|
| 134 | + 'OCA\\DAV\\Connector\\PublicAuth' => __DIR__.'/..'.'/../lib/Connector/PublicAuth.php', |
|
| 135 | + 'OCA\\DAV\\Connector\\Sabre\\AnonymousOptionsPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/AnonymousOptionsPlugin.php', |
|
| 136 | + 'OCA\\DAV\\Connector\\Sabre\\AppEnabledPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/AppEnabledPlugin.php', |
|
| 137 | + 'OCA\\DAV\\Connector\\Sabre\\Auth' => __DIR__.'/..'.'/../lib/Connector/Sabre/Auth.php', |
|
| 138 | + 'OCA\\DAV\\Connector\\Sabre\\BearerAuth' => __DIR__.'/..'.'/../lib/Connector/Sabre/BearerAuth.php', |
|
| 139 | + 'OCA\\DAV\\Connector\\Sabre\\BlockLegacyClientPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/BlockLegacyClientPlugin.php', |
|
| 140 | + 'OCA\\DAV\\Connector\\Sabre\\CachingTree' => __DIR__.'/..'.'/../lib/Connector/Sabre/CachingTree.php', |
|
| 141 | + 'OCA\\DAV\\Connector\\Sabre\\ChecksumList' => __DIR__.'/..'.'/../lib/Connector/Sabre/ChecksumList.php', |
|
| 142 | + 'OCA\\DAV\\Connector\\Sabre\\CommentPropertiesPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/CommentPropertiesPlugin.php', |
|
| 143 | + 'OCA\\DAV\\Connector\\Sabre\\CopyEtagHeaderPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/CopyEtagHeaderPlugin.php', |
|
| 144 | + 'OCA\\DAV\\Connector\\Sabre\\DavAclPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/DavAclPlugin.php', |
|
| 145 | + 'OCA\\DAV\\Connector\\Sabre\\Directory' => __DIR__.'/..'.'/../lib/Connector/Sabre/Directory.php', |
|
| 146 | + 'OCA\\DAV\\Connector\\Sabre\\DummyGetResponsePlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/DummyGetResponsePlugin.php', |
|
| 147 | + 'OCA\\DAV\\Connector\\Sabre\\ExceptionLoggerPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/ExceptionLoggerPlugin.php', |
|
| 148 | + 'OCA\\DAV\\Connector\\Sabre\\Exception\\EntityTooLarge' => __DIR__.'/..'.'/../lib/Connector/Sabre/Exception/EntityTooLarge.php', |
|
| 149 | + 'OCA\\DAV\\Connector\\Sabre\\Exception\\FileLocked' => __DIR__.'/..'.'/../lib/Connector/Sabre/Exception/FileLocked.php', |
|
| 150 | + 'OCA\\DAV\\Connector\\Sabre\\Exception\\Forbidden' => __DIR__.'/..'.'/../lib/Connector/Sabre/Exception/Forbidden.php', |
|
| 151 | + 'OCA\\DAV\\Connector\\Sabre\\Exception\\InvalidPath' => __DIR__.'/..'.'/../lib/Connector/Sabre/Exception/InvalidPath.php', |
|
| 152 | + 'OCA\\DAV\\Connector\\Sabre\\Exception\\PasswordLoginForbidden' => __DIR__.'/..'.'/../lib/Connector/Sabre/Exception/PasswordLoginForbidden.php', |
|
| 153 | + 'OCA\\DAV\\Connector\\Sabre\\Exception\\UnsupportedMediaType' => __DIR__.'/..'.'/../lib/Connector/Sabre/Exception/UnsupportedMediaType.php', |
|
| 154 | + 'OCA\\DAV\\Connector\\Sabre\\FakeLockerPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/FakeLockerPlugin.php', |
|
| 155 | + 'OCA\\DAV\\Connector\\Sabre\\File' => __DIR__.'/..'.'/../lib/Connector/Sabre/File.php', |
|
| 156 | + 'OCA\\DAV\\Connector\\Sabre\\FilesPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/FilesPlugin.php', |
|
| 157 | + 'OCA\\DAV\\Connector\\Sabre\\FilesReportPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/FilesReportPlugin.php', |
|
| 158 | + 'OCA\\DAV\\Connector\\Sabre\\LockPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/LockPlugin.php', |
|
| 159 | + 'OCA\\DAV\\Connector\\Sabre\\MaintenancePlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/MaintenancePlugin.php', |
|
| 160 | + 'OCA\\DAV\\Connector\\Sabre\\Node' => __DIR__.'/..'.'/../lib/Connector/Sabre/Node.php', |
|
| 161 | + 'OCA\\DAV\\Connector\\Sabre\\ObjectTree' => __DIR__.'/..'.'/../lib/Connector/Sabre/ObjectTree.php', |
|
| 162 | + 'OCA\\DAV\\Connector\\Sabre\\Principal' => __DIR__.'/..'.'/../lib/Connector/Sabre/Principal.php', |
|
| 163 | + 'OCA\\DAV\\Connector\\Sabre\\PropfindCompressionPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/PropfindCompressionPlugin.php', |
|
| 164 | + 'OCA\\DAV\\Connector\\Sabre\\QuotaPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/QuotaPlugin.php', |
|
| 165 | + 'OCA\\DAV\\Connector\\Sabre\\Server' => __DIR__.'/..'.'/../lib/Connector/Sabre/Server.php', |
|
| 166 | + 'OCA\\DAV\\Connector\\Sabre\\ServerFactory' => __DIR__.'/..'.'/../lib/Connector/Sabre/ServerFactory.php', |
|
| 167 | + 'OCA\\DAV\\Connector\\Sabre\\ShareTypeList' => __DIR__.'/..'.'/../lib/Connector/Sabre/ShareTypeList.php', |
|
| 168 | + 'OCA\\DAV\\Connector\\Sabre\\ShareeList' => __DIR__.'/..'.'/../lib/Connector/Sabre/ShareeList.php', |
|
| 169 | + 'OCA\\DAV\\Connector\\Sabre\\SharesPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/SharesPlugin.php', |
|
| 170 | + 'OCA\\DAV\\Connector\\Sabre\\TagList' => __DIR__.'/..'.'/../lib/Connector/Sabre/TagList.php', |
|
| 171 | + 'OCA\\DAV\\Connector\\Sabre\\TagsPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/TagsPlugin.php', |
|
| 172 | + 'OCA\\DAV\\Controller\\BirthdayCalendarController' => __DIR__.'/..'.'/../lib/Controller/BirthdayCalendarController.php', |
|
| 173 | + 'OCA\\DAV\\Controller\\DirectController' => __DIR__.'/..'.'/../lib/Controller/DirectController.php', |
|
| 174 | + 'OCA\\DAV\\Controller\\InvitationResponseController' => __DIR__.'/..'.'/../lib/Controller/InvitationResponseController.php', |
|
| 175 | + 'OCA\\DAV\\DAV\\CustomPropertiesBackend' => __DIR__.'/..'.'/../lib/DAV/CustomPropertiesBackend.php', |
|
| 176 | + 'OCA\\DAV\\DAV\\GroupPrincipalBackend' => __DIR__.'/..'.'/../lib/DAV/GroupPrincipalBackend.php', |
|
| 177 | + 'OCA\\DAV\\DAV\\PublicAuth' => __DIR__.'/..'.'/../lib/DAV/PublicAuth.php', |
|
| 178 | + 'OCA\\DAV\\DAV\\Sharing\\Backend' => __DIR__.'/..'.'/../lib/DAV/Sharing/Backend.php', |
|
| 179 | + 'OCA\\DAV\\DAV\\Sharing\\IShareable' => __DIR__.'/..'.'/../lib/DAV/Sharing/IShareable.php', |
|
| 180 | + 'OCA\\DAV\\DAV\\Sharing\\Plugin' => __DIR__.'/..'.'/../lib/DAV/Sharing/Plugin.php', |
|
| 181 | + 'OCA\\DAV\\DAV\\Sharing\\Xml\\Invite' => __DIR__.'/..'.'/../lib/DAV/Sharing/Xml/Invite.php', |
|
| 182 | + 'OCA\\DAV\\DAV\\Sharing\\Xml\\ShareRequest' => __DIR__.'/..'.'/../lib/DAV/Sharing/Xml/ShareRequest.php', |
|
| 183 | + 'OCA\\DAV\\DAV\\SystemPrincipalBackend' => __DIR__.'/..'.'/../lib/DAV/SystemPrincipalBackend.php', |
|
| 184 | + 'OCA\\DAV\\Db\\Direct' => __DIR__.'/..'.'/../lib/Db/Direct.php', |
|
| 185 | + 'OCA\\DAV\\Db\\DirectMapper' => __DIR__.'/..'.'/../lib/Db/DirectMapper.php', |
|
| 186 | + 'OCA\\DAV\\Direct\\DirectFile' => __DIR__.'/..'.'/../lib/Direct/DirectFile.php', |
|
| 187 | + 'OCA\\DAV\\Direct\\DirectHome' => __DIR__.'/..'.'/../lib/Direct/DirectHome.php', |
|
| 188 | + 'OCA\\DAV\\Direct\\Server' => __DIR__.'/..'.'/../lib/Direct/Server.php', |
|
| 189 | + 'OCA\\DAV\\Direct\\ServerFactory' => __DIR__.'/..'.'/../lib/Direct/ServerFactory.php', |
|
| 190 | + 'OCA\\DAV\\Events\\AddressBookCreatedEvent' => __DIR__.'/..'.'/../lib/Events/AddressBookCreatedEvent.php', |
|
| 191 | + 'OCA\\DAV\\Events\\AddressBookDeletedEvent' => __DIR__.'/..'.'/../lib/Events/AddressBookDeletedEvent.php', |
|
| 192 | + 'OCA\\DAV\\Events\\AddressBookShareUpdatedEvent' => __DIR__.'/..'.'/../lib/Events/AddressBookShareUpdatedEvent.php', |
|
| 193 | + 'OCA\\DAV\\Events\\AddressBookUpdatedEvent' => __DIR__.'/..'.'/../lib/Events/AddressBookUpdatedEvent.php', |
|
| 194 | + 'OCA\\DAV\\Events\\BeforeFileDirectDownloadedEvent' => __DIR__.'/..'.'/../lib/Events/BeforeFileDirectDownloadedEvent.php', |
|
| 195 | + 'OCA\\DAV\\Events\\CachedCalendarObjectCreatedEvent' => __DIR__.'/..'.'/../lib/Events/CachedCalendarObjectCreatedEvent.php', |
|
| 196 | + 'OCA\\DAV\\Events\\CachedCalendarObjectDeletedEvent' => __DIR__.'/..'.'/../lib/Events/CachedCalendarObjectDeletedEvent.php', |
|
| 197 | + 'OCA\\DAV\\Events\\CachedCalendarObjectUpdatedEvent' => __DIR__.'/..'.'/../lib/Events/CachedCalendarObjectUpdatedEvent.php', |
|
| 198 | + 'OCA\\DAV\\Events\\CalendarCreatedEvent' => __DIR__.'/..'.'/../lib/Events/CalendarCreatedEvent.php', |
|
| 199 | + 'OCA\\DAV\\Events\\CalendarDeletedEvent' => __DIR__.'/..'.'/../lib/Events/CalendarDeletedEvent.php', |
|
| 200 | + 'OCA\\DAV\\Events\\CalendarObjectCreatedEvent' => __DIR__.'/..'.'/../lib/Events/CalendarObjectCreatedEvent.php', |
|
| 201 | + 'OCA\\DAV\\Events\\CalendarObjectDeletedEvent' => __DIR__.'/..'.'/../lib/Events/CalendarObjectDeletedEvent.php', |
|
| 202 | + 'OCA\\DAV\\Events\\CalendarObjectUpdatedEvent' => __DIR__.'/..'.'/../lib/Events/CalendarObjectUpdatedEvent.php', |
|
| 203 | + 'OCA\\DAV\\Events\\CalendarPublishedEvent' => __DIR__.'/..'.'/../lib/Events/CalendarPublishedEvent.php', |
|
| 204 | + 'OCA\\DAV\\Events\\CalendarShareUpdatedEvent' => __DIR__.'/..'.'/../lib/Events/CalendarShareUpdatedEvent.php', |
|
| 205 | + 'OCA\\DAV\\Events\\CalendarUnpublishedEvent' => __DIR__.'/..'.'/../lib/Events/CalendarUnpublishedEvent.php', |
|
| 206 | + 'OCA\\DAV\\Events\\CalendarUpdatedEvent' => __DIR__.'/..'.'/../lib/Events/CalendarUpdatedEvent.php', |
|
| 207 | + 'OCA\\DAV\\Events\\CardCreatedEvent' => __DIR__.'/..'.'/../lib/Events/CardCreatedEvent.php', |
|
| 208 | + 'OCA\\DAV\\Events\\CardDeletedEvent' => __DIR__.'/..'.'/../lib/Events/CardDeletedEvent.php', |
|
| 209 | + 'OCA\\DAV\\Events\\CardUpdatedEvent' => __DIR__.'/..'.'/../lib/Events/CardUpdatedEvent.php', |
|
| 210 | + 'OCA\\DAV\\Events\\SabrePluginAuthInitEvent' => __DIR__.'/..'.'/../lib/Events/SabrePluginAuthInitEvent.php', |
|
| 211 | + 'OCA\\DAV\\Events\\SubscriptionCreatedEvent' => __DIR__.'/..'.'/../lib/Events/SubscriptionCreatedEvent.php', |
|
| 212 | + 'OCA\\DAV\\Events\\SubscriptionDeletedEvent' => __DIR__.'/..'.'/../lib/Events/SubscriptionDeletedEvent.php', |
|
| 213 | + 'OCA\\DAV\\Events\\SubscriptionUpdatedEvent' => __DIR__.'/..'.'/../lib/Events/SubscriptionUpdatedEvent.php', |
|
| 214 | + 'OCA\\DAV\\Exception\\UnsupportedLimitOnInitialSyncException' => __DIR__.'/..'.'/../lib/Exception/UnsupportedLimitOnInitialSyncException.php', |
|
| 215 | + 'OCA\\DAV\\Files\\BrowserErrorPagePlugin' => __DIR__.'/..'.'/../lib/Files/BrowserErrorPagePlugin.php', |
|
| 216 | + 'OCA\\DAV\\Files\\FileSearchBackend' => __DIR__.'/..'.'/../lib/Files/FileSearchBackend.php', |
|
| 217 | + 'OCA\\DAV\\Files\\FilesHome' => __DIR__.'/..'.'/../lib/Files/FilesHome.php', |
|
| 218 | + 'OCA\\DAV\\Files\\LazySearchBackend' => __DIR__.'/..'.'/../lib/Files/LazySearchBackend.php', |
|
| 219 | + 'OCA\\DAV\\Files\\RootCollection' => __DIR__.'/..'.'/../lib/Files/RootCollection.php', |
|
| 220 | + 'OCA\\DAV\\Files\\Sharing\\FilesDropPlugin' => __DIR__.'/..'.'/../lib/Files/Sharing/FilesDropPlugin.php', |
|
| 221 | + 'OCA\\DAV\\Files\\Sharing\\PublicLinkCheckPlugin' => __DIR__.'/..'.'/../lib/Files/Sharing/PublicLinkCheckPlugin.php', |
|
| 222 | + 'OCA\\DAV\\HookManager' => __DIR__.'/..'.'/../lib/HookManager.php', |
|
| 223 | + 'OCA\\DAV\\Listener\\ActivityUpdaterListener' => __DIR__.'/..'.'/../lib/Listener/ActivityUpdaterListener.php', |
|
| 224 | + 'OCA\\DAV\\Listener\\CalendarContactInteractionListener' => __DIR__.'/..'.'/../lib/Listener/CalendarContactInteractionListener.php', |
|
| 225 | + 'OCA\\DAV\\Listener\\CalendarDeletionDefaultUpdaterListener' => __DIR__.'/..'.'/../lib/Listener/CalendarDeletionDefaultUpdaterListener.php', |
|
| 226 | + 'OCA\\DAV\\Listener\\CalendarObjectReminderUpdaterListener' => __DIR__.'/..'.'/../lib/Listener/CalendarObjectReminderUpdaterListener.php', |
|
| 227 | + 'OCA\\DAV\\Migration\\BuildCalendarSearchIndex' => __DIR__.'/..'.'/../lib/Migration/BuildCalendarSearchIndex.php', |
|
| 228 | + 'OCA\\DAV\\Migration\\BuildCalendarSearchIndexBackgroundJob' => __DIR__.'/..'.'/../lib/Migration/BuildCalendarSearchIndexBackgroundJob.php', |
|
| 229 | + 'OCA\\DAV\\Migration\\BuildSocialSearchIndex' => __DIR__.'/..'.'/../lib/Migration/BuildSocialSearchIndex.php', |
|
| 230 | + 'OCA\\DAV\\Migration\\BuildSocialSearchIndexBackgroundJob' => __DIR__.'/..'.'/../lib/Migration/BuildSocialSearchIndexBackgroundJob.php', |
|
| 231 | + 'OCA\\DAV\\Migration\\CalDAVRemoveEmptyValue' => __DIR__.'/..'.'/../lib/Migration/CalDAVRemoveEmptyValue.php', |
|
| 232 | + 'OCA\\DAV\\Migration\\ChunkCleanup' => __DIR__.'/..'.'/../lib/Migration/ChunkCleanup.php', |
|
| 233 | + 'OCA\\DAV\\Migration\\FixBirthdayCalendarComponent' => __DIR__.'/..'.'/../lib/Migration/FixBirthdayCalendarComponent.php', |
|
| 234 | + 'OCA\\DAV\\Migration\\RefreshWebcalJobRegistrar' => __DIR__.'/..'.'/../lib/Migration/RefreshWebcalJobRegistrar.php', |
|
| 235 | + 'OCA\\DAV\\Migration\\RegenerateBirthdayCalendars' => __DIR__.'/..'.'/../lib/Migration/RegenerateBirthdayCalendars.php', |
|
| 236 | + 'OCA\\DAV\\Migration\\RegisterBuildReminderIndexBackgroundJob' => __DIR__.'/..'.'/../lib/Migration/RegisterBuildReminderIndexBackgroundJob.php', |
|
| 237 | + 'OCA\\DAV\\Migration\\RemoveClassifiedEventActivity' => __DIR__.'/..'.'/../lib/Migration/RemoveClassifiedEventActivity.php', |
|
| 238 | + 'OCA\\DAV\\Migration\\RemoveOrphanEventsAndContacts' => __DIR__.'/..'.'/../lib/Migration/RemoveOrphanEventsAndContacts.php', |
|
| 239 | + 'OCA\\DAV\\Migration\\Version1004Date20170825134824' => __DIR__.'/..'.'/../lib/Migration/Version1004Date20170825134824.php', |
|
| 240 | + 'OCA\\DAV\\Migration\\Version1004Date20170919104507' => __DIR__.'/..'.'/../lib/Migration/Version1004Date20170919104507.php', |
|
| 241 | + 'OCA\\DAV\\Migration\\Version1004Date20170924124212' => __DIR__.'/..'.'/../lib/Migration/Version1004Date20170924124212.php', |
|
| 242 | + 'OCA\\DAV\\Migration\\Version1004Date20170926103422' => __DIR__.'/..'.'/../lib/Migration/Version1004Date20170926103422.php', |
|
| 243 | + 'OCA\\DAV\\Migration\\Version1005Date20180413093149' => __DIR__.'/..'.'/../lib/Migration/Version1005Date20180413093149.php', |
|
| 244 | + 'OCA\\DAV\\Migration\\Version1005Date20180530124431' => __DIR__.'/..'.'/../lib/Migration/Version1005Date20180530124431.php', |
|
| 245 | + 'OCA\\DAV\\Migration\\Version1006Date20180619154313' => __DIR__.'/..'.'/../lib/Migration/Version1006Date20180619154313.php', |
|
| 246 | + 'OCA\\DAV\\Migration\\Version1006Date20180628111625' => __DIR__.'/..'.'/../lib/Migration/Version1006Date20180628111625.php', |
|
| 247 | + 'OCA\\DAV\\Migration\\Version1008Date20181030113700' => __DIR__.'/..'.'/../lib/Migration/Version1008Date20181030113700.php', |
|
| 248 | + 'OCA\\DAV\\Migration\\Version1008Date20181105104826' => __DIR__.'/..'.'/../lib/Migration/Version1008Date20181105104826.php', |
|
| 249 | + 'OCA\\DAV\\Migration\\Version1008Date20181105104833' => __DIR__.'/..'.'/../lib/Migration/Version1008Date20181105104833.php', |
|
| 250 | + 'OCA\\DAV\\Migration\\Version1008Date20181105110300' => __DIR__.'/..'.'/../lib/Migration/Version1008Date20181105110300.php', |
|
| 251 | + 'OCA\\DAV\\Migration\\Version1008Date20181105112049' => __DIR__.'/..'.'/../lib/Migration/Version1008Date20181105112049.php', |
|
| 252 | + 'OCA\\DAV\\Migration\\Version1008Date20181114084440' => __DIR__.'/..'.'/../lib/Migration/Version1008Date20181114084440.php', |
|
| 253 | + 'OCA\\DAV\\Migration\\Version1011Date20190725113607' => __DIR__.'/..'.'/../lib/Migration/Version1011Date20190725113607.php', |
|
| 254 | + 'OCA\\DAV\\Migration\\Version1011Date20190806104428' => __DIR__.'/..'.'/../lib/Migration/Version1011Date20190806104428.php', |
|
| 255 | + 'OCA\\DAV\\Migration\\Version1012Date20190808122342' => __DIR__.'/..'.'/../lib/Migration/Version1012Date20190808122342.php', |
|
| 256 | + 'OCA\\DAV\\Migration\\Version1016Date20201109085907' => __DIR__.'/..'.'/../lib/Migration/Version1016Date20201109085907.php', |
|
| 257 | + 'OCA\\DAV\\Migration\\Version1017Date20210216083742' => __DIR__.'/..'.'/../lib/Migration/Version1017Date20210216083742.php', |
|
| 258 | + 'OCA\\DAV\\Provisioning\\Apple\\AppleProvisioningNode' => __DIR__.'/..'.'/../lib/Provisioning/Apple/AppleProvisioningNode.php', |
|
| 259 | + 'OCA\\DAV\\Provisioning\\Apple\\AppleProvisioningPlugin' => __DIR__.'/..'.'/../lib/Provisioning/Apple/AppleProvisioningPlugin.php', |
|
| 260 | + 'OCA\\DAV\\RootCollection' => __DIR__.'/..'.'/../lib/RootCollection.php', |
|
| 261 | + 'OCA\\DAV\\Search\\ACalendarSearchProvider' => __DIR__.'/..'.'/../lib/Search/ACalendarSearchProvider.php', |
|
| 262 | + 'OCA\\DAV\\Search\\ContactsSearchProvider' => __DIR__.'/..'.'/../lib/Search/ContactsSearchProvider.php', |
|
| 263 | + 'OCA\\DAV\\Search\\EventsSearchProvider' => __DIR__.'/..'.'/../lib/Search/EventsSearchProvider.php', |
|
| 264 | + 'OCA\\DAV\\Search\\TasksSearchProvider' => __DIR__.'/..'.'/../lib/Search/TasksSearchProvider.php', |
|
| 265 | + 'OCA\\DAV\\Server' => __DIR__.'/..'.'/../lib/Server.php', |
|
| 266 | + 'OCA\\DAV\\Settings\\CalDAVSettings' => __DIR__.'/..'.'/../lib/Settings/CalDAVSettings.php', |
|
| 267 | + 'OCA\\DAV\\Storage\\PublicOwnerWrapper' => __DIR__.'/..'.'/../lib/Storage/PublicOwnerWrapper.php', |
|
| 268 | + 'OCA\\DAV\\SystemTag\\SystemTagMappingNode' => __DIR__.'/..'.'/../lib/SystemTag/SystemTagMappingNode.php', |
|
| 269 | + 'OCA\\DAV\\SystemTag\\SystemTagNode' => __DIR__.'/..'.'/../lib/SystemTag/SystemTagNode.php', |
|
| 270 | + 'OCA\\DAV\\SystemTag\\SystemTagPlugin' => __DIR__.'/..'.'/../lib/SystemTag/SystemTagPlugin.php', |
|
| 271 | + 'OCA\\DAV\\SystemTag\\SystemTagsByIdCollection' => __DIR__.'/..'.'/../lib/SystemTag/SystemTagsByIdCollection.php', |
|
| 272 | + 'OCA\\DAV\\SystemTag\\SystemTagsObjectMappingCollection' => __DIR__.'/..'.'/../lib/SystemTag/SystemTagsObjectMappingCollection.php', |
|
| 273 | + 'OCA\\DAV\\SystemTag\\SystemTagsObjectTypeCollection' => __DIR__.'/..'.'/../lib/SystemTag/SystemTagsObjectTypeCollection.php', |
|
| 274 | + 'OCA\\DAV\\SystemTag\\SystemTagsRelationsCollection' => __DIR__.'/..'.'/../lib/SystemTag/SystemTagsRelationsCollection.php', |
|
| 275 | + 'OCA\\DAV\\Traits\\PrincipalProxyTrait' => __DIR__.'/..'.'/../lib/Traits/PrincipalProxyTrait.php', |
|
| 276 | + 'OCA\\DAV\\Upload\\AssemblyStream' => __DIR__.'/..'.'/../lib/Upload/AssemblyStream.php', |
|
| 277 | + 'OCA\\DAV\\Upload\\ChunkingPlugin' => __DIR__.'/..'.'/../lib/Upload/ChunkingPlugin.php', |
|
| 278 | + 'OCA\\DAV\\Upload\\CleanupService' => __DIR__.'/..'.'/../lib/Upload/CleanupService.php', |
|
| 279 | + 'OCA\\DAV\\Upload\\FutureFile' => __DIR__.'/..'.'/../lib/Upload/FutureFile.php', |
|
| 280 | + 'OCA\\DAV\\Upload\\RootCollection' => __DIR__.'/..'.'/../lib/Upload/RootCollection.php', |
|
| 281 | + 'OCA\\DAV\\Upload\\UploadFile' => __DIR__.'/..'.'/../lib/Upload/UploadFile.php', |
|
| 282 | + 'OCA\\DAV\\Upload\\UploadFolder' => __DIR__.'/..'.'/../lib/Upload/UploadFolder.php', |
|
| 283 | + 'OCA\\DAV\\Upload\\UploadHome' => __DIR__.'/..'.'/../lib/Upload/UploadHome.php', |
|
| 284 | 284 | ); |
| 285 | 285 | |
| 286 | 286 | public static function getInitializer(ClassLoader $loader) |
| 287 | 287 | { |
| 288 | - return \Closure::bind(function () use ($loader) { |
|
| 288 | + return \Closure::bind(function() use ($loader) { |
|
| 289 | 289 | $loader->prefixLengthsPsr4 = ComposerStaticInitDAV::$prefixLengthsPsr4; |
| 290 | 290 | $loader->prefixDirsPsr4 = ComposerStaticInitDAV::$prefixDirsPsr4; |
| 291 | 291 | $loader->classMap = ComposerStaticInitDAV::$classMap; |
@@ -42,99 +42,99 @@ |
||
| 42 | 42 | */ |
| 43 | 43 | class BuildReminderIndexBackgroundJob extends QueuedJob { |
| 44 | 44 | |
| 45 | - /** @var IDBConnection */ |
|
| 46 | - private $db; |
|
| 47 | - |
|
| 48 | - /** @var ReminderService */ |
|
| 49 | - private $reminderService; |
|
| 50 | - |
|
| 51 | - /** @var ILogger */ |
|
| 52 | - private $logger; |
|
| 53 | - |
|
| 54 | - /** @var IJobList */ |
|
| 55 | - private $jobList; |
|
| 56 | - |
|
| 57 | - /** @var ITimeFactory */ |
|
| 58 | - private $timeFactory; |
|
| 59 | - |
|
| 60 | - /** |
|
| 61 | - * BuildReminderIndexBackgroundJob constructor. |
|
| 62 | - * |
|
| 63 | - * @param IDBConnection $db |
|
| 64 | - * @param ReminderService $reminderService |
|
| 65 | - * @param ILogger $logger |
|
| 66 | - * @param IJobList $jobList |
|
| 67 | - * @param ITimeFactory $timeFactory |
|
| 68 | - */ |
|
| 69 | - public function __construct(IDBConnection $db, |
|
| 70 | - ReminderService $reminderService, |
|
| 71 | - ILogger $logger, |
|
| 72 | - IJobList $jobList, |
|
| 73 | - ITimeFactory $timeFactory) { |
|
| 74 | - parent::__construct($timeFactory); |
|
| 75 | - $this->db = $db; |
|
| 76 | - $this->reminderService = $reminderService; |
|
| 77 | - $this->logger = $logger; |
|
| 78 | - $this->jobList = $jobList; |
|
| 79 | - $this->timeFactory = $timeFactory; |
|
| 80 | - } |
|
| 81 | - |
|
| 82 | - /** |
|
| 83 | - * @param $arguments |
|
| 84 | - */ |
|
| 85 | - public function run($arguments) { |
|
| 86 | - $offset = (int) $arguments['offset']; |
|
| 87 | - $stopAt = (int) $arguments['stopAt']; |
|
| 88 | - |
|
| 89 | - $this->logger->info('Building calendar reminder index (' . $offset .'/' . $stopAt . ')'); |
|
| 90 | - |
|
| 91 | - $offset = $this->buildIndex($offset, $stopAt); |
|
| 92 | - |
|
| 93 | - if ($offset >= $stopAt) { |
|
| 94 | - $this->logger->info('Building calendar reminder index done'); |
|
| 95 | - } else { |
|
| 96 | - $this->jobList->add(self::class, [ |
|
| 97 | - 'offset' => $offset, |
|
| 98 | - 'stopAt' => $stopAt |
|
| 99 | - ]); |
|
| 100 | - $this->logger->info('Scheduled a new BuildReminderIndexBackgroundJob with offset ' . $offset); |
|
| 101 | - } |
|
| 102 | - } |
|
| 103 | - |
|
| 104 | - /** |
|
| 105 | - * @param int $offset |
|
| 106 | - * @param int $stopAt |
|
| 107 | - * @return int |
|
| 108 | - */ |
|
| 109 | - private function buildIndex(int $offset, int $stopAt):int { |
|
| 110 | - $startTime = $this->timeFactory->getTime(); |
|
| 111 | - |
|
| 112 | - $query = $this->db->getQueryBuilder(); |
|
| 113 | - $query->select('*') |
|
| 114 | - ->from('calendarobjects') |
|
| 115 | - ->where($query->expr()->lte('id', $query->createNamedParameter($stopAt))) |
|
| 116 | - ->andWhere($query->expr()->gt('id', $query->createNamedParameter($offset))) |
|
| 117 | - ->orderBy('id', 'ASC'); |
|
| 118 | - |
|
| 119 | - $stmt = $query->execute(); |
|
| 120 | - while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
| 121 | - $offset = $row['id']; |
|
| 122 | - if (is_resource($row['calendardata'])) { |
|
| 123 | - $row['calendardata'] = stream_get_contents($row['calendardata']); |
|
| 124 | - } |
|
| 125 | - $row['component'] = $row['componenttype']; |
|
| 126 | - |
|
| 127 | - try { |
|
| 128 | - $this->reminderService->onCalendarObjectCreate($row); |
|
| 129 | - } catch (\Exception $ex) { |
|
| 130 | - $this->logger->logException($ex); |
|
| 131 | - } |
|
| 132 | - |
|
| 133 | - if (($this->timeFactory->getTime() - $startTime) > 15) { |
|
| 134 | - return $offset; |
|
| 135 | - } |
|
| 136 | - } |
|
| 137 | - |
|
| 138 | - return $stopAt; |
|
| 139 | - } |
|
| 45 | + /** @var IDBConnection */ |
|
| 46 | + private $db; |
|
| 47 | + |
|
| 48 | + /** @var ReminderService */ |
|
| 49 | + private $reminderService; |
|
| 50 | + |
|
| 51 | + /** @var ILogger */ |
|
| 52 | + private $logger; |
|
| 53 | + |
|
| 54 | + /** @var IJobList */ |
|
| 55 | + private $jobList; |
|
| 56 | + |
|
| 57 | + /** @var ITimeFactory */ |
|
| 58 | + private $timeFactory; |
|
| 59 | + |
|
| 60 | + /** |
|
| 61 | + * BuildReminderIndexBackgroundJob constructor. |
|
| 62 | + * |
|
| 63 | + * @param IDBConnection $db |
|
| 64 | + * @param ReminderService $reminderService |
|
| 65 | + * @param ILogger $logger |
|
| 66 | + * @param IJobList $jobList |
|
| 67 | + * @param ITimeFactory $timeFactory |
|
| 68 | + */ |
|
| 69 | + public function __construct(IDBConnection $db, |
|
| 70 | + ReminderService $reminderService, |
|
| 71 | + ILogger $logger, |
|
| 72 | + IJobList $jobList, |
|
| 73 | + ITimeFactory $timeFactory) { |
|
| 74 | + parent::__construct($timeFactory); |
|
| 75 | + $this->db = $db; |
|
| 76 | + $this->reminderService = $reminderService; |
|
| 77 | + $this->logger = $logger; |
|
| 78 | + $this->jobList = $jobList; |
|
| 79 | + $this->timeFactory = $timeFactory; |
|
| 80 | + } |
|
| 81 | + |
|
| 82 | + /** |
|
| 83 | + * @param $arguments |
|
| 84 | + */ |
|
| 85 | + public function run($arguments) { |
|
| 86 | + $offset = (int) $arguments['offset']; |
|
| 87 | + $stopAt = (int) $arguments['stopAt']; |
|
| 88 | + |
|
| 89 | + $this->logger->info('Building calendar reminder index (' . $offset .'/' . $stopAt . ')'); |
|
| 90 | + |
|
| 91 | + $offset = $this->buildIndex($offset, $stopAt); |
|
| 92 | + |
|
| 93 | + if ($offset >= $stopAt) { |
|
| 94 | + $this->logger->info('Building calendar reminder index done'); |
|
| 95 | + } else { |
|
| 96 | + $this->jobList->add(self::class, [ |
|
| 97 | + 'offset' => $offset, |
|
| 98 | + 'stopAt' => $stopAt |
|
| 99 | + ]); |
|
| 100 | + $this->logger->info('Scheduled a new BuildReminderIndexBackgroundJob with offset ' . $offset); |
|
| 101 | + } |
|
| 102 | + } |
|
| 103 | + |
|
| 104 | + /** |
|
| 105 | + * @param int $offset |
|
| 106 | + * @param int $stopAt |
|
| 107 | + * @return int |
|
| 108 | + */ |
|
| 109 | + private function buildIndex(int $offset, int $stopAt):int { |
|
| 110 | + $startTime = $this->timeFactory->getTime(); |
|
| 111 | + |
|
| 112 | + $query = $this->db->getQueryBuilder(); |
|
| 113 | + $query->select('*') |
|
| 114 | + ->from('calendarobjects') |
|
| 115 | + ->where($query->expr()->lte('id', $query->createNamedParameter($stopAt))) |
|
| 116 | + ->andWhere($query->expr()->gt('id', $query->createNamedParameter($offset))) |
|
| 117 | + ->orderBy('id', 'ASC'); |
|
| 118 | + |
|
| 119 | + $stmt = $query->execute(); |
|
| 120 | + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
| 121 | + $offset = $row['id']; |
|
| 122 | + if (is_resource($row['calendardata'])) { |
|
| 123 | + $row['calendardata'] = stream_get_contents($row['calendardata']); |
|
| 124 | + } |
|
| 125 | + $row['component'] = $row['componenttype']; |
|
| 126 | + |
|
| 127 | + try { |
|
| 128 | + $this->reminderService->onCalendarObjectCreate($row); |
|
| 129 | + } catch (\Exception $ex) { |
|
| 130 | + $this->logger->logException($ex); |
|
| 131 | + } |
|
| 132 | + |
|
| 133 | + if (($this->timeFactory->getTime() - $startTime) > 15) { |
|
| 134 | + return $offset; |
|
| 135 | + } |
|
| 136 | + } |
|
| 137 | + |
|
| 138 | + return $stopAt; |
|
| 139 | + } |
|
| 140 | 140 | } |
@@ -39,84 +39,84 @@ |
||
| 39 | 39 | |
| 40 | 40 | class CalendarObjectReminderUpdaterListener implements IEventListener { |
| 41 | 41 | |
| 42 | - /** @var ReminderBackend */ |
|
| 43 | - private $reminderBackend; |
|
| 42 | + /** @var ReminderBackend */ |
|
| 43 | + private $reminderBackend; |
|
| 44 | 44 | |
| 45 | - /** @var ReminderService */ |
|
| 46 | - private $reminderService; |
|
| 45 | + /** @var ReminderService */ |
|
| 46 | + private $reminderService; |
|
| 47 | 47 | |
| 48 | - /** @var LoggerInterface */ |
|
| 49 | - private $logger; |
|
| 48 | + /** @var LoggerInterface */ |
|
| 49 | + private $logger; |
|
| 50 | 50 | |
| 51 | - public function __construct(ReminderBackend $reminderBackend, |
|
| 52 | - ReminderService $reminderService, |
|
| 53 | - LoggerInterface $logger) { |
|
| 54 | - $this->reminderBackend = $reminderBackend; |
|
| 55 | - $this->reminderService = $reminderService; |
|
| 56 | - $this->logger = $logger; |
|
| 57 | - } |
|
| 51 | + public function __construct(ReminderBackend $reminderBackend, |
|
| 52 | + ReminderService $reminderService, |
|
| 53 | + LoggerInterface $logger) { |
|
| 54 | + $this->reminderBackend = $reminderBackend; |
|
| 55 | + $this->reminderService = $reminderService; |
|
| 56 | + $this->logger = $logger; |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | - public function handle(Event $event): void { |
|
| 60 | - if ($event instanceof CalendarDeletedEvent) { |
|
| 61 | - try { |
|
| 62 | - $this->reminderBackend->cleanRemindersForCalendar( |
|
| 63 | - $event->getCalendarId() |
|
| 64 | - ); |
|
| 59 | + public function handle(Event $event): void { |
|
| 60 | + if ($event instanceof CalendarDeletedEvent) { |
|
| 61 | + try { |
|
| 62 | + $this->reminderBackend->cleanRemindersForCalendar( |
|
| 63 | + $event->getCalendarId() |
|
| 64 | + ); |
|
| 65 | 65 | |
| 66 | - $this->logger->debug( |
|
| 67 | - sprintf('Reminders of calendar %d cleaned up', $event->getCalendarId()) |
|
| 68 | - ); |
|
| 69 | - } catch (Throwable $e) { |
|
| 70 | - // Any error with activities shouldn't abort the calendar deletion, so we just log it |
|
| 71 | - $this->logger->error('Error cleaning up reminders of a deleted calendar: ' . $e->getMessage(), [ |
|
| 72 | - 'exception' => $e, |
|
| 73 | - ]); |
|
| 74 | - } |
|
| 75 | - } elseif ($event instanceof CalendarObjectCreatedEvent) { |
|
| 76 | - try { |
|
| 77 | - $this->reminderService->onCalendarObjectCreate( |
|
| 78 | - $event->getObjectData() |
|
| 79 | - ); |
|
| 66 | + $this->logger->debug( |
|
| 67 | + sprintf('Reminders of calendar %d cleaned up', $event->getCalendarId()) |
|
| 68 | + ); |
|
| 69 | + } catch (Throwable $e) { |
|
| 70 | + // Any error with activities shouldn't abort the calendar deletion, so we just log it |
|
| 71 | + $this->logger->error('Error cleaning up reminders of a deleted calendar: ' . $e->getMessage(), [ |
|
| 72 | + 'exception' => $e, |
|
| 73 | + ]); |
|
| 74 | + } |
|
| 75 | + } elseif ($event instanceof CalendarObjectCreatedEvent) { |
|
| 76 | + try { |
|
| 77 | + $this->reminderService->onCalendarObjectCreate( |
|
| 78 | + $event->getObjectData() |
|
| 79 | + ); |
|
| 80 | 80 | |
| 81 | - $this->logger->debug( |
|
| 82 | - sprintf('Reminders of calendar object of calendar %d created', $event->getCalendarId()) |
|
| 83 | - ); |
|
| 84 | - } catch (Throwable $e) { |
|
| 85 | - // Any error with reminders shouldn't abort the calendar object creation, so we just log it |
|
| 86 | - $this->logger->error('Error creating reminders of a calendar object: ' . $e->getMessage(), [ |
|
| 87 | - 'exception' => $e, |
|
| 88 | - ]); |
|
| 89 | - } |
|
| 90 | - } elseif ($event instanceof CalendarObjectUpdatedEvent) { |
|
| 91 | - try { |
|
| 92 | - $this->reminderService->onCalendarObjectEdit( |
|
| 93 | - $event->getObjectData() |
|
| 94 | - ); |
|
| 81 | + $this->logger->debug( |
|
| 82 | + sprintf('Reminders of calendar object of calendar %d created', $event->getCalendarId()) |
|
| 83 | + ); |
|
| 84 | + } catch (Throwable $e) { |
|
| 85 | + // Any error with reminders shouldn't abort the calendar object creation, so we just log it |
|
| 86 | + $this->logger->error('Error creating reminders of a calendar object: ' . $e->getMessage(), [ |
|
| 87 | + 'exception' => $e, |
|
| 88 | + ]); |
|
| 89 | + } |
|
| 90 | + } elseif ($event instanceof CalendarObjectUpdatedEvent) { |
|
| 91 | + try { |
|
| 92 | + $this->reminderService->onCalendarObjectEdit( |
|
| 93 | + $event->getObjectData() |
|
| 94 | + ); |
|
| 95 | 95 | |
| 96 | - $this->logger->debug( |
|
| 97 | - sprintf('Reminders of calendar object of calendar %d cleaned up', $event->getCalendarId()) |
|
| 98 | - ); |
|
| 99 | - } catch (Throwable $e) { |
|
| 100 | - // Any error with activities shouldn't abort the calendar object deletion, so we just log it |
|
| 101 | - $this->logger->error('Error cleaning up reminders of a calendar object: ' . $e->getMessage(), [ |
|
| 102 | - 'exception' => $e, |
|
| 103 | - ]); |
|
| 104 | - } |
|
| 105 | - } elseif ($event instanceof CalendarObjectDeletedEvent) { |
|
| 106 | - try { |
|
| 107 | - $this->reminderService->onCalendarObjectDelete( |
|
| 108 | - $event->getObjectData() |
|
| 109 | - ); |
|
| 96 | + $this->logger->debug( |
|
| 97 | + sprintf('Reminders of calendar object of calendar %d cleaned up', $event->getCalendarId()) |
|
| 98 | + ); |
|
| 99 | + } catch (Throwable $e) { |
|
| 100 | + // Any error with activities shouldn't abort the calendar object deletion, so we just log it |
|
| 101 | + $this->logger->error('Error cleaning up reminders of a calendar object: ' . $e->getMessage(), [ |
|
| 102 | + 'exception' => $e, |
|
| 103 | + ]); |
|
| 104 | + } |
|
| 105 | + } elseif ($event instanceof CalendarObjectDeletedEvent) { |
|
| 106 | + try { |
|
| 107 | + $this->reminderService->onCalendarObjectDelete( |
|
| 108 | + $event->getObjectData() |
|
| 109 | + ); |
|
| 110 | 110 | |
| 111 | - $this->logger->debug( |
|
| 112 | - sprintf('Reminders of calendar object of calendar %d cleaned up', $event->getCalendarId()) |
|
| 113 | - ); |
|
| 114 | - } catch (Throwable $e) { |
|
| 115 | - // Any error with activities shouldn't abort the calendar object deletion, so we just log it |
|
| 116 | - $this->logger->error('Error cleaning up reminders of a deleted calendar object: ' . $e->getMessage(), [ |
|
| 117 | - 'exception' => $e, |
|
| 118 | - ]); |
|
| 119 | - } |
|
| 120 | - } |
|
| 121 | - } |
|
| 111 | + $this->logger->debug( |
|
| 112 | + sprintf('Reminders of calendar object of calendar %d cleaned up', $event->getCalendarId()) |
|
| 113 | + ); |
|
| 114 | + } catch (Throwable $e) { |
|
| 115 | + // Any error with activities shouldn't abort the calendar object deletion, so we just log it |
|
| 116 | + $this->logger->error('Error cleaning up reminders of a deleted calendar object: ' . $e->getMessage(), [ |
|
| 117 | + 'exception' => $e, |
|
| 118 | + ]); |
|
| 119 | + } |
|
| 120 | + } |
|
| 121 | + } |
|
| 122 | 122 | } |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | ); |
| 69 | 69 | } catch (Throwable $e) { |
| 70 | 70 | // Any error with activities shouldn't abort the calendar deletion, so we just log it |
| 71 | - $this->logger->error('Error cleaning up reminders of a deleted calendar: ' . $e->getMessage(), [ |
|
| 71 | + $this->logger->error('Error cleaning up reminders of a deleted calendar: '.$e->getMessage(), [ |
|
| 72 | 72 | 'exception' => $e, |
| 73 | 73 | ]); |
| 74 | 74 | } |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | ); |
| 84 | 84 | } catch (Throwable $e) { |
| 85 | 85 | // Any error with reminders shouldn't abort the calendar object creation, so we just log it |
| 86 | - $this->logger->error('Error creating reminders of a calendar object: ' . $e->getMessage(), [ |
|
| 86 | + $this->logger->error('Error creating reminders of a calendar object: '.$e->getMessage(), [ |
|
| 87 | 87 | 'exception' => $e, |
| 88 | 88 | ]); |
| 89 | 89 | } |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | ); |
| 99 | 99 | } catch (Throwable $e) { |
| 100 | 100 | // Any error with activities shouldn't abort the calendar object deletion, so we just log it |
| 101 | - $this->logger->error('Error cleaning up reminders of a calendar object: ' . $e->getMessage(), [ |
|
| 101 | + $this->logger->error('Error cleaning up reminders of a calendar object: '.$e->getMessage(), [ |
|
| 102 | 102 | 'exception' => $e, |
| 103 | 103 | ]); |
| 104 | 104 | } |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | ); |
| 114 | 114 | } catch (Throwable $e) { |
| 115 | 115 | // Any error with activities shouldn't abort the calendar object deletion, so we just log it |
| 116 | - $this->logger->error('Error cleaning up reminders of a deleted calendar object: ' . $e->getMessage(), [ |
|
| 116 | + $this->logger->error('Error cleaning up reminders of a deleted calendar object: '.$e->getMessage(), [ |
|
| 117 | 117 | 'exception' => $e, |
| 118 | 118 | ]); |
| 119 | 119 | } |
@@ -38,89 +38,89 @@ |
||
| 38 | 38 | |
| 39 | 39 | class ActivityUpdaterListener implements IEventListener { |
| 40 | 40 | |
| 41 | - /** @var ActivityBackend */ |
|
| 42 | - private $activityBackend; |
|
| 41 | + /** @var ActivityBackend */ |
|
| 42 | + private $activityBackend; |
|
| 43 | 43 | |
| 44 | - /** @var LoggerInterface */ |
|
| 45 | - private $logger; |
|
| 44 | + /** @var LoggerInterface */ |
|
| 45 | + private $logger; |
|
| 46 | 46 | |
| 47 | - public function __construct(ActivityBackend $activityBackend, |
|
| 48 | - LoggerInterface $logger) { |
|
| 49 | - $this->activityBackend = $activityBackend; |
|
| 50 | - $this->logger = $logger; |
|
| 51 | - } |
|
| 47 | + public function __construct(ActivityBackend $activityBackend, |
|
| 48 | + LoggerInterface $logger) { |
|
| 49 | + $this->activityBackend = $activityBackend; |
|
| 50 | + $this->logger = $logger; |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - public function handle(Event $event): void { |
|
| 54 | - if ($event instanceof CalendarDeletedEvent) { |
|
| 55 | - try { |
|
| 56 | - $this->activityBackend->onCalendarDelete( |
|
| 57 | - $event->getCalendarData(), |
|
| 58 | - $event->getShares() |
|
| 59 | - ); |
|
| 53 | + public function handle(Event $event): void { |
|
| 54 | + if ($event instanceof CalendarDeletedEvent) { |
|
| 55 | + try { |
|
| 56 | + $this->activityBackend->onCalendarDelete( |
|
| 57 | + $event->getCalendarData(), |
|
| 58 | + $event->getShares() |
|
| 59 | + ); |
|
| 60 | 60 | |
| 61 | - $this->logger->debug( |
|
| 62 | - sprintf('Activity generated for deleted calendar %d', $event->getCalendarId()) |
|
| 63 | - ); |
|
| 64 | - } catch (Throwable $e) { |
|
| 65 | - // Any error with activities shouldn't abort the calendar deletion, so we just log it |
|
| 66 | - $this->logger->error('Error generating activities for a deleted calendar: ' . $e->getMessage(), [ |
|
| 67 | - 'exception' => $e, |
|
| 68 | - ]); |
|
| 69 | - } |
|
| 70 | - } elseif ($event instanceof CalendarObjectCreatedEvent) { |
|
| 71 | - try { |
|
| 72 | - $this->activityBackend->onTouchCalendarObject( |
|
| 73 | - \OCA\DAV\CalDAV\Activity\Provider\Event::SUBJECT_OBJECT_ADD, |
|
| 74 | - $event->getCalendarData(), |
|
| 75 | - $event->getShares(), |
|
| 76 | - $event->getObjectData() |
|
| 77 | - ); |
|
| 61 | + $this->logger->debug( |
|
| 62 | + sprintf('Activity generated for deleted calendar %d', $event->getCalendarId()) |
|
| 63 | + ); |
|
| 64 | + } catch (Throwable $e) { |
|
| 65 | + // Any error with activities shouldn't abort the calendar deletion, so we just log it |
|
| 66 | + $this->logger->error('Error generating activities for a deleted calendar: ' . $e->getMessage(), [ |
|
| 67 | + 'exception' => $e, |
|
| 68 | + ]); |
|
| 69 | + } |
|
| 70 | + } elseif ($event instanceof CalendarObjectCreatedEvent) { |
|
| 71 | + try { |
|
| 72 | + $this->activityBackend->onTouchCalendarObject( |
|
| 73 | + \OCA\DAV\CalDAV\Activity\Provider\Event::SUBJECT_OBJECT_ADD, |
|
| 74 | + $event->getCalendarData(), |
|
| 75 | + $event->getShares(), |
|
| 76 | + $event->getObjectData() |
|
| 77 | + ); |
|
| 78 | 78 | |
| 79 | - $this->logger->debug( |
|
| 80 | - sprintf('Activity generated for new calendar object in calendar %d', $event->getCalendarId()) |
|
| 81 | - ); |
|
| 82 | - } catch (Throwable $e) { |
|
| 83 | - // Any error with activities shouldn't abort the calendar object creation, so we just log it |
|
| 84 | - $this->logger->error('Error generating activity for a new calendar object: ' . $e->getMessage(), [ |
|
| 85 | - 'exception' => $e, |
|
| 86 | - ]); |
|
| 87 | - } |
|
| 88 | - } elseif ($event instanceof CalendarObjectUpdatedEvent) { |
|
| 89 | - try { |
|
| 90 | - $this->activityBackend->onTouchCalendarObject( |
|
| 91 | - \OCA\DAV\CalDAV\Activity\Provider\Event::SUBJECT_OBJECT_UPDATE, |
|
| 92 | - $event->getCalendarData(), |
|
| 93 | - $event->getShares(), |
|
| 94 | - $event->getObjectData() |
|
| 95 | - ); |
|
| 79 | + $this->logger->debug( |
|
| 80 | + sprintf('Activity generated for new calendar object in calendar %d', $event->getCalendarId()) |
|
| 81 | + ); |
|
| 82 | + } catch (Throwable $e) { |
|
| 83 | + // Any error with activities shouldn't abort the calendar object creation, so we just log it |
|
| 84 | + $this->logger->error('Error generating activity for a new calendar object: ' . $e->getMessage(), [ |
|
| 85 | + 'exception' => $e, |
|
| 86 | + ]); |
|
| 87 | + } |
|
| 88 | + } elseif ($event instanceof CalendarObjectUpdatedEvent) { |
|
| 89 | + try { |
|
| 90 | + $this->activityBackend->onTouchCalendarObject( |
|
| 91 | + \OCA\DAV\CalDAV\Activity\Provider\Event::SUBJECT_OBJECT_UPDATE, |
|
| 92 | + $event->getCalendarData(), |
|
| 93 | + $event->getShares(), |
|
| 94 | + $event->getObjectData() |
|
| 95 | + ); |
|
| 96 | 96 | |
| 97 | - $this->logger->debug( |
|
| 98 | - sprintf('Activity generated for deleted calendar object %d', $event->getCalendarId()) |
|
| 99 | - ); |
|
| 100 | - } catch (Throwable $e) { |
|
| 101 | - // Any error with activities shouldn't abort the calendar deletion, so we just log it |
|
| 102 | - $this->logger->error('Error generating activity for a deleted calendar object: ' . $e->getMessage(), [ |
|
| 103 | - 'exception' => $e, |
|
| 104 | - ]); |
|
| 105 | - } |
|
| 106 | - } elseif ($event instanceof CalendarObjectDeletedEvent) { |
|
| 107 | - try { |
|
| 108 | - $this->activityBackend->onTouchCalendarObject( |
|
| 109 | - \OCA\DAV\CalDAV\Activity\Provider\Event::SUBJECT_OBJECT_DELETE, |
|
| 110 | - $event->getCalendarData(), |
|
| 111 | - $event->getShares(), |
|
| 112 | - $event->getObjectData() |
|
| 113 | - ); |
|
| 97 | + $this->logger->debug( |
|
| 98 | + sprintf('Activity generated for deleted calendar object %d', $event->getCalendarId()) |
|
| 99 | + ); |
|
| 100 | + } catch (Throwable $e) { |
|
| 101 | + // Any error with activities shouldn't abort the calendar deletion, so we just log it |
|
| 102 | + $this->logger->error('Error generating activity for a deleted calendar object: ' . $e->getMessage(), [ |
|
| 103 | + 'exception' => $e, |
|
| 104 | + ]); |
|
| 105 | + } |
|
| 106 | + } elseif ($event instanceof CalendarObjectDeletedEvent) { |
|
| 107 | + try { |
|
| 108 | + $this->activityBackend->onTouchCalendarObject( |
|
| 109 | + \OCA\DAV\CalDAV\Activity\Provider\Event::SUBJECT_OBJECT_DELETE, |
|
| 110 | + $event->getCalendarData(), |
|
| 111 | + $event->getShares(), |
|
| 112 | + $event->getObjectData() |
|
| 113 | + ); |
|
| 114 | 114 | |
| 115 | - $this->logger->debug( |
|
| 116 | - sprintf('Activity generated for deleted calendar object %d', $event->getCalendarId()) |
|
| 117 | - ); |
|
| 118 | - } catch (Throwable $e) { |
|
| 119 | - // Any error with activities shouldn't abort the calendar deletion, so we just log it |
|
| 120 | - $this->logger->error('Error generating activity for a deleted calendar object: ' . $e->getMessage(), [ |
|
| 121 | - 'exception' => $e, |
|
| 122 | - ]); |
|
| 123 | - } |
|
| 124 | - } |
|
| 125 | - } |
|
| 115 | + $this->logger->debug( |
|
| 116 | + sprintf('Activity generated for deleted calendar object %d', $event->getCalendarId()) |
|
| 117 | + ); |
|
| 118 | + } catch (Throwable $e) { |
|
| 119 | + // Any error with activities shouldn't abort the calendar deletion, so we just log it |
|
| 120 | + $this->logger->error('Error generating activity for a deleted calendar object: ' . $e->getMessage(), [ |
|
| 121 | + 'exception' => $e, |
|
| 122 | + ]); |
|
| 123 | + } |
|
| 124 | + } |
|
| 125 | + } |
|
| 126 | 126 | } |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | ); |
| 64 | 64 | } catch (Throwable $e) { |
| 65 | 65 | // Any error with activities shouldn't abort the calendar deletion, so we just log it |
| 66 | - $this->logger->error('Error generating activities for a deleted calendar: ' . $e->getMessage(), [ |
|
| 66 | + $this->logger->error('Error generating activities for a deleted calendar: '.$e->getMessage(), [ |
|
| 67 | 67 | 'exception' => $e, |
| 68 | 68 | ]); |
| 69 | 69 | } |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | ); |
| 82 | 82 | } catch (Throwable $e) { |
| 83 | 83 | // Any error with activities shouldn't abort the calendar object creation, so we just log it |
| 84 | - $this->logger->error('Error generating activity for a new calendar object: ' . $e->getMessage(), [ |
|
| 84 | + $this->logger->error('Error generating activity for a new calendar object: '.$e->getMessage(), [ |
|
| 85 | 85 | 'exception' => $e, |
| 86 | 86 | ]); |
| 87 | 87 | } |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | ); |
| 100 | 100 | } catch (Throwable $e) { |
| 101 | 101 | // Any error with activities shouldn't abort the calendar deletion, so we just log it |
| 102 | - $this->logger->error('Error generating activity for a deleted calendar object: ' . $e->getMessage(), [ |
|
| 102 | + $this->logger->error('Error generating activity for a deleted calendar object: '.$e->getMessage(), [ |
|
| 103 | 103 | 'exception' => $e, |
| 104 | 104 | ]); |
| 105 | 105 | } |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | ); |
| 118 | 118 | } catch (Throwable $e) { |
| 119 | 119 | // Any error with activities shouldn't abort the calendar deletion, so we just log it |
| 120 | - $this->logger->error('Error generating activity for a deleted calendar object: ' . $e->getMessage(), [ |
|
| 120 | + $this->logger->error('Error generating activity for a deleted calendar object: '.$e->getMessage(), [ |
|
| 121 | 121 | 'exception' => $e, |
| 122 | 122 | ]); |
| 123 | 123 | } |
@@ -81,281 +81,281 @@ |
||
| 81 | 81 | use function is_null; |
| 82 | 82 | |
| 83 | 83 | class Application extends App implements IBootstrap { |
| 84 | - public const APP_ID = 'dav'; |
|
| 84 | + public const APP_ID = 'dav'; |
|
| 85 | 85 | |
| 86 | - public function __construct() { |
|
| 87 | - parent::__construct(self::APP_ID); |
|
| 88 | - } |
|
| 86 | + public function __construct() { |
|
| 87 | + parent::__construct(self::APP_ID); |
|
| 88 | + } |
|
| 89 | 89 | |
| 90 | - public function register(IRegistrationContext $context): void { |
|
| 91 | - $context->registerServiceAlias('CardDAVSyncService', SyncService::class); |
|
| 92 | - $context->registerService(PhotoCache::class, function (ContainerInterface $c) { |
|
| 93 | - /** @var IServerContainer $server */ |
|
| 94 | - $server = $c->get(IServerContainer::class); |
|
| 90 | + public function register(IRegistrationContext $context): void { |
|
| 91 | + $context->registerServiceAlias('CardDAVSyncService', SyncService::class); |
|
| 92 | + $context->registerService(PhotoCache::class, function (ContainerInterface $c) { |
|
| 93 | + /** @var IServerContainer $server */ |
|
| 94 | + $server = $c->get(IServerContainer::class); |
|
| 95 | 95 | |
| 96 | - return new PhotoCache( |
|
| 97 | - $server->getAppDataDir('dav-photocache'), |
|
| 98 | - $c->get(ILogger::class) |
|
| 99 | - ); |
|
| 100 | - }); |
|
| 96 | + return new PhotoCache( |
|
| 97 | + $server->getAppDataDir('dav-photocache'), |
|
| 98 | + $c->get(ILogger::class) |
|
| 99 | + ); |
|
| 100 | + }); |
|
| 101 | 101 | |
| 102 | - /* |
|
| 102 | + /* |
|
| 103 | 103 | * Register capabilities |
| 104 | 104 | */ |
| 105 | - $context->registerCapability(Capabilities::class); |
|
| 105 | + $context->registerCapability(Capabilities::class); |
|
| 106 | 106 | |
| 107 | - /* |
|
| 107 | + /* |
|
| 108 | 108 | * Register Search Providers |
| 109 | 109 | */ |
| 110 | - $context->registerSearchProvider(ContactsSearchProvider::class); |
|
| 111 | - $context->registerSearchProvider(EventsSearchProvider::class); |
|
| 112 | - $context->registerSearchProvider(TasksSearchProvider::class); |
|
| 113 | - |
|
| 114 | - /** |
|
| 115 | - * Register event listeners |
|
| 116 | - */ |
|
| 117 | - $context->registerEventListener(CalendarDeletedEvent::class, ActivityUpdaterListener::class); |
|
| 118 | - $context->registerEventListener(CalendarDeletedEvent::class, CalendarObjectReminderUpdaterListener::class); |
|
| 119 | - $context->registerEventListener(CalendarDeletedEvent::class, CalendarDeletionDefaultUpdaterListener::class); |
|
| 120 | - $context->registerEventListener(CalendarObjectCreatedEvent::class, ActivityUpdaterListener::class); |
|
| 121 | - $context->registerEventListener(CalendarObjectCreatedEvent::class, CalendarContactInteractionListener::class); |
|
| 122 | - $context->registerEventListener(CalendarObjectCreatedEvent::class, CalendarObjectReminderUpdaterListener::class); |
|
| 123 | - $context->registerEventListener(CalendarObjectUpdatedEvent::class, ActivityUpdaterListener::class); |
|
| 124 | - $context->registerEventListener(CalendarObjectUpdatedEvent::class, CalendarContactInteractionListener::class); |
|
| 125 | - $context->registerEventListener(CalendarObjectUpdatedEvent::class, CalendarObjectReminderUpdaterListener::class); |
|
| 126 | - $context->registerEventListener(CalendarObjectDeletedEvent::class, ActivityUpdaterListener::class); |
|
| 127 | - $context->registerEventListener(CalendarObjectDeletedEvent::class, CalendarObjectReminderUpdaterListener::class); |
|
| 128 | - $context->registerEventListener(CalendarShareUpdatedEvent::class, CalendarContactInteractionListener::class); |
|
| 129 | - |
|
| 130 | - $context->registerNotifierService(Notifier::class); |
|
| 131 | - } |
|
| 132 | - |
|
| 133 | - public function boot(IBootContext $context): void { |
|
| 134 | - // Load all dav apps |
|
| 135 | - \OC_App::loadApps(['dav']); |
|
| 136 | - |
|
| 137 | - $context->injectFn([$this, 'registerHooks']); |
|
| 138 | - $context->injectFn([$this, 'registerContactsManager']); |
|
| 139 | - $context->injectFn([$this, 'registerCalendarManager']); |
|
| 140 | - $context->injectFn([$this, 'registerCalendarReminders']); |
|
| 141 | - } |
|
| 142 | - |
|
| 143 | - public function registerHooks(HookManager $hm, |
|
| 144 | - EventDispatcherInterface $dispatcher, |
|
| 145 | - IAppContainer $container, |
|
| 146 | - IServerContainer $serverContainer) { |
|
| 147 | - $hm->setup(); |
|
| 148 | - |
|
| 149 | - // first time login event setup |
|
| 150 | - $dispatcher->addListener(IUser::class . '::firstLogin', function ($event) use ($hm) { |
|
| 151 | - if ($event instanceof GenericEvent) { |
|
| 152 | - $hm->firstLogin($event->getSubject()); |
|
| 153 | - } |
|
| 154 | - }); |
|
| 155 | - |
|
| 156 | - $birthdayListener = function ($event) use ($container): void { |
|
| 157 | - if ($event instanceof GenericEvent) { |
|
| 158 | - /** @var BirthdayService $b */ |
|
| 159 | - $b = $container->query(BirthdayService::class); |
|
| 160 | - $b->onCardChanged( |
|
| 161 | - (int) $event->getArgument('addressBookId'), |
|
| 162 | - (string) $event->getArgument('cardUri'), |
|
| 163 | - (string) $event->getArgument('cardData') |
|
| 164 | - ); |
|
| 165 | - } |
|
| 166 | - }; |
|
| 167 | - |
|
| 168 | - $dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::createCard', $birthdayListener); |
|
| 169 | - $dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::updateCard', $birthdayListener); |
|
| 170 | - $dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::deleteCard', function ($event) use ($container) { |
|
| 171 | - if ($event instanceof GenericEvent) { |
|
| 172 | - /** @var BirthdayService $b */ |
|
| 173 | - $b = $container->query(BirthdayService::class); |
|
| 174 | - $b->onCardDeleted( |
|
| 175 | - (int) $event->getArgument('addressBookId'), |
|
| 176 | - (string) $event->getArgument('cardUri') |
|
| 177 | - ); |
|
| 178 | - } |
|
| 179 | - }); |
|
| 180 | - |
|
| 181 | - $clearPhotoCache = function ($event) use ($container): void { |
|
| 182 | - if ($event instanceof GenericEvent) { |
|
| 183 | - /** @var PhotoCache $p */ |
|
| 184 | - $p = $container->query(PhotoCache::class); |
|
| 185 | - $p->delete( |
|
| 186 | - $event->getArgument('addressBookId'), |
|
| 187 | - $event->getArgument('cardUri') |
|
| 188 | - ); |
|
| 189 | - } |
|
| 190 | - }; |
|
| 191 | - $dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::updateCard', $clearPhotoCache); |
|
| 192 | - $dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::deleteCard', $clearPhotoCache); |
|
| 193 | - |
|
| 194 | - $dispatcher->addListener('OC\AccountManager::userUpdated', function (GenericEvent $event) use ($container) { |
|
| 195 | - $user = $event->getSubject(); |
|
| 196 | - /** @var SyncService $syncService */ |
|
| 197 | - $syncService = $container->query(SyncService::class); |
|
| 198 | - $syncService->updateUser($user); |
|
| 199 | - }); |
|
| 200 | - |
|
| 201 | - $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::createCalendar', function (GenericEvent $event) use ($container) { |
|
| 202 | - /** @var Backend $backend */ |
|
| 203 | - $backend = $container->query(Backend::class); |
|
| 204 | - $backend->onCalendarAdd( |
|
| 205 | - $event->getArgument('calendarData') |
|
| 206 | - ); |
|
| 207 | - }); |
|
| 208 | - $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::updateCalendar', function (GenericEvent $event) use ($container) { |
|
| 209 | - /** @var Backend $backend */ |
|
| 210 | - $backend = $container->query(Backend::class); |
|
| 211 | - $backend->onCalendarUpdate( |
|
| 212 | - $event->getArgument('calendarData'), |
|
| 213 | - $event->getArgument('shares'), |
|
| 214 | - $event->getArgument('propertyMutations') |
|
| 215 | - ); |
|
| 216 | - }); |
|
| 217 | - $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::updateShares', function (GenericEvent $event) use ($container) { |
|
| 218 | - /** @var Backend $backend */ |
|
| 219 | - $backend = $container->query(Backend::class); |
|
| 220 | - $backend->onCalendarUpdateShares( |
|
| 221 | - $event->getArgument('calendarData'), |
|
| 222 | - $event->getArgument('shares'), |
|
| 223 | - $event->getArgument('add'), |
|
| 224 | - $event->getArgument('remove') |
|
| 225 | - ); |
|
| 226 | - |
|
| 227 | - // Here we should recalculate if reminders should be sent to new or old sharees |
|
| 228 | - }); |
|
| 229 | - |
|
| 230 | - $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::publishCalendar', function (GenericEvent $event) use ($container) { |
|
| 231 | - /** @var Backend $backend */ |
|
| 232 | - $backend = $container->query(Backend::class); |
|
| 233 | - $backend->onCalendarPublication( |
|
| 234 | - $event->getArgument('calendarData'), |
|
| 235 | - $event->getArgument('public') |
|
| 236 | - ); |
|
| 237 | - }); |
|
| 238 | - |
|
| 239 | - |
|
| 240 | - $dispatcher->addListener('OCP\Federation\TrustedServerEvent::remove', |
|
| 241 | - function (GenericEvent $event) { |
|
| 242 | - /** @var CardDavBackend $cardDavBackend */ |
|
| 243 | - $cardDavBackend = \OC::$server->query(CardDavBackend::class); |
|
| 244 | - $addressBookUri = $event->getSubject(); |
|
| 245 | - $addressBook = $cardDavBackend->getAddressBooksByUri('principals/system/system', $addressBookUri); |
|
| 246 | - if (!is_null($addressBook)) { |
|
| 247 | - $cardDavBackend->deleteAddressBook($addressBook['id']); |
|
| 248 | - } |
|
| 249 | - } |
|
| 250 | - ); |
|
| 251 | - |
|
| 252 | - $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::createSubscription', |
|
| 253 | - function (GenericEvent $event) use ($container, $serverContainer) { |
|
| 254 | - $jobList = $serverContainer->getJobList(); |
|
| 255 | - $subscriptionData = $event->getArgument('subscriptionData'); |
|
| 256 | - |
|
| 257 | - /** |
|
| 258 | - * Initial subscription refetch |
|
| 259 | - * |
|
| 260 | - * @var RefreshWebcalService $refreshWebcalService |
|
| 261 | - */ |
|
| 262 | - $refreshWebcalService = $container->query(RefreshWebcalService::class); |
|
| 263 | - $refreshWebcalService->refreshSubscription( |
|
| 264 | - (string) $subscriptionData['principaluri'], |
|
| 265 | - (string) $subscriptionData['uri'] |
|
| 266 | - ); |
|
| 267 | - |
|
| 268 | - $jobList->add(\OCA\DAV\BackgroundJob\RefreshWebcalJob::class, [ |
|
| 269 | - 'principaluri' => $subscriptionData['principaluri'], |
|
| 270 | - 'uri' => $subscriptionData['uri'] |
|
| 271 | - ]); |
|
| 272 | - } |
|
| 273 | - ); |
|
| 274 | - |
|
| 275 | - $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::deleteSubscription', |
|
| 276 | - function (GenericEvent $event) use ($container, $serverContainer) { |
|
| 277 | - $jobList = $serverContainer->getJobList(); |
|
| 278 | - $subscriptionData = $event->getArgument('subscriptionData'); |
|
| 279 | - |
|
| 280 | - $jobList->remove(\OCA\DAV\BackgroundJob\RefreshWebcalJob::class, [ |
|
| 281 | - 'principaluri' => $subscriptionData['principaluri'], |
|
| 282 | - 'uri' => $subscriptionData['uri'] |
|
| 283 | - ]); |
|
| 284 | - |
|
| 285 | - /** @var CalDavBackend $calDavBackend */ |
|
| 286 | - $calDavBackend = $container->query(CalDavBackend::class); |
|
| 287 | - $calDavBackend->purgeAllCachedEventsForSubscription($subscriptionData['id']); |
|
| 288 | - } |
|
| 289 | - ); |
|
| 290 | - |
|
| 291 | - $eventHandler = function () use ($container, $serverContainer): void { |
|
| 292 | - try { |
|
| 293 | - /** @var UpdateCalendarResourcesRoomsBackgroundJob $job */ |
|
| 294 | - $job = $container->query(UpdateCalendarResourcesRoomsBackgroundJob::class); |
|
| 295 | - $job->run([]); |
|
| 296 | - $serverContainer->getJobList()->setLastRun($job); |
|
| 297 | - } catch (Exception $ex) { |
|
| 298 | - $serverContainer->getLogger()->logException($ex); |
|
| 299 | - } |
|
| 300 | - }; |
|
| 301 | - |
|
| 302 | - $dispatcher->addListener('\OCP\Calendar\Resource\ForceRefreshEvent', $eventHandler); |
|
| 303 | - $dispatcher->addListener('\OCP\Calendar\Room\ForceRefreshEvent', $eventHandler); |
|
| 304 | - } |
|
| 305 | - |
|
| 306 | - public function registerContactsManager(IContactsManager $cm, IAppContainer $container): void { |
|
| 307 | - $cm->register(function () use ($container, $cm): void { |
|
| 308 | - $user = \OC::$server->getUserSession()->getUser(); |
|
| 309 | - if (!is_null($user)) { |
|
| 310 | - $this->setupContactsProvider($cm, $container, $user->getUID()); |
|
| 311 | - } else { |
|
| 312 | - $this->setupSystemContactsProvider($cm, $container); |
|
| 313 | - } |
|
| 314 | - }); |
|
| 315 | - } |
|
| 316 | - |
|
| 317 | - private function setupContactsProvider(IContactsManager $contactsManager, |
|
| 318 | - IAppContainer $container, |
|
| 319 | - string $userID): void { |
|
| 320 | - /** @var ContactsManager $cm */ |
|
| 321 | - $cm = $container->query(ContactsManager::class); |
|
| 322 | - $urlGenerator = $container->getServer()->getURLGenerator(); |
|
| 323 | - $cm->setupContactsProvider($contactsManager, $userID, $urlGenerator); |
|
| 324 | - } |
|
| 325 | - |
|
| 326 | - private function setupSystemContactsProvider(IContactsManager $contactsManager, |
|
| 327 | - IAppContainer $container): void { |
|
| 328 | - /** @var ContactsManager $cm */ |
|
| 329 | - $cm = $container->query(ContactsManager::class); |
|
| 330 | - $urlGenerator = $container->getServer()->getURLGenerator(); |
|
| 331 | - $cm->setupSystemContactsProvider($contactsManager, $urlGenerator); |
|
| 332 | - } |
|
| 333 | - |
|
| 334 | - public function registerCalendarManager(ICalendarManager $calendarManager, |
|
| 335 | - IAppContainer $container): void { |
|
| 336 | - $calendarManager->register(function () use ($container, $calendarManager) { |
|
| 337 | - $user = \OC::$server->getUserSession()->getUser(); |
|
| 338 | - if ($user !== null) { |
|
| 339 | - $this->setupCalendarProvider($calendarManager, $container, $user->getUID()); |
|
| 340 | - } |
|
| 341 | - }); |
|
| 342 | - } |
|
| 343 | - |
|
| 344 | - private function setupCalendarProvider(ICalendarManager $calendarManager, |
|
| 345 | - IAppContainer $container, |
|
| 346 | - $userId) { |
|
| 347 | - $cm = $container->query(CalendarManager::class); |
|
| 348 | - $cm->setupCalendarProvider($calendarManager, $userId); |
|
| 349 | - } |
|
| 350 | - |
|
| 351 | - public function registerCalendarReminders(NotificationProviderManager $manager, |
|
| 352 | - ILogger $logger): void { |
|
| 353 | - try { |
|
| 354 | - $manager->registerProvider(AudioProvider::class); |
|
| 355 | - $manager->registerProvider(EmailProvider::class); |
|
| 356 | - $manager->registerProvider(PushProvider::class); |
|
| 357 | - } catch (Throwable $ex) { |
|
| 358 | - $logger->logException($ex); |
|
| 359 | - } |
|
| 360 | - } |
|
| 110 | + $context->registerSearchProvider(ContactsSearchProvider::class); |
|
| 111 | + $context->registerSearchProvider(EventsSearchProvider::class); |
|
| 112 | + $context->registerSearchProvider(TasksSearchProvider::class); |
|
| 113 | + |
|
| 114 | + /** |
|
| 115 | + * Register event listeners |
|
| 116 | + */ |
|
| 117 | + $context->registerEventListener(CalendarDeletedEvent::class, ActivityUpdaterListener::class); |
|
| 118 | + $context->registerEventListener(CalendarDeletedEvent::class, CalendarObjectReminderUpdaterListener::class); |
|
| 119 | + $context->registerEventListener(CalendarDeletedEvent::class, CalendarDeletionDefaultUpdaterListener::class); |
|
| 120 | + $context->registerEventListener(CalendarObjectCreatedEvent::class, ActivityUpdaterListener::class); |
|
| 121 | + $context->registerEventListener(CalendarObjectCreatedEvent::class, CalendarContactInteractionListener::class); |
|
| 122 | + $context->registerEventListener(CalendarObjectCreatedEvent::class, CalendarObjectReminderUpdaterListener::class); |
|
| 123 | + $context->registerEventListener(CalendarObjectUpdatedEvent::class, ActivityUpdaterListener::class); |
|
| 124 | + $context->registerEventListener(CalendarObjectUpdatedEvent::class, CalendarContactInteractionListener::class); |
|
| 125 | + $context->registerEventListener(CalendarObjectUpdatedEvent::class, CalendarObjectReminderUpdaterListener::class); |
|
| 126 | + $context->registerEventListener(CalendarObjectDeletedEvent::class, ActivityUpdaterListener::class); |
|
| 127 | + $context->registerEventListener(CalendarObjectDeletedEvent::class, CalendarObjectReminderUpdaterListener::class); |
|
| 128 | + $context->registerEventListener(CalendarShareUpdatedEvent::class, CalendarContactInteractionListener::class); |
|
| 129 | + |
|
| 130 | + $context->registerNotifierService(Notifier::class); |
|
| 131 | + } |
|
| 132 | + |
|
| 133 | + public function boot(IBootContext $context): void { |
|
| 134 | + // Load all dav apps |
|
| 135 | + \OC_App::loadApps(['dav']); |
|
| 136 | + |
|
| 137 | + $context->injectFn([$this, 'registerHooks']); |
|
| 138 | + $context->injectFn([$this, 'registerContactsManager']); |
|
| 139 | + $context->injectFn([$this, 'registerCalendarManager']); |
|
| 140 | + $context->injectFn([$this, 'registerCalendarReminders']); |
|
| 141 | + } |
|
| 142 | + |
|
| 143 | + public function registerHooks(HookManager $hm, |
|
| 144 | + EventDispatcherInterface $dispatcher, |
|
| 145 | + IAppContainer $container, |
|
| 146 | + IServerContainer $serverContainer) { |
|
| 147 | + $hm->setup(); |
|
| 148 | + |
|
| 149 | + // first time login event setup |
|
| 150 | + $dispatcher->addListener(IUser::class . '::firstLogin', function ($event) use ($hm) { |
|
| 151 | + if ($event instanceof GenericEvent) { |
|
| 152 | + $hm->firstLogin($event->getSubject()); |
|
| 153 | + } |
|
| 154 | + }); |
|
| 155 | + |
|
| 156 | + $birthdayListener = function ($event) use ($container): void { |
|
| 157 | + if ($event instanceof GenericEvent) { |
|
| 158 | + /** @var BirthdayService $b */ |
|
| 159 | + $b = $container->query(BirthdayService::class); |
|
| 160 | + $b->onCardChanged( |
|
| 161 | + (int) $event->getArgument('addressBookId'), |
|
| 162 | + (string) $event->getArgument('cardUri'), |
|
| 163 | + (string) $event->getArgument('cardData') |
|
| 164 | + ); |
|
| 165 | + } |
|
| 166 | + }; |
|
| 167 | + |
|
| 168 | + $dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::createCard', $birthdayListener); |
|
| 169 | + $dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::updateCard', $birthdayListener); |
|
| 170 | + $dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::deleteCard', function ($event) use ($container) { |
|
| 171 | + if ($event instanceof GenericEvent) { |
|
| 172 | + /** @var BirthdayService $b */ |
|
| 173 | + $b = $container->query(BirthdayService::class); |
|
| 174 | + $b->onCardDeleted( |
|
| 175 | + (int) $event->getArgument('addressBookId'), |
|
| 176 | + (string) $event->getArgument('cardUri') |
|
| 177 | + ); |
|
| 178 | + } |
|
| 179 | + }); |
|
| 180 | + |
|
| 181 | + $clearPhotoCache = function ($event) use ($container): void { |
|
| 182 | + if ($event instanceof GenericEvent) { |
|
| 183 | + /** @var PhotoCache $p */ |
|
| 184 | + $p = $container->query(PhotoCache::class); |
|
| 185 | + $p->delete( |
|
| 186 | + $event->getArgument('addressBookId'), |
|
| 187 | + $event->getArgument('cardUri') |
|
| 188 | + ); |
|
| 189 | + } |
|
| 190 | + }; |
|
| 191 | + $dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::updateCard', $clearPhotoCache); |
|
| 192 | + $dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::deleteCard', $clearPhotoCache); |
|
| 193 | + |
|
| 194 | + $dispatcher->addListener('OC\AccountManager::userUpdated', function (GenericEvent $event) use ($container) { |
|
| 195 | + $user = $event->getSubject(); |
|
| 196 | + /** @var SyncService $syncService */ |
|
| 197 | + $syncService = $container->query(SyncService::class); |
|
| 198 | + $syncService->updateUser($user); |
|
| 199 | + }); |
|
| 200 | + |
|
| 201 | + $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::createCalendar', function (GenericEvent $event) use ($container) { |
|
| 202 | + /** @var Backend $backend */ |
|
| 203 | + $backend = $container->query(Backend::class); |
|
| 204 | + $backend->onCalendarAdd( |
|
| 205 | + $event->getArgument('calendarData') |
|
| 206 | + ); |
|
| 207 | + }); |
|
| 208 | + $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::updateCalendar', function (GenericEvent $event) use ($container) { |
|
| 209 | + /** @var Backend $backend */ |
|
| 210 | + $backend = $container->query(Backend::class); |
|
| 211 | + $backend->onCalendarUpdate( |
|
| 212 | + $event->getArgument('calendarData'), |
|
| 213 | + $event->getArgument('shares'), |
|
| 214 | + $event->getArgument('propertyMutations') |
|
| 215 | + ); |
|
| 216 | + }); |
|
| 217 | + $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::updateShares', function (GenericEvent $event) use ($container) { |
|
| 218 | + /** @var Backend $backend */ |
|
| 219 | + $backend = $container->query(Backend::class); |
|
| 220 | + $backend->onCalendarUpdateShares( |
|
| 221 | + $event->getArgument('calendarData'), |
|
| 222 | + $event->getArgument('shares'), |
|
| 223 | + $event->getArgument('add'), |
|
| 224 | + $event->getArgument('remove') |
|
| 225 | + ); |
|
| 226 | + |
|
| 227 | + // Here we should recalculate if reminders should be sent to new or old sharees |
|
| 228 | + }); |
|
| 229 | + |
|
| 230 | + $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::publishCalendar', function (GenericEvent $event) use ($container) { |
|
| 231 | + /** @var Backend $backend */ |
|
| 232 | + $backend = $container->query(Backend::class); |
|
| 233 | + $backend->onCalendarPublication( |
|
| 234 | + $event->getArgument('calendarData'), |
|
| 235 | + $event->getArgument('public') |
|
| 236 | + ); |
|
| 237 | + }); |
|
| 238 | + |
|
| 239 | + |
|
| 240 | + $dispatcher->addListener('OCP\Federation\TrustedServerEvent::remove', |
|
| 241 | + function (GenericEvent $event) { |
|
| 242 | + /** @var CardDavBackend $cardDavBackend */ |
|
| 243 | + $cardDavBackend = \OC::$server->query(CardDavBackend::class); |
|
| 244 | + $addressBookUri = $event->getSubject(); |
|
| 245 | + $addressBook = $cardDavBackend->getAddressBooksByUri('principals/system/system', $addressBookUri); |
|
| 246 | + if (!is_null($addressBook)) { |
|
| 247 | + $cardDavBackend->deleteAddressBook($addressBook['id']); |
|
| 248 | + } |
|
| 249 | + } |
|
| 250 | + ); |
|
| 251 | + |
|
| 252 | + $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::createSubscription', |
|
| 253 | + function (GenericEvent $event) use ($container, $serverContainer) { |
|
| 254 | + $jobList = $serverContainer->getJobList(); |
|
| 255 | + $subscriptionData = $event->getArgument('subscriptionData'); |
|
| 256 | + |
|
| 257 | + /** |
|
| 258 | + * Initial subscription refetch |
|
| 259 | + * |
|
| 260 | + * @var RefreshWebcalService $refreshWebcalService |
|
| 261 | + */ |
|
| 262 | + $refreshWebcalService = $container->query(RefreshWebcalService::class); |
|
| 263 | + $refreshWebcalService->refreshSubscription( |
|
| 264 | + (string) $subscriptionData['principaluri'], |
|
| 265 | + (string) $subscriptionData['uri'] |
|
| 266 | + ); |
|
| 267 | + |
|
| 268 | + $jobList->add(\OCA\DAV\BackgroundJob\RefreshWebcalJob::class, [ |
|
| 269 | + 'principaluri' => $subscriptionData['principaluri'], |
|
| 270 | + 'uri' => $subscriptionData['uri'] |
|
| 271 | + ]); |
|
| 272 | + } |
|
| 273 | + ); |
|
| 274 | + |
|
| 275 | + $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::deleteSubscription', |
|
| 276 | + function (GenericEvent $event) use ($container, $serverContainer) { |
|
| 277 | + $jobList = $serverContainer->getJobList(); |
|
| 278 | + $subscriptionData = $event->getArgument('subscriptionData'); |
|
| 279 | + |
|
| 280 | + $jobList->remove(\OCA\DAV\BackgroundJob\RefreshWebcalJob::class, [ |
|
| 281 | + 'principaluri' => $subscriptionData['principaluri'], |
|
| 282 | + 'uri' => $subscriptionData['uri'] |
|
| 283 | + ]); |
|
| 284 | + |
|
| 285 | + /** @var CalDavBackend $calDavBackend */ |
|
| 286 | + $calDavBackend = $container->query(CalDavBackend::class); |
|
| 287 | + $calDavBackend->purgeAllCachedEventsForSubscription($subscriptionData['id']); |
|
| 288 | + } |
|
| 289 | + ); |
|
| 290 | + |
|
| 291 | + $eventHandler = function () use ($container, $serverContainer): void { |
|
| 292 | + try { |
|
| 293 | + /** @var UpdateCalendarResourcesRoomsBackgroundJob $job */ |
|
| 294 | + $job = $container->query(UpdateCalendarResourcesRoomsBackgroundJob::class); |
|
| 295 | + $job->run([]); |
|
| 296 | + $serverContainer->getJobList()->setLastRun($job); |
|
| 297 | + } catch (Exception $ex) { |
|
| 298 | + $serverContainer->getLogger()->logException($ex); |
|
| 299 | + } |
|
| 300 | + }; |
|
| 301 | + |
|
| 302 | + $dispatcher->addListener('\OCP\Calendar\Resource\ForceRefreshEvent', $eventHandler); |
|
| 303 | + $dispatcher->addListener('\OCP\Calendar\Room\ForceRefreshEvent', $eventHandler); |
|
| 304 | + } |
|
| 305 | + |
|
| 306 | + public function registerContactsManager(IContactsManager $cm, IAppContainer $container): void { |
|
| 307 | + $cm->register(function () use ($container, $cm): void { |
|
| 308 | + $user = \OC::$server->getUserSession()->getUser(); |
|
| 309 | + if (!is_null($user)) { |
|
| 310 | + $this->setupContactsProvider($cm, $container, $user->getUID()); |
|
| 311 | + } else { |
|
| 312 | + $this->setupSystemContactsProvider($cm, $container); |
|
| 313 | + } |
|
| 314 | + }); |
|
| 315 | + } |
|
| 316 | + |
|
| 317 | + private function setupContactsProvider(IContactsManager $contactsManager, |
|
| 318 | + IAppContainer $container, |
|
| 319 | + string $userID): void { |
|
| 320 | + /** @var ContactsManager $cm */ |
|
| 321 | + $cm = $container->query(ContactsManager::class); |
|
| 322 | + $urlGenerator = $container->getServer()->getURLGenerator(); |
|
| 323 | + $cm->setupContactsProvider($contactsManager, $userID, $urlGenerator); |
|
| 324 | + } |
|
| 325 | + |
|
| 326 | + private function setupSystemContactsProvider(IContactsManager $contactsManager, |
|
| 327 | + IAppContainer $container): void { |
|
| 328 | + /** @var ContactsManager $cm */ |
|
| 329 | + $cm = $container->query(ContactsManager::class); |
|
| 330 | + $urlGenerator = $container->getServer()->getURLGenerator(); |
|
| 331 | + $cm->setupSystemContactsProvider($contactsManager, $urlGenerator); |
|
| 332 | + } |
|
| 333 | + |
|
| 334 | + public function registerCalendarManager(ICalendarManager $calendarManager, |
|
| 335 | + IAppContainer $container): void { |
|
| 336 | + $calendarManager->register(function () use ($container, $calendarManager) { |
|
| 337 | + $user = \OC::$server->getUserSession()->getUser(); |
|
| 338 | + if ($user !== null) { |
|
| 339 | + $this->setupCalendarProvider($calendarManager, $container, $user->getUID()); |
|
| 340 | + } |
|
| 341 | + }); |
|
| 342 | + } |
|
| 343 | + |
|
| 344 | + private function setupCalendarProvider(ICalendarManager $calendarManager, |
|
| 345 | + IAppContainer $container, |
|
| 346 | + $userId) { |
|
| 347 | + $cm = $container->query(CalendarManager::class); |
|
| 348 | + $cm->setupCalendarProvider($calendarManager, $userId); |
|
| 349 | + } |
|
| 350 | + |
|
| 351 | + public function registerCalendarReminders(NotificationProviderManager $manager, |
|
| 352 | + ILogger $logger): void { |
|
| 353 | + try { |
|
| 354 | + $manager->registerProvider(AudioProvider::class); |
|
| 355 | + $manager->registerProvider(EmailProvider::class); |
|
| 356 | + $manager->registerProvider(PushProvider::class); |
|
| 357 | + } catch (Throwable $ex) { |
|
| 358 | + $logger->logException($ex); |
|
| 359 | + } |
|
| 360 | + } |
|
| 361 | 361 | } |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | public function register(IRegistrationContext $context): void { |
| 91 | 91 | $context->registerServiceAlias('CardDAVSyncService', SyncService::class); |
| 92 | - $context->registerService(PhotoCache::class, function (ContainerInterface $c) { |
|
| 92 | + $context->registerService(PhotoCache::class, function(ContainerInterface $c) { |
|
| 93 | 93 | /** @var IServerContainer $server */ |
| 94 | 94 | $server = $c->get(IServerContainer::class); |
| 95 | 95 | |
@@ -147,13 +147,13 @@ discard block |
||
| 147 | 147 | $hm->setup(); |
| 148 | 148 | |
| 149 | 149 | // first time login event setup |
| 150 | - $dispatcher->addListener(IUser::class . '::firstLogin', function ($event) use ($hm) { |
|
| 150 | + $dispatcher->addListener(IUser::class.'::firstLogin', function($event) use ($hm) { |
|
| 151 | 151 | if ($event instanceof GenericEvent) { |
| 152 | 152 | $hm->firstLogin($event->getSubject()); |
| 153 | 153 | } |
| 154 | 154 | }); |
| 155 | 155 | |
| 156 | - $birthdayListener = function ($event) use ($container): void { |
|
| 156 | + $birthdayListener = function($event) use ($container): void { |
|
| 157 | 157 | if ($event instanceof GenericEvent) { |
| 158 | 158 | /** @var BirthdayService $b */ |
| 159 | 159 | $b = $container->query(BirthdayService::class); |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | |
| 168 | 168 | $dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::createCard', $birthdayListener); |
| 169 | 169 | $dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::updateCard', $birthdayListener); |
| 170 | - $dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::deleteCard', function ($event) use ($container) { |
|
| 170 | + $dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::deleteCard', function($event) use ($container) { |
|
| 171 | 171 | if ($event instanceof GenericEvent) { |
| 172 | 172 | /** @var BirthdayService $b */ |
| 173 | 173 | $b = $container->query(BirthdayService::class); |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | } |
| 179 | 179 | }); |
| 180 | 180 | |
| 181 | - $clearPhotoCache = function ($event) use ($container): void { |
|
| 181 | + $clearPhotoCache = function($event) use ($container): void { |
|
| 182 | 182 | if ($event instanceof GenericEvent) { |
| 183 | 183 | /** @var PhotoCache $p */ |
| 184 | 184 | $p = $container->query(PhotoCache::class); |
@@ -191,21 +191,21 @@ discard block |
||
| 191 | 191 | $dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::updateCard', $clearPhotoCache); |
| 192 | 192 | $dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::deleteCard', $clearPhotoCache); |
| 193 | 193 | |
| 194 | - $dispatcher->addListener('OC\AccountManager::userUpdated', function (GenericEvent $event) use ($container) { |
|
| 194 | + $dispatcher->addListener('OC\AccountManager::userUpdated', function(GenericEvent $event) use ($container) { |
|
| 195 | 195 | $user = $event->getSubject(); |
| 196 | 196 | /** @var SyncService $syncService */ |
| 197 | 197 | $syncService = $container->query(SyncService::class); |
| 198 | 198 | $syncService->updateUser($user); |
| 199 | 199 | }); |
| 200 | 200 | |
| 201 | - $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::createCalendar', function (GenericEvent $event) use ($container) { |
|
| 201 | + $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::createCalendar', function(GenericEvent $event) use ($container) { |
|
| 202 | 202 | /** @var Backend $backend */ |
| 203 | 203 | $backend = $container->query(Backend::class); |
| 204 | 204 | $backend->onCalendarAdd( |
| 205 | 205 | $event->getArgument('calendarData') |
| 206 | 206 | ); |
| 207 | 207 | }); |
| 208 | - $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::updateCalendar', function (GenericEvent $event) use ($container) { |
|
| 208 | + $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::updateCalendar', function(GenericEvent $event) use ($container) { |
|
| 209 | 209 | /** @var Backend $backend */ |
| 210 | 210 | $backend = $container->query(Backend::class); |
| 211 | 211 | $backend->onCalendarUpdate( |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | $event->getArgument('propertyMutations') |
| 215 | 215 | ); |
| 216 | 216 | }); |
| 217 | - $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::updateShares', function (GenericEvent $event) use ($container) { |
|
| 217 | + $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::updateShares', function(GenericEvent $event) use ($container) { |
|
| 218 | 218 | /** @var Backend $backend */ |
| 219 | 219 | $backend = $container->query(Backend::class); |
| 220 | 220 | $backend->onCalendarUpdateShares( |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | // Here we should recalculate if reminders should be sent to new or old sharees |
| 228 | 228 | }); |
| 229 | 229 | |
| 230 | - $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::publishCalendar', function (GenericEvent $event) use ($container) { |
|
| 230 | + $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::publishCalendar', function(GenericEvent $event) use ($container) { |
|
| 231 | 231 | /** @var Backend $backend */ |
| 232 | 232 | $backend = $container->query(Backend::class); |
| 233 | 233 | $backend->onCalendarPublication( |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | |
| 239 | 239 | |
| 240 | 240 | $dispatcher->addListener('OCP\Federation\TrustedServerEvent::remove', |
| 241 | - function (GenericEvent $event) { |
|
| 241 | + function(GenericEvent $event) { |
|
| 242 | 242 | /** @var CardDavBackend $cardDavBackend */ |
| 243 | 243 | $cardDavBackend = \OC::$server->query(CardDavBackend::class); |
| 244 | 244 | $addressBookUri = $event->getSubject(); |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | ); |
| 251 | 251 | |
| 252 | 252 | $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::createSubscription', |
| 253 | - function (GenericEvent $event) use ($container, $serverContainer) { |
|
| 253 | + function(GenericEvent $event) use ($container, $serverContainer) { |
|
| 254 | 254 | $jobList = $serverContainer->getJobList(); |
| 255 | 255 | $subscriptionData = $event->getArgument('subscriptionData'); |
| 256 | 256 | |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | ); |
| 274 | 274 | |
| 275 | 275 | $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::deleteSubscription', |
| 276 | - function (GenericEvent $event) use ($container, $serverContainer) { |
|
| 276 | + function(GenericEvent $event) use ($container, $serverContainer) { |
|
| 277 | 277 | $jobList = $serverContainer->getJobList(); |
| 278 | 278 | $subscriptionData = $event->getArgument('subscriptionData'); |
| 279 | 279 | |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | } |
| 289 | 289 | ); |
| 290 | 290 | |
| 291 | - $eventHandler = function () use ($container, $serverContainer): void { |
|
| 291 | + $eventHandler = function() use ($container, $serverContainer): void { |
|
| 292 | 292 | try { |
| 293 | 293 | /** @var UpdateCalendarResourcesRoomsBackgroundJob $job */ |
| 294 | 294 | $job = $container->query(UpdateCalendarResourcesRoomsBackgroundJob::class); |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | } |
| 305 | 305 | |
| 306 | 306 | public function registerContactsManager(IContactsManager $cm, IAppContainer $container): void { |
| 307 | - $cm->register(function () use ($container, $cm): void { |
|
| 307 | + $cm->register(function() use ($container, $cm): void { |
|
| 308 | 308 | $user = \OC::$server->getUserSession()->getUser(); |
| 309 | 309 | if (!is_null($user)) { |
| 310 | 310 | $this->setupContactsProvider($cm, $container, $user->getUID()); |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | |
| 334 | 334 | public function registerCalendarManager(ICalendarManager $calendarManager, |
| 335 | 335 | IAppContainer $container): void { |
| 336 | - $calendarManager->register(function () use ($container, $calendarManager) { |
|
| 336 | + $calendarManager->register(function() use ($container, $calendarManager) { |
|
| 337 | 337 | $user = \OC::$server->getUserSession()->getUser(); |
| 338 | 338 | if ($user !== null) { |
| 339 | 339 | $this->setupCalendarProvider($calendarManager, $container, $user->getUID()); |
@@ -96,2740 +96,2740 @@ |
||
| 96 | 96 | * @package OCA\DAV\CalDAV |
| 97 | 97 | */ |
| 98 | 98 | class CalDavBackend extends AbstractBackend implements SyncSupport, SubscriptionSupport, SchedulingSupport { |
| 99 | - public const CALENDAR_TYPE_CALENDAR = 0; |
|
| 100 | - public const CALENDAR_TYPE_SUBSCRIPTION = 1; |
|
| 101 | - |
|
| 102 | - public const PERSONAL_CALENDAR_URI = 'personal'; |
|
| 103 | - public const PERSONAL_CALENDAR_NAME = 'Personal'; |
|
| 104 | - |
|
| 105 | - public const RESOURCE_BOOKING_CALENDAR_URI = 'calendar'; |
|
| 106 | - public const RESOURCE_BOOKING_CALENDAR_NAME = 'Calendar'; |
|
| 107 | - |
|
| 108 | - /** |
|
| 109 | - * We need to specify a max date, because we need to stop *somewhere* |
|
| 110 | - * |
|
| 111 | - * On 32 bit system the maximum for a signed integer is 2147483647, so |
|
| 112 | - * MAX_DATE cannot be higher than date('Y-m-d', 2147483647) which results |
|
| 113 | - * in 2038-01-19 to avoid problems when the date is converted |
|
| 114 | - * to a unix timestamp. |
|
| 115 | - */ |
|
| 116 | - public const MAX_DATE = '2038-01-01'; |
|
| 117 | - |
|
| 118 | - public const ACCESS_PUBLIC = 4; |
|
| 119 | - public const CLASSIFICATION_PUBLIC = 0; |
|
| 120 | - public const CLASSIFICATION_PRIVATE = 1; |
|
| 121 | - public const CLASSIFICATION_CONFIDENTIAL = 2; |
|
| 122 | - |
|
| 123 | - /** |
|
| 124 | - * List of CalDAV properties, and how they map to database field names |
|
| 125 | - * Add your own properties by simply adding on to this array. |
|
| 126 | - * |
|
| 127 | - * Note that only string-based properties are supported here. |
|
| 128 | - * |
|
| 129 | - * @var array |
|
| 130 | - */ |
|
| 131 | - public $propertyMap = [ |
|
| 132 | - '{DAV:}displayname' => 'displayname', |
|
| 133 | - '{urn:ietf:params:xml:ns:caldav}calendar-description' => 'description', |
|
| 134 | - '{urn:ietf:params:xml:ns:caldav}calendar-timezone' => 'timezone', |
|
| 135 | - '{http://apple.com/ns/ical/}calendar-order' => 'calendarorder', |
|
| 136 | - '{http://apple.com/ns/ical/}calendar-color' => 'calendarcolor', |
|
| 137 | - ]; |
|
| 138 | - |
|
| 139 | - /** |
|
| 140 | - * List of subscription properties, and how they map to database field names. |
|
| 141 | - * |
|
| 142 | - * @var array |
|
| 143 | - */ |
|
| 144 | - public $subscriptionPropertyMap = [ |
|
| 145 | - '{DAV:}displayname' => 'displayname', |
|
| 146 | - '{http://apple.com/ns/ical/}refreshrate' => 'refreshrate', |
|
| 147 | - '{http://apple.com/ns/ical/}calendar-order' => 'calendarorder', |
|
| 148 | - '{http://apple.com/ns/ical/}calendar-color' => 'calendarcolor', |
|
| 149 | - '{http://calendarserver.org/ns/}subscribed-strip-todos' => 'striptodos', |
|
| 150 | - '{http://calendarserver.org/ns/}subscribed-strip-alarms' => 'stripalarms', |
|
| 151 | - '{http://calendarserver.org/ns/}subscribed-strip-attachments' => 'stripattachments', |
|
| 152 | - ]; |
|
| 153 | - |
|
| 154 | - /** @var array properties to index */ |
|
| 155 | - public static $indexProperties = ['CATEGORIES', 'COMMENT', 'DESCRIPTION', |
|
| 156 | - 'LOCATION', 'RESOURCES', 'STATUS', 'SUMMARY', 'ATTENDEE', 'CONTACT', |
|
| 157 | - 'ORGANIZER']; |
|
| 158 | - |
|
| 159 | - /** @var array parameters to index */ |
|
| 160 | - public static $indexParameters = [ |
|
| 161 | - 'ATTENDEE' => ['CN'], |
|
| 162 | - 'ORGANIZER' => ['CN'], |
|
| 163 | - ]; |
|
| 164 | - |
|
| 165 | - /** |
|
| 166 | - * @var string[] Map of uid => display name |
|
| 167 | - */ |
|
| 168 | - protected $userDisplayNames; |
|
| 169 | - |
|
| 170 | - /** @var IDBConnection */ |
|
| 171 | - private $db; |
|
| 172 | - |
|
| 173 | - /** @var Backend */ |
|
| 174 | - private $calendarSharingBackend; |
|
| 175 | - |
|
| 176 | - /** @var Principal */ |
|
| 177 | - private $principalBackend; |
|
| 178 | - |
|
| 179 | - /** @var IUserManager */ |
|
| 180 | - private $userManager; |
|
| 181 | - |
|
| 182 | - /** @var ISecureRandom */ |
|
| 183 | - private $random; |
|
| 184 | - |
|
| 185 | - /** @var ILogger */ |
|
| 186 | - private $logger; |
|
| 187 | - |
|
| 188 | - /** @var IEventDispatcher */ |
|
| 189 | - private $dispatcher; |
|
| 190 | - |
|
| 191 | - /** @var EventDispatcherInterface */ |
|
| 192 | - private $legacyDispatcher; |
|
| 193 | - |
|
| 194 | - /** @var bool */ |
|
| 195 | - private $legacyEndpoint; |
|
| 196 | - |
|
| 197 | - /** @var string */ |
|
| 198 | - private $dbObjectPropertiesTable = 'calendarobjects_props'; |
|
| 199 | - |
|
| 200 | - /** |
|
| 201 | - * CalDavBackend constructor. |
|
| 202 | - * |
|
| 203 | - * @param IDBConnection $db |
|
| 204 | - * @param Principal $principalBackend |
|
| 205 | - * @param IUserManager $userManager |
|
| 206 | - * @param IGroupManager $groupManager |
|
| 207 | - * @param ISecureRandom $random |
|
| 208 | - * @param ILogger $logger |
|
| 209 | - * @param IEventDispatcher $dispatcher |
|
| 210 | - * @param EventDispatcherInterface $legacyDispatcher |
|
| 211 | - * @param bool $legacyEndpoint |
|
| 212 | - */ |
|
| 213 | - public function __construct(IDBConnection $db, |
|
| 214 | - Principal $principalBackend, |
|
| 215 | - IUserManager $userManager, |
|
| 216 | - IGroupManager $groupManager, |
|
| 217 | - ISecureRandom $random, |
|
| 218 | - ILogger $logger, |
|
| 219 | - IEventDispatcher $dispatcher, |
|
| 220 | - EventDispatcherInterface $legacyDispatcher, |
|
| 221 | - bool $legacyEndpoint = false) { |
|
| 222 | - $this->db = $db; |
|
| 223 | - $this->principalBackend = $principalBackend; |
|
| 224 | - $this->userManager = $userManager; |
|
| 225 | - $this->calendarSharingBackend = new Backend($this->db, $this->userManager, $groupManager, $principalBackend, 'calendar'); |
|
| 226 | - $this->random = $random; |
|
| 227 | - $this->logger = $logger; |
|
| 228 | - $this->dispatcher = $dispatcher; |
|
| 229 | - $this->legacyDispatcher = $legacyDispatcher; |
|
| 230 | - $this->legacyEndpoint = $legacyEndpoint; |
|
| 231 | - } |
|
| 232 | - |
|
| 233 | - /** |
|
| 234 | - * Return the number of calendars for a principal |
|
| 235 | - * |
|
| 236 | - * By default this excludes the automatically generated birthday calendar |
|
| 237 | - * |
|
| 238 | - * @param $principalUri |
|
| 239 | - * @param bool $excludeBirthday |
|
| 240 | - * @return int |
|
| 241 | - */ |
|
| 242 | - public function getCalendarsForUserCount($principalUri, $excludeBirthday = true) { |
|
| 243 | - $principalUri = $this->convertPrincipal($principalUri, true); |
|
| 244 | - $query = $this->db->getQueryBuilder(); |
|
| 245 | - $query->select($query->func()->count('*')) |
|
| 246 | - ->from('calendars'); |
|
| 247 | - |
|
| 248 | - if ($principalUri === '') { |
|
| 249 | - $query->where($query->expr()->emptyString('principaluri')); |
|
| 250 | - } else { |
|
| 251 | - $query->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))); |
|
| 252 | - } |
|
| 253 | - |
|
| 254 | - if ($excludeBirthday) { |
|
| 255 | - $query->andWhere($query->expr()->neq('uri', $query->createNamedParameter(BirthdayService::BIRTHDAY_CALENDAR_URI))); |
|
| 256 | - } |
|
| 257 | - |
|
| 258 | - $result = $query->executeQuery(); |
|
| 259 | - $column = (int)$result->fetchOne(); |
|
| 260 | - $result->closeCursor(); |
|
| 261 | - return $column; |
|
| 262 | - } |
|
| 263 | - |
|
| 264 | - /** |
|
| 265 | - * Returns a list of calendars for a principal. |
|
| 266 | - * |
|
| 267 | - * Every project is an array with the following keys: |
|
| 268 | - * * id, a unique id that will be used by other functions to modify the |
|
| 269 | - * calendar. This can be the same as the uri or a database key. |
|
| 270 | - * * uri, which the basename of the uri with which the calendar is |
|
| 271 | - * accessed. |
|
| 272 | - * * principaluri. The owner of the calendar. Almost always the same as |
|
| 273 | - * principalUri passed to this method. |
|
| 274 | - * |
|
| 275 | - * Furthermore it can contain webdav properties in clark notation. A very |
|
| 276 | - * common one is '{DAV:}displayname'. |
|
| 277 | - * |
|
| 278 | - * Many clients also require: |
|
| 279 | - * {urn:ietf:params:xml:ns:caldav}supported-calendar-component-set |
|
| 280 | - * For this property, you can just return an instance of |
|
| 281 | - * Sabre\CalDAV\Property\SupportedCalendarComponentSet. |
|
| 282 | - * |
|
| 283 | - * If you return {http://sabredav.org/ns}read-only and set the value to 1, |
|
| 284 | - * ACL will automatically be put in read-only mode. |
|
| 285 | - * |
|
| 286 | - * @param string $principalUri |
|
| 287 | - * @return array |
|
| 288 | - */ |
|
| 289 | - public function getCalendarsForUser($principalUri) { |
|
| 290 | - $principalUriOriginal = $principalUri; |
|
| 291 | - $principalUri = $this->convertPrincipal($principalUri, true); |
|
| 292 | - $fields = array_values($this->propertyMap); |
|
| 293 | - $fields[] = 'id'; |
|
| 294 | - $fields[] = 'uri'; |
|
| 295 | - $fields[] = 'synctoken'; |
|
| 296 | - $fields[] = 'components'; |
|
| 297 | - $fields[] = 'principaluri'; |
|
| 298 | - $fields[] = 'transparent'; |
|
| 299 | - |
|
| 300 | - // Making fields a comma-delimited list |
|
| 301 | - $query = $this->db->getQueryBuilder(); |
|
| 302 | - $query->select($fields) |
|
| 303 | - ->from('calendars') |
|
| 304 | - ->orderBy('calendarorder', 'ASC'); |
|
| 305 | - |
|
| 306 | - if ($principalUri === '') { |
|
| 307 | - $query->where($query->expr()->emptyString('principaluri')); |
|
| 308 | - } else { |
|
| 309 | - $query->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))); |
|
| 310 | - } |
|
| 311 | - |
|
| 312 | - $result = $query->executeQuery(); |
|
| 313 | - |
|
| 314 | - $calendars = []; |
|
| 315 | - while ($row = $result->fetch()) { |
|
| 316 | - $row['principaluri'] = (string) $row['principaluri']; |
|
| 317 | - $components = []; |
|
| 318 | - if ($row['components']) { |
|
| 319 | - $components = explode(',',$row['components']); |
|
| 320 | - } |
|
| 321 | - |
|
| 322 | - $calendar = [ |
|
| 323 | - 'id' => $row['id'], |
|
| 324 | - 'uri' => $row['uri'], |
|
| 325 | - 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 326 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 327 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 328 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 329 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 330 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint), |
|
| 331 | - ]; |
|
| 332 | - |
|
| 333 | - foreach ($this->propertyMap as $xmlName => $dbName) { |
|
| 334 | - $calendar[$xmlName] = $row[$dbName]; |
|
| 335 | - } |
|
| 336 | - |
|
| 337 | - $this->addOwnerPrincipal($calendar); |
|
| 338 | - |
|
| 339 | - if (!isset($calendars[$calendar['id']])) { |
|
| 340 | - $calendars[$calendar['id']] = $calendar; |
|
| 341 | - } |
|
| 342 | - } |
|
| 343 | - $result->closeCursor(); |
|
| 344 | - |
|
| 345 | - // query for shared calendars |
|
| 346 | - $principals = $this->principalBackend->getGroupMembership($principalUriOriginal, true); |
|
| 347 | - $principals = array_merge($principals, $this->principalBackend->getCircleMembership($principalUriOriginal)); |
|
| 348 | - |
|
| 349 | - $principals[] = $principalUri; |
|
| 350 | - |
|
| 351 | - $fields = array_values($this->propertyMap); |
|
| 352 | - $fields[] = 'a.id'; |
|
| 353 | - $fields[] = 'a.uri'; |
|
| 354 | - $fields[] = 'a.synctoken'; |
|
| 355 | - $fields[] = 'a.components'; |
|
| 356 | - $fields[] = 'a.principaluri'; |
|
| 357 | - $fields[] = 'a.transparent'; |
|
| 358 | - $fields[] = 's.access'; |
|
| 359 | - $query = $this->db->getQueryBuilder(); |
|
| 360 | - $query->select($fields) |
|
| 361 | - ->from('dav_shares', 's') |
|
| 362 | - ->join('s', 'calendars', 'a', $query->expr()->eq('s.resourceid', 'a.id')) |
|
| 363 | - ->where($query->expr()->in('s.principaluri', $query->createParameter('principaluri'))) |
|
| 364 | - ->andWhere($query->expr()->eq('s.type', $query->createParameter('type'))) |
|
| 365 | - ->setParameter('type', 'calendar') |
|
| 366 | - ->setParameter('principaluri', $principals, \Doctrine\DBAL\Connection::PARAM_STR_ARRAY); |
|
| 367 | - |
|
| 368 | - $result = $query->executeQuery(); |
|
| 369 | - |
|
| 370 | - $readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only'; |
|
| 371 | - while ($row = $result->fetch()) { |
|
| 372 | - $row['principaluri'] = (string) $row['principaluri']; |
|
| 373 | - if ($row['principaluri'] === $principalUri) { |
|
| 374 | - continue; |
|
| 375 | - } |
|
| 376 | - |
|
| 377 | - $readOnly = (int) $row['access'] === Backend::ACCESS_READ; |
|
| 378 | - if (isset($calendars[$row['id']])) { |
|
| 379 | - if ($readOnly) { |
|
| 380 | - // New share can not have more permissions then the old one. |
|
| 381 | - continue; |
|
| 382 | - } |
|
| 383 | - if (isset($calendars[$row['id']][$readOnlyPropertyName]) && |
|
| 384 | - $calendars[$row['id']][$readOnlyPropertyName] === 0) { |
|
| 385 | - // Old share is already read-write, no more permissions can be gained |
|
| 386 | - continue; |
|
| 387 | - } |
|
| 388 | - } |
|
| 389 | - |
|
| 390 | - [, $name] = Uri\split($row['principaluri']); |
|
| 391 | - $uri = $row['uri'] . '_shared_by_' . $name; |
|
| 392 | - $row['displayname'] = $row['displayname'] . ' (' . $this->getUserDisplayName($name) . ')'; |
|
| 393 | - $components = []; |
|
| 394 | - if ($row['components']) { |
|
| 395 | - $components = explode(',',$row['components']); |
|
| 396 | - } |
|
| 397 | - $calendar = [ |
|
| 398 | - 'id' => $row['id'], |
|
| 399 | - 'uri' => $uri, |
|
| 400 | - 'principaluri' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint), |
|
| 401 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 402 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 403 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 404 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp('transparent'), |
|
| 405 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 406 | - $readOnlyPropertyName => $readOnly, |
|
| 407 | - ]; |
|
| 408 | - |
|
| 409 | - foreach ($this->propertyMap as $xmlName => $dbName) { |
|
| 410 | - $calendar[$xmlName] = $row[$dbName]; |
|
| 411 | - } |
|
| 412 | - |
|
| 413 | - $this->addOwnerPrincipal($calendar); |
|
| 414 | - |
|
| 415 | - $calendars[$calendar['id']] = $calendar; |
|
| 416 | - } |
|
| 417 | - $result->closeCursor(); |
|
| 418 | - |
|
| 419 | - return array_values($calendars); |
|
| 420 | - } |
|
| 421 | - |
|
| 422 | - /** |
|
| 423 | - * @param $principalUri |
|
| 424 | - * @return array |
|
| 425 | - */ |
|
| 426 | - public function getUsersOwnCalendars($principalUri) { |
|
| 427 | - $principalUri = $this->convertPrincipal($principalUri, true); |
|
| 428 | - $fields = array_values($this->propertyMap); |
|
| 429 | - $fields[] = 'id'; |
|
| 430 | - $fields[] = 'uri'; |
|
| 431 | - $fields[] = 'synctoken'; |
|
| 432 | - $fields[] = 'components'; |
|
| 433 | - $fields[] = 'principaluri'; |
|
| 434 | - $fields[] = 'transparent'; |
|
| 435 | - // Making fields a comma-delimited list |
|
| 436 | - $query = $this->db->getQueryBuilder(); |
|
| 437 | - $query->select($fields)->from('calendars') |
|
| 438 | - ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))) |
|
| 439 | - ->orderBy('calendarorder', 'ASC'); |
|
| 440 | - $stmt = $query->executeQuery(); |
|
| 441 | - $calendars = []; |
|
| 442 | - while ($row = $stmt->fetch()) { |
|
| 443 | - $row['principaluri'] = (string) $row['principaluri']; |
|
| 444 | - $components = []; |
|
| 445 | - if ($row['components']) { |
|
| 446 | - $components = explode(',',$row['components']); |
|
| 447 | - } |
|
| 448 | - $calendar = [ |
|
| 449 | - 'id' => $row['id'], |
|
| 450 | - 'uri' => $row['uri'], |
|
| 451 | - 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 452 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 453 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 454 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 455 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 456 | - ]; |
|
| 457 | - foreach ($this->propertyMap as $xmlName => $dbName) { |
|
| 458 | - $calendar[$xmlName] = $row[$dbName]; |
|
| 459 | - } |
|
| 460 | - |
|
| 461 | - $this->addOwnerPrincipal($calendar); |
|
| 462 | - |
|
| 463 | - if (!isset($calendars[$calendar['id']])) { |
|
| 464 | - $calendars[$calendar['id']] = $calendar; |
|
| 465 | - } |
|
| 466 | - } |
|
| 467 | - $stmt->closeCursor(); |
|
| 468 | - return array_values($calendars); |
|
| 469 | - } |
|
| 470 | - |
|
| 471 | - |
|
| 472 | - /** |
|
| 473 | - * @param $uid |
|
| 474 | - * @return string |
|
| 475 | - */ |
|
| 476 | - private function getUserDisplayName($uid) { |
|
| 477 | - if (!isset($this->userDisplayNames[$uid])) { |
|
| 478 | - $user = $this->userManager->get($uid); |
|
| 479 | - |
|
| 480 | - if ($user instanceof IUser) { |
|
| 481 | - $this->userDisplayNames[$uid] = $user->getDisplayName(); |
|
| 482 | - } else { |
|
| 483 | - $this->userDisplayNames[$uid] = $uid; |
|
| 484 | - } |
|
| 485 | - } |
|
| 486 | - |
|
| 487 | - return $this->userDisplayNames[$uid]; |
|
| 488 | - } |
|
| 489 | - |
|
| 490 | - /** |
|
| 491 | - * @return array |
|
| 492 | - */ |
|
| 493 | - public function getPublicCalendars() { |
|
| 494 | - $fields = array_values($this->propertyMap); |
|
| 495 | - $fields[] = 'a.id'; |
|
| 496 | - $fields[] = 'a.uri'; |
|
| 497 | - $fields[] = 'a.synctoken'; |
|
| 498 | - $fields[] = 'a.components'; |
|
| 499 | - $fields[] = 'a.principaluri'; |
|
| 500 | - $fields[] = 'a.transparent'; |
|
| 501 | - $fields[] = 's.access'; |
|
| 502 | - $fields[] = 's.publicuri'; |
|
| 503 | - $calendars = []; |
|
| 504 | - $query = $this->db->getQueryBuilder(); |
|
| 505 | - $result = $query->select($fields) |
|
| 506 | - ->from('dav_shares', 's') |
|
| 507 | - ->join('s', 'calendars', 'a', $query->expr()->eq('s.resourceid', 'a.id')) |
|
| 508 | - ->where($query->expr()->in('s.access', $query->createNamedParameter(self::ACCESS_PUBLIC))) |
|
| 509 | - ->andWhere($query->expr()->eq('s.type', $query->createNamedParameter('calendar'))) |
|
| 510 | - ->executeQuery(); |
|
| 511 | - |
|
| 512 | - while ($row = $result->fetch()) { |
|
| 513 | - $row['principaluri'] = (string) $row['principaluri']; |
|
| 514 | - [, $name] = Uri\split($row['principaluri']); |
|
| 515 | - $row['displayname'] = $row['displayname'] . "($name)"; |
|
| 516 | - $components = []; |
|
| 517 | - if ($row['components']) { |
|
| 518 | - $components = explode(',',$row['components']); |
|
| 519 | - } |
|
| 520 | - $calendar = [ |
|
| 521 | - 'id' => $row['id'], |
|
| 522 | - 'uri' => $row['publicuri'], |
|
| 523 | - 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 524 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 525 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 526 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 527 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 528 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], $this->legacyEndpoint), |
|
| 529 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ, |
|
| 530 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC, |
|
| 531 | - ]; |
|
| 532 | - |
|
| 533 | - foreach ($this->propertyMap as $xmlName => $dbName) { |
|
| 534 | - $calendar[$xmlName] = $row[$dbName]; |
|
| 535 | - } |
|
| 536 | - |
|
| 537 | - $this->addOwnerPrincipal($calendar); |
|
| 538 | - |
|
| 539 | - if (!isset($calendars[$calendar['id']])) { |
|
| 540 | - $calendars[$calendar['id']] = $calendar; |
|
| 541 | - } |
|
| 542 | - } |
|
| 543 | - $result->closeCursor(); |
|
| 544 | - |
|
| 545 | - return array_values($calendars); |
|
| 546 | - } |
|
| 547 | - |
|
| 548 | - /** |
|
| 549 | - * @param string $uri |
|
| 550 | - * @return array |
|
| 551 | - * @throws NotFound |
|
| 552 | - */ |
|
| 553 | - public function getPublicCalendar($uri) { |
|
| 554 | - $fields = array_values($this->propertyMap); |
|
| 555 | - $fields[] = 'a.id'; |
|
| 556 | - $fields[] = 'a.uri'; |
|
| 557 | - $fields[] = 'a.synctoken'; |
|
| 558 | - $fields[] = 'a.components'; |
|
| 559 | - $fields[] = 'a.principaluri'; |
|
| 560 | - $fields[] = 'a.transparent'; |
|
| 561 | - $fields[] = 's.access'; |
|
| 562 | - $fields[] = 's.publicuri'; |
|
| 563 | - $query = $this->db->getQueryBuilder(); |
|
| 564 | - $result = $query->select($fields) |
|
| 565 | - ->from('dav_shares', 's') |
|
| 566 | - ->join('s', 'calendars', 'a', $query->expr()->eq('s.resourceid', 'a.id')) |
|
| 567 | - ->where($query->expr()->in('s.access', $query->createNamedParameter(self::ACCESS_PUBLIC))) |
|
| 568 | - ->andWhere($query->expr()->eq('s.type', $query->createNamedParameter('calendar'))) |
|
| 569 | - ->andWhere($query->expr()->eq('s.publicuri', $query->createNamedParameter($uri))) |
|
| 570 | - ->executeQuery(); |
|
| 571 | - |
|
| 572 | - $row = $result->fetch(); |
|
| 573 | - |
|
| 574 | - $result->closeCursor(); |
|
| 575 | - |
|
| 576 | - if ($row === false) { |
|
| 577 | - throw new NotFound('Node with name \'' . $uri . '\' could not be found'); |
|
| 578 | - } |
|
| 579 | - |
|
| 580 | - $row['principaluri'] = (string) $row['principaluri']; |
|
| 581 | - [, $name] = Uri\split($row['principaluri']); |
|
| 582 | - $row['displayname'] = $row['displayname'] . ' ' . "($name)"; |
|
| 583 | - $components = []; |
|
| 584 | - if ($row['components']) { |
|
| 585 | - $components = explode(',',$row['components']); |
|
| 586 | - } |
|
| 587 | - $calendar = [ |
|
| 588 | - 'id' => $row['id'], |
|
| 589 | - 'uri' => $row['publicuri'], |
|
| 590 | - 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 591 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 592 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 593 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 594 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 595 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 596 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ, |
|
| 597 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC, |
|
| 598 | - ]; |
|
| 599 | - |
|
| 600 | - foreach ($this->propertyMap as $xmlName => $dbName) { |
|
| 601 | - $calendar[$xmlName] = $row[$dbName]; |
|
| 602 | - } |
|
| 603 | - |
|
| 604 | - $this->addOwnerPrincipal($calendar); |
|
| 605 | - |
|
| 606 | - return $calendar; |
|
| 607 | - } |
|
| 608 | - |
|
| 609 | - /** |
|
| 610 | - * @param string $principal |
|
| 611 | - * @param string $uri |
|
| 612 | - * @return array|null |
|
| 613 | - */ |
|
| 614 | - public function getCalendarByUri($principal, $uri) { |
|
| 615 | - $fields = array_values($this->propertyMap); |
|
| 616 | - $fields[] = 'id'; |
|
| 617 | - $fields[] = 'uri'; |
|
| 618 | - $fields[] = 'synctoken'; |
|
| 619 | - $fields[] = 'components'; |
|
| 620 | - $fields[] = 'principaluri'; |
|
| 621 | - $fields[] = 'transparent'; |
|
| 622 | - |
|
| 623 | - // Making fields a comma-delimited list |
|
| 624 | - $query = $this->db->getQueryBuilder(); |
|
| 625 | - $query->select($fields)->from('calendars') |
|
| 626 | - ->where($query->expr()->eq('uri', $query->createNamedParameter($uri))) |
|
| 627 | - ->andWhere($query->expr()->eq('principaluri', $query->createNamedParameter($principal))) |
|
| 628 | - ->setMaxResults(1); |
|
| 629 | - $stmt = $query->executeQuery(); |
|
| 630 | - |
|
| 631 | - $row = $stmt->fetch(); |
|
| 632 | - $stmt->closeCursor(); |
|
| 633 | - if ($row === false) { |
|
| 634 | - return null; |
|
| 635 | - } |
|
| 636 | - |
|
| 637 | - $row['principaluri'] = (string) $row['principaluri']; |
|
| 638 | - $components = []; |
|
| 639 | - if ($row['components']) { |
|
| 640 | - $components = explode(',',$row['components']); |
|
| 641 | - } |
|
| 642 | - |
|
| 643 | - $calendar = [ |
|
| 644 | - 'id' => $row['id'], |
|
| 645 | - 'uri' => $row['uri'], |
|
| 646 | - 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 647 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 648 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 649 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 650 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 651 | - ]; |
|
| 652 | - |
|
| 653 | - foreach ($this->propertyMap as $xmlName => $dbName) { |
|
| 654 | - $calendar[$xmlName] = $row[$dbName]; |
|
| 655 | - } |
|
| 656 | - |
|
| 657 | - $this->addOwnerPrincipal($calendar); |
|
| 658 | - |
|
| 659 | - return $calendar; |
|
| 660 | - } |
|
| 661 | - |
|
| 662 | - /** |
|
| 663 | - * @param $calendarId |
|
| 664 | - * @return array|null |
|
| 665 | - */ |
|
| 666 | - public function getCalendarById($calendarId) { |
|
| 667 | - $fields = array_values($this->propertyMap); |
|
| 668 | - $fields[] = 'id'; |
|
| 669 | - $fields[] = 'uri'; |
|
| 670 | - $fields[] = 'synctoken'; |
|
| 671 | - $fields[] = 'components'; |
|
| 672 | - $fields[] = 'principaluri'; |
|
| 673 | - $fields[] = 'transparent'; |
|
| 674 | - |
|
| 675 | - // Making fields a comma-delimited list |
|
| 676 | - $query = $this->db->getQueryBuilder(); |
|
| 677 | - $query->select($fields)->from('calendars') |
|
| 678 | - ->where($query->expr()->eq('id', $query->createNamedParameter($calendarId))) |
|
| 679 | - ->setMaxResults(1); |
|
| 680 | - $stmt = $query->executeQuery(); |
|
| 681 | - |
|
| 682 | - $row = $stmt->fetch(); |
|
| 683 | - $stmt->closeCursor(); |
|
| 684 | - if ($row === false) { |
|
| 685 | - return null; |
|
| 686 | - } |
|
| 687 | - |
|
| 688 | - $row['principaluri'] = (string) $row['principaluri']; |
|
| 689 | - $components = []; |
|
| 690 | - if ($row['components']) { |
|
| 691 | - $components = explode(',',$row['components']); |
|
| 692 | - } |
|
| 693 | - |
|
| 694 | - $calendar = [ |
|
| 695 | - 'id' => $row['id'], |
|
| 696 | - 'uri' => $row['uri'], |
|
| 697 | - 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 698 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 699 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 700 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 701 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 702 | - ]; |
|
| 703 | - |
|
| 704 | - foreach ($this->propertyMap as $xmlName => $dbName) { |
|
| 705 | - $calendar[$xmlName] = $row[$dbName]; |
|
| 706 | - } |
|
| 707 | - |
|
| 708 | - $this->addOwnerPrincipal($calendar); |
|
| 709 | - |
|
| 710 | - return $calendar; |
|
| 711 | - } |
|
| 712 | - |
|
| 713 | - /** |
|
| 714 | - * @param $subscriptionId |
|
| 715 | - */ |
|
| 716 | - public function getSubscriptionById($subscriptionId) { |
|
| 717 | - $fields = array_values($this->subscriptionPropertyMap); |
|
| 718 | - $fields[] = 'id'; |
|
| 719 | - $fields[] = 'uri'; |
|
| 720 | - $fields[] = 'source'; |
|
| 721 | - $fields[] = 'synctoken'; |
|
| 722 | - $fields[] = 'principaluri'; |
|
| 723 | - $fields[] = 'lastmodified'; |
|
| 724 | - |
|
| 725 | - $query = $this->db->getQueryBuilder(); |
|
| 726 | - $query->select($fields) |
|
| 727 | - ->from('calendarsubscriptions') |
|
| 728 | - ->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId))) |
|
| 729 | - ->orderBy('calendarorder', 'asc'); |
|
| 730 | - $stmt = $query->executeQuery(); |
|
| 731 | - |
|
| 732 | - $row = $stmt->fetch(); |
|
| 733 | - $stmt->closeCursor(); |
|
| 734 | - if ($row === false) { |
|
| 735 | - return null; |
|
| 736 | - } |
|
| 737 | - |
|
| 738 | - $row['principaluri'] = (string) $row['principaluri']; |
|
| 739 | - $subscription = [ |
|
| 740 | - 'id' => $row['id'], |
|
| 741 | - 'uri' => $row['uri'], |
|
| 742 | - 'principaluri' => $row['principaluri'], |
|
| 743 | - 'source' => $row['source'], |
|
| 744 | - 'lastmodified' => $row['lastmodified'], |
|
| 745 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
| 746 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 747 | - ]; |
|
| 748 | - |
|
| 749 | - foreach ($this->subscriptionPropertyMap as $xmlName => $dbName) { |
|
| 750 | - if (!is_null($row[$dbName])) { |
|
| 751 | - $subscription[$xmlName] = $row[$dbName]; |
|
| 752 | - } |
|
| 753 | - } |
|
| 754 | - |
|
| 755 | - return $subscription; |
|
| 756 | - } |
|
| 757 | - |
|
| 758 | - /** |
|
| 759 | - * Creates a new calendar for a principal. |
|
| 760 | - * |
|
| 761 | - * If the creation was a success, an id must be returned that can be used to reference |
|
| 762 | - * this calendar in other methods, such as updateCalendar. |
|
| 763 | - * |
|
| 764 | - * @param string $principalUri |
|
| 765 | - * @param string $calendarUri |
|
| 766 | - * @param array $properties |
|
| 767 | - * @return int |
|
| 768 | - */ |
|
| 769 | - public function createCalendar($principalUri, $calendarUri, array $properties) { |
|
| 770 | - $values = [ |
|
| 771 | - 'principaluri' => $this->convertPrincipal($principalUri, true), |
|
| 772 | - 'uri' => $calendarUri, |
|
| 773 | - 'synctoken' => 1, |
|
| 774 | - 'transparent' => 0, |
|
| 775 | - 'components' => 'VEVENT,VTODO', |
|
| 776 | - 'displayname' => $calendarUri |
|
| 777 | - ]; |
|
| 778 | - |
|
| 779 | - // Default value |
|
| 780 | - $sccs = '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set'; |
|
| 781 | - if (isset($properties[$sccs])) { |
|
| 782 | - if (!($properties[$sccs] instanceof SupportedCalendarComponentSet)) { |
|
| 783 | - throw new DAV\Exception('The ' . $sccs . ' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet'); |
|
| 784 | - } |
|
| 785 | - $values['components'] = implode(',',$properties[$sccs]->getValue()); |
|
| 786 | - } elseif (isset($properties['components'])) { |
|
| 787 | - // Allow to provide components internally without having |
|
| 788 | - // to create a SupportedCalendarComponentSet object |
|
| 789 | - $values['components'] = $properties['components']; |
|
| 790 | - } |
|
| 791 | - |
|
| 792 | - $transp = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp'; |
|
| 793 | - if (isset($properties[$transp])) { |
|
| 794 | - $values['transparent'] = (int) ($properties[$transp]->getValue() === 'transparent'); |
|
| 795 | - } |
|
| 796 | - |
|
| 797 | - foreach ($this->propertyMap as $xmlName => $dbName) { |
|
| 798 | - if (isset($properties[$xmlName])) { |
|
| 799 | - $values[$dbName] = $properties[$xmlName]; |
|
| 800 | - } |
|
| 801 | - } |
|
| 802 | - |
|
| 803 | - $query = $this->db->getQueryBuilder(); |
|
| 804 | - $query->insert('calendars'); |
|
| 805 | - foreach ($values as $column => $value) { |
|
| 806 | - $query->setValue($column, $query->createNamedParameter($value)); |
|
| 807 | - } |
|
| 808 | - $query->executeStatement(); |
|
| 809 | - $calendarId = $query->getLastInsertId(); |
|
| 810 | - |
|
| 811 | - $calendarData = $this->getCalendarById($calendarId); |
|
| 812 | - $this->dispatcher->dispatchTyped(new CalendarCreatedEvent((int)$calendarId, $calendarData)); |
|
| 813 | - $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::createCalendar', new GenericEvent( |
|
| 814 | - '\OCA\DAV\CalDAV\CalDavBackend::createCalendar', |
|
| 815 | - [ |
|
| 816 | - 'calendarId' => $calendarId, |
|
| 817 | - 'calendarData' => $calendarData, |
|
| 818 | - ])); |
|
| 819 | - |
|
| 820 | - return $calendarId; |
|
| 821 | - } |
|
| 822 | - |
|
| 823 | - /** |
|
| 824 | - * Updates properties for a calendar. |
|
| 825 | - * |
|
| 826 | - * The list of mutations is stored in a Sabre\DAV\PropPatch object. |
|
| 827 | - * To do the actual updates, you must tell this object which properties |
|
| 828 | - * you're going to process with the handle() method. |
|
| 829 | - * |
|
| 830 | - * Calling the handle method is like telling the PropPatch object "I |
|
| 831 | - * promise I can handle updating this property". |
|
| 832 | - * |
|
| 833 | - * Read the PropPatch documentation for more info and examples. |
|
| 834 | - * |
|
| 835 | - * @param mixed $calendarId |
|
| 836 | - * @param PropPatch $propPatch |
|
| 837 | - * @return void |
|
| 838 | - */ |
|
| 839 | - public function updateCalendar($calendarId, PropPatch $propPatch) { |
|
| 840 | - $supportedProperties = array_keys($this->propertyMap); |
|
| 841 | - $supportedProperties[] = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp'; |
|
| 842 | - |
|
| 843 | - $propPatch->handle($supportedProperties, function ($mutations) use ($calendarId) { |
|
| 844 | - $newValues = []; |
|
| 845 | - foreach ($mutations as $propertyName => $propertyValue) { |
|
| 846 | - switch ($propertyName) { |
|
| 847 | - case '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp': |
|
| 848 | - $fieldName = 'transparent'; |
|
| 849 | - $newValues[$fieldName] = (int) ($propertyValue->getValue() === 'transparent'); |
|
| 850 | - break; |
|
| 851 | - default: |
|
| 852 | - $fieldName = $this->propertyMap[$propertyName]; |
|
| 853 | - $newValues[$fieldName] = $propertyValue; |
|
| 854 | - break; |
|
| 855 | - } |
|
| 856 | - } |
|
| 857 | - $query = $this->db->getQueryBuilder(); |
|
| 858 | - $query->update('calendars'); |
|
| 859 | - foreach ($newValues as $fieldName => $value) { |
|
| 860 | - $query->set($fieldName, $query->createNamedParameter($value)); |
|
| 861 | - } |
|
| 862 | - $query->where($query->expr()->eq('id', $query->createNamedParameter($calendarId))); |
|
| 863 | - $query->executeStatement(); |
|
| 864 | - |
|
| 865 | - $this->addChange($calendarId, "", 2); |
|
| 866 | - |
|
| 867 | - $calendarData = $this->getCalendarById($calendarId); |
|
| 868 | - $shares = $this->getShares($calendarId); |
|
| 869 | - $this->dispatcher->dispatchTyped(new CalendarUpdatedEvent((int)$calendarId, $calendarData, $shares, $mutations)); |
|
| 870 | - $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateCalendar', new GenericEvent( |
|
| 871 | - '\OCA\DAV\CalDAV\CalDavBackend::updateCalendar', |
|
| 872 | - [ |
|
| 873 | - 'calendarId' => $calendarId, |
|
| 874 | - 'calendarData' => $calendarData, |
|
| 875 | - 'shares' => $shares, |
|
| 876 | - 'propertyMutations' => $mutations, |
|
| 877 | - ])); |
|
| 878 | - |
|
| 879 | - return true; |
|
| 880 | - }); |
|
| 881 | - } |
|
| 882 | - |
|
| 883 | - /** |
|
| 884 | - * Delete a calendar and all it's objects |
|
| 885 | - * |
|
| 886 | - * @param mixed $calendarId |
|
| 887 | - * @return void |
|
| 888 | - */ |
|
| 889 | - public function deleteCalendar($calendarId) { |
|
| 890 | - $calendarData = $this->getCalendarById($calendarId); |
|
| 891 | - $shares = $this->getShares($calendarId); |
|
| 892 | - |
|
| 893 | - $stmt = $this->db->prepare('DELETE FROM `*PREFIX*calendarobjects` WHERE `calendarid` = ? AND `calendartype` = ?'); |
|
| 894 | - $stmt->execute([$calendarId, self::CALENDAR_TYPE_CALENDAR]); |
|
| 895 | - |
|
| 896 | - $stmt = $this->db->prepare('DELETE FROM `*PREFIX*calendars` WHERE `id` = ?'); |
|
| 897 | - $stmt->execute([$calendarId]); |
|
| 898 | - |
|
| 899 | - $stmt = $this->db->prepare('DELETE FROM `*PREFIX*calendarchanges` WHERE `calendarid` = ? AND `calendartype` = ?'); |
|
| 900 | - $stmt->execute([$calendarId, self::CALENDAR_TYPE_CALENDAR]); |
|
| 901 | - |
|
| 902 | - $this->calendarSharingBackend->deleteAllShares($calendarId); |
|
| 903 | - |
|
| 904 | - $query = $this->db->getQueryBuilder(); |
|
| 905 | - $query->delete($this->dbObjectPropertiesTable) |
|
| 906 | - ->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId))) |
|
| 907 | - ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_CALENDAR))) |
|
| 908 | - ->executeStatement(); |
|
| 909 | - |
|
| 910 | - // Only dispatch if we actually deleted anything |
|
| 911 | - if ($calendarData) { |
|
| 912 | - $this->dispatcher->dispatchTyped(new CalendarDeletedEvent((int)$calendarId, $calendarData, $shares)); |
|
| 913 | - } |
|
| 914 | - } |
|
| 915 | - |
|
| 916 | - /** |
|
| 917 | - * Delete all of an user's shares |
|
| 918 | - * |
|
| 919 | - * @param string $principaluri |
|
| 920 | - * @return void |
|
| 921 | - */ |
|
| 922 | - public function deleteAllSharesByUser($principaluri) { |
|
| 923 | - $this->calendarSharingBackend->deleteAllSharesByUser($principaluri); |
|
| 924 | - } |
|
| 925 | - |
|
| 926 | - /** |
|
| 927 | - * Returns all calendar objects within a calendar. |
|
| 928 | - * |
|
| 929 | - * Every item contains an array with the following keys: |
|
| 930 | - * * calendardata - The iCalendar-compatible calendar data |
|
| 931 | - * * uri - a unique key which will be used to construct the uri. This can |
|
| 932 | - * be any arbitrary string, but making sure it ends with '.ics' is a |
|
| 933 | - * good idea. This is only the basename, or filename, not the full |
|
| 934 | - * path. |
|
| 935 | - * * lastmodified - a timestamp of the last modification time |
|
| 936 | - * * etag - An arbitrary string, surrounded by double-quotes. (e.g.: |
|
| 937 | - * '"abcdef"') |
|
| 938 | - * * size - The size of the calendar objects, in bytes. |
|
| 939 | - * * component - optional, a string containing the type of object, such |
|
| 940 | - * as 'vevent' or 'vtodo'. If specified, this will be used to populate |
|
| 941 | - * the Content-Type header. |
|
| 942 | - * |
|
| 943 | - * Note that the etag is optional, but it's highly encouraged to return for |
|
| 944 | - * speed reasons. |
|
| 945 | - * |
|
| 946 | - * The calendardata is also optional. If it's not returned |
|
| 947 | - * 'getCalendarObject' will be called later, which *is* expected to return |
|
| 948 | - * calendardata. |
|
| 949 | - * |
|
| 950 | - * If neither etag or size are specified, the calendardata will be |
|
| 951 | - * used/fetched to determine these numbers. If both are specified the |
|
| 952 | - * amount of times this is needed is reduced by a great degree. |
|
| 953 | - * |
|
| 954 | - * @param mixed $calendarId |
|
| 955 | - * @param int $calendarType |
|
| 956 | - * @return array |
|
| 957 | - */ |
|
| 958 | - public function getCalendarObjects($calendarId, $calendarType = self::CALENDAR_TYPE_CALENDAR):array { |
|
| 959 | - $query = $this->db->getQueryBuilder(); |
|
| 960 | - $query->select(['id', 'uri', 'lastmodified', 'etag', 'calendarid', 'size', 'componenttype', 'classification']) |
|
| 961 | - ->from('calendarobjects') |
|
| 962 | - ->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId))) |
|
| 963 | - ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType))); |
|
| 964 | - $stmt = $query->executeQuery(); |
|
| 965 | - |
|
| 966 | - $result = []; |
|
| 967 | - foreach ($stmt->fetchAll() as $row) { |
|
| 968 | - $result[] = [ |
|
| 969 | - 'id' => $row['id'], |
|
| 970 | - 'uri' => $row['uri'], |
|
| 971 | - 'lastmodified' => $row['lastmodified'], |
|
| 972 | - 'etag' => '"' . $row['etag'] . '"', |
|
| 973 | - 'calendarid' => $row['calendarid'], |
|
| 974 | - 'size' => (int)$row['size'], |
|
| 975 | - 'component' => strtolower($row['componenttype']), |
|
| 976 | - 'classification' => (int)$row['classification'] |
|
| 977 | - ]; |
|
| 978 | - } |
|
| 979 | - $stmt->closeCursor(); |
|
| 980 | - |
|
| 981 | - return $result; |
|
| 982 | - } |
|
| 983 | - |
|
| 984 | - /** |
|
| 985 | - * Returns information from a single calendar object, based on it's object |
|
| 986 | - * uri. |
|
| 987 | - * |
|
| 988 | - * The object uri is only the basename, or filename and not a full path. |
|
| 989 | - * |
|
| 990 | - * The returned array must have the same keys as getCalendarObjects. The |
|
| 991 | - * 'calendardata' object is required here though, while it's not required |
|
| 992 | - * for getCalendarObjects. |
|
| 993 | - * |
|
| 994 | - * This method must return null if the object did not exist. |
|
| 995 | - * |
|
| 996 | - * @param mixed $calendarId |
|
| 997 | - * @param string $objectUri |
|
| 998 | - * @param int $calendarType |
|
| 999 | - * @return array|null |
|
| 1000 | - */ |
|
| 1001 | - public function getCalendarObject($calendarId, $objectUri, $calendarType = self::CALENDAR_TYPE_CALENDAR) { |
|
| 1002 | - $query = $this->db->getQueryBuilder(); |
|
| 1003 | - $query->select(['id', 'uri', 'lastmodified', 'etag', 'calendarid', 'size', 'calendardata', 'componenttype', 'classification']) |
|
| 1004 | - ->from('calendarobjects') |
|
| 1005 | - ->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId))) |
|
| 1006 | - ->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri))) |
|
| 1007 | - ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType))); |
|
| 1008 | - $stmt = $query->executeQuery(); |
|
| 1009 | - $row = $stmt->fetch(); |
|
| 1010 | - $stmt->closeCursor(); |
|
| 1011 | - |
|
| 1012 | - if (!$row) { |
|
| 1013 | - return null; |
|
| 1014 | - } |
|
| 1015 | - |
|
| 1016 | - return [ |
|
| 1017 | - 'id' => $row['id'], |
|
| 1018 | - 'uri' => $row['uri'], |
|
| 1019 | - 'lastmodified' => $row['lastmodified'], |
|
| 1020 | - 'etag' => '"' . $row['etag'] . '"', |
|
| 1021 | - 'calendarid' => $row['calendarid'], |
|
| 1022 | - 'size' => (int)$row['size'], |
|
| 1023 | - 'calendardata' => $this->readBlob($row['calendardata']), |
|
| 1024 | - 'component' => strtolower($row['componenttype']), |
|
| 1025 | - 'classification' => (int)$row['classification'] |
|
| 1026 | - ]; |
|
| 1027 | - } |
|
| 1028 | - |
|
| 1029 | - /** |
|
| 1030 | - * Returns a list of calendar objects. |
|
| 1031 | - * |
|
| 1032 | - * This method should work identical to getCalendarObject, but instead |
|
| 1033 | - * return all the calendar objects in the list as an array. |
|
| 1034 | - * |
|
| 1035 | - * If the backend supports this, it may allow for some speed-ups. |
|
| 1036 | - * |
|
| 1037 | - * @param mixed $calendarId |
|
| 1038 | - * @param string[] $uris |
|
| 1039 | - * @param int $calendarType |
|
| 1040 | - * @return array |
|
| 1041 | - */ |
|
| 1042 | - public function getMultipleCalendarObjects($calendarId, array $uris, $calendarType = self::CALENDAR_TYPE_CALENDAR):array { |
|
| 1043 | - if (empty($uris)) { |
|
| 1044 | - return []; |
|
| 1045 | - } |
|
| 1046 | - |
|
| 1047 | - $chunks = array_chunk($uris, 100); |
|
| 1048 | - $objects = []; |
|
| 1049 | - |
|
| 1050 | - $query = $this->db->getQueryBuilder(); |
|
| 1051 | - $query->select(['id', 'uri', 'lastmodified', 'etag', 'calendarid', 'size', 'calendardata', 'componenttype', 'classification']) |
|
| 1052 | - ->from('calendarobjects') |
|
| 1053 | - ->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId))) |
|
| 1054 | - ->andWhere($query->expr()->in('uri', $query->createParameter('uri'))) |
|
| 1055 | - ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType))); |
|
| 1056 | - |
|
| 1057 | - foreach ($chunks as $uris) { |
|
| 1058 | - $query->setParameter('uri', $uris, IQueryBuilder::PARAM_STR_ARRAY); |
|
| 1059 | - $result = $query->executeQuery(); |
|
| 1060 | - |
|
| 1061 | - while ($row = $result->fetch()) { |
|
| 1062 | - $objects[] = [ |
|
| 1063 | - 'id' => $row['id'], |
|
| 1064 | - 'uri' => $row['uri'], |
|
| 1065 | - 'lastmodified' => $row['lastmodified'], |
|
| 1066 | - 'etag' => '"' . $row['etag'] . '"', |
|
| 1067 | - 'calendarid' => $row['calendarid'], |
|
| 1068 | - 'size' => (int)$row['size'], |
|
| 1069 | - 'calendardata' => $this->readBlob($row['calendardata']), |
|
| 1070 | - 'component' => strtolower($row['componenttype']), |
|
| 1071 | - 'classification' => (int)$row['classification'] |
|
| 1072 | - ]; |
|
| 1073 | - } |
|
| 1074 | - $result->closeCursor(); |
|
| 1075 | - } |
|
| 1076 | - |
|
| 1077 | - return $objects; |
|
| 1078 | - } |
|
| 1079 | - |
|
| 1080 | - /** |
|
| 1081 | - * Creates a new calendar object. |
|
| 1082 | - * |
|
| 1083 | - * The object uri is only the basename, or filename and not a full path. |
|
| 1084 | - * |
|
| 1085 | - * It is possible return an etag from this function, which will be used in |
|
| 1086 | - * the response to this PUT request. Note that the ETag must be surrounded |
|
| 1087 | - * by double-quotes. |
|
| 1088 | - * |
|
| 1089 | - * However, you should only really return this ETag if you don't mangle the |
|
| 1090 | - * calendar-data. If the result of a subsequent GET to this object is not |
|
| 1091 | - * the exact same as this request body, you should omit the ETag. |
|
| 1092 | - * |
|
| 1093 | - * @param mixed $calendarId |
|
| 1094 | - * @param string $objectUri |
|
| 1095 | - * @param string $calendarData |
|
| 1096 | - * @param int $calendarType |
|
| 1097 | - * @return string |
|
| 1098 | - */ |
|
| 1099 | - public function createCalendarObject($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) { |
|
| 1100 | - $extraData = $this->getDenormalizedData($calendarData); |
|
| 1101 | - |
|
| 1102 | - $q = $this->db->getQueryBuilder(); |
|
| 1103 | - $q->select($q->func()->count('*')) |
|
| 1104 | - ->from('calendarobjects') |
|
| 1105 | - ->where($q->expr()->eq('calendarid', $q->createNamedParameter($calendarId))) |
|
| 1106 | - ->andWhere($q->expr()->eq('uid', $q->createNamedParameter($extraData['uid']))) |
|
| 1107 | - ->andWhere($q->expr()->eq('calendartype', $q->createNamedParameter($calendarType))); |
|
| 1108 | - |
|
| 1109 | - $result = $q->executeQuery(); |
|
| 1110 | - $count = (int) $result->fetchOne(); |
|
| 1111 | - $result->closeCursor(); |
|
| 1112 | - |
|
| 1113 | - if ($count !== 0) { |
|
| 1114 | - throw new \Sabre\DAV\Exception\BadRequest('Calendar object with uid already exists in this calendar collection.'); |
|
| 1115 | - } |
|
| 1116 | - |
|
| 1117 | - $query = $this->db->getQueryBuilder(); |
|
| 1118 | - $query->insert('calendarobjects') |
|
| 1119 | - ->values([ |
|
| 1120 | - 'calendarid' => $query->createNamedParameter($calendarId), |
|
| 1121 | - 'uri' => $query->createNamedParameter($objectUri), |
|
| 1122 | - 'calendardata' => $query->createNamedParameter($calendarData, IQueryBuilder::PARAM_LOB), |
|
| 1123 | - 'lastmodified' => $query->createNamedParameter(time()), |
|
| 1124 | - 'etag' => $query->createNamedParameter($extraData['etag']), |
|
| 1125 | - 'size' => $query->createNamedParameter($extraData['size']), |
|
| 1126 | - 'componenttype' => $query->createNamedParameter($extraData['componentType']), |
|
| 1127 | - 'firstoccurence' => $query->createNamedParameter($extraData['firstOccurence']), |
|
| 1128 | - 'lastoccurence' => $query->createNamedParameter($extraData['lastOccurence']), |
|
| 1129 | - 'classification' => $query->createNamedParameter($extraData['classification']), |
|
| 1130 | - 'uid' => $query->createNamedParameter($extraData['uid']), |
|
| 1131 | - 'calendartype' => $query->createNamedParameter($calendarType), |
|
| 1132 | - ]) |
|
| 1133 | - ->executeStatement(); |
|
| 1134 | - |
|
| 1135 | - $this->updateProperties($calendarId, $objectUri, $calendarData, $calendarType); |
|
| 1136 | - $this->addChange($calendarId, $objectUri, 1, $calendarType); |
|
| 1137 | - |
|
| 1138 | - $objectRow = $this->getCalendarObject($calendarId, $objectUri, $calendarType); |
|
| 1139 | - if ($calendarType === self::CALENDAR_TYPE_CALENDAR) { |
|
| 1140 | - $calendarRow = $this->getCalendarById($calendarId); |
|
| 1141 | - $shares = $this->getShares($calendarId); |
|
| 1142 | - |
|
| 1143 | - $this->dispatcher->dispatchTyped(new CalendarObjectCreatedEvent((int)$calendarId, $calendarRow, $shares, $objectRow)); |
|
| 1144 | - } else { |
|
| 1145 | - $subscriptionRow = $this->getSubscriptionById($calendarId); |
|
| 1146 | - |
|
| 1147 | - $this->dispatcher->dispatchTyped(new CachedCalendarObjectCreatedEvent((int)$calendarId, $subscriptionRow, [], $objectRow)); |
|
| 1148 | - $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::createCachedCalendarObject', new GenericEvent( |
|
| 1149 | - '\OCA\DAV\CalDAV\CalDavBackend::createCachedCalendarObject', |
|
| 1150 | - [ |
|
| 1151 | - 'subscriptionId' => $calendarId, |
|
| 1152 | - 'calendarData' => $subscriptionRow, |
|
| 1153 | - 'shares' => [], |
|
| 1154 | - 'objectData' => $objectRow, |
|
| 1155 | - ] |
|
| 1156 | - )); |
|
| 1157 | - } |
|
| 1158 | - |
|
| 1159 | - return '"' . $extraData['etag'] . '"'; |
|
| 1160 | - } |
|
| 1161 | - |
|
| 1162 | - /** |
|
| 1163 | - * Updates an existing calendarobject, based on it's uri. |
|
| 1164 | - * |
|
| 1165 | - * The object uri is only the basename, or filename and not a full path. |
|
| 1166 | - * |
|
| 1167 | - * It is possible return an etag from this function, which will be used in |
|
| 1168 | - * the response to this PUT request. Note that the ETag must be surrounded |
|
| 1169 | - * by double-quotes. |
|
| 1170 | - * |
|
| 1171 | - * However, you should only really return this ETag if you don't mangle the |
|
| 1172 | - * calendar-data. If the result of a subsequent GET to this object is not |
|
| 1173 | - * the exact same as this request body, you should omit the ETag. |
|
| 1174 | - * |
|
| 1175 | - * @param mixed $calendarId |
|
| 1176 | - * @param string $objectUri |
|
| 1177 | - * @param string $calendarData |
|
| 1178 | - * @param int $calendarType |
|
| 1179 | - * @return string |
|
| 1180 | - */ |
|
| 1181 | - public function updateCalendarObject($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) { |
|
| 1182 | - $extraData = $this->getDenormalizedData($calendarData); |
|
| 1183 | - $query = $this->db->getQueryBuilder(); |
|
| 1184 | - $query->update('calendarobjects') |
|
| 1185 | - ->set('calendardata', $query->createNamedParameter($calendarData, IQueryBuilder::PARAM_LOB)) |
|
| 1186 | - ->set('lastmodified', $query->createNamedParameter(time())) |
|
| 1187 | - ->set('etag', $query->createNamedParameter($extraData['etag'])) |
|
| 1188 | - ->set('size', $query->createNamedParameter($extraData['size'])) |
|
| 1189 | - ->set('componenttype', $query->createNamedParameter($extraData['componentType'])) |
|
| 1190 | - ->set('firstoccurence', $query->createNamedParameter($extraData['firstOccurence'])) |
|
| 1191 | - ->set('lastoccurence', $query->createNamedParameter($extraData['lastOccurence'])) |
|
| 1192 | - ->set('classification', $query->createNamedParameter($extraData['classification'])) |
|
| 1193 | - ->set('uid', $query->createNamedParameter($extraData['uid'])) |
|
| 1194 | - ->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId))) |
|
| 1195 | - ->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri))) |
|
| 1196 | - ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType))) |
|
| 1197 | - ->executeStatement(); |
|
| 1198 | - |
|
| 1199 | - $this->updateProperties($calendarId, $objectUri, $calendarData, $calendarType); |
|
| 1200 | - $this->addChange($calendarId, $objectUri, 2, $calendarType); |
|
| 1201 | - |
|
| 1202 | - $objectRow = $this->getCalendarObject($calendarId, $objectUri, $calendarType); |
|
| 1203 | - if (is_array($objectRow)) { |
|
| 1204 | - if ($calendarType === self::CALENDAR_TYPE_CALENDAR) { |
|
| 1205 | - $calendarRow = $this->getCalendarById($calendarId); |
|
| 1206 | - $shares = $this->getShares($calendarId); |
|
| 1207 | - |
|
| 1208 | - $this->dispatcher->dispatchTyped(new CalendarObjectUpdatedEvent((int)$calendarId, $calendarRow, $shares, $objectRow)); |
|
| 1209 | - } else { |
|
| 1210 | - $subscriptionRow = $this->getSubscriptionById($calendarId); |
|
| 1211 | - |
|
| 1212 | - $this->dispatcher->dispatchTyped(new CachedCalendarObjectUpdatedEvent((int)$calendarId, $subscriptionRow, [], $objectRow)); |
|
| 1213 | - $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateCachedCalendarObject', new GenericEvent( |
|
| 1214 | - '\OCA\DAV\CalDAV\CalDavBackend::updateCachedCalendarObject', |
|
| 1215 | - [ |
|
| 1216 | - 'subscriptionId' => $calendarId, |
|
| 1217 | - 'calendarData' => $subscriptionRow, |
|
| 1218 | - 'shares' => [], |
|
| 1219 | - 'objectData' => $objectRow, |
|
| 1220 | - ] |
|
| 1221 | - )); |
|
| 1222 | - } |
|
| 1223 | - } |
|
| 1224 | - |
|
| 1225 | - return '"' . $extraData['etag'] . '"'; |
|
| 1226 | - } |
|
| 1227 | - |
|
| 1228 | - /** |
|
| 1229 | - * @param int $calendarObjectId |
|
| 1230 | - * @param int $classification |
|
| 1231 | - */ |
|
| 1232 | - public function setClassification($calendarObjectId, $classification) { |
|
| 1233 | - if (!in_array($classification, [ |
|
| 1234 | - self::CLASSIFICATION_PUBLIC, self::CLASSIFICATION_PRIVATE, self::CLASSIFICATION_CONFIDENTIAL |
|
| 1235 | - ])) { |
|
| 1236 | - throw new \InvalidArgumentException(); |
|
| 1237 | - } |
|
| 1238 | - $query = $this->db->getQueryBuilder(); |
|
| 1239 | - $query->update('calendarobjects') |
|
| 1240 | - ->set('classification', $query->createNamedParameter($classification)) |
|
| 1241 | - ->where($query->expr()->eq('id', $query->createNamedParameter($calendarObjectId))) |
|
| 1242 | - ->executeStatement(); |
|
| 1243 | - } |
|
| 1244 | - |
|
| 1245 | - /** |
|
| 1246 | - * Deletes an existing calendar object. |
|
| 1247 | - * |
|
| 1248 | - * The object uri is only the basename, or filename and not a full path. |
|
| 1249 | - * |
|
| 1250 | - * @param mixed $calendarId |
|
| 1251 | - * @param string $objectUri |
|
| 1252 | - * @param int $calendarType |
|
| 1253 | - * @return void |
|
| 1254 | - */ |
|
| 1255 | - public function deleteCalendarObject($calendarId, $objectUri, $calendarType = self::CALENDAR_TYPE_CALENDAR) { |
|
| 1256 | - $data = $this->getCalendarObject($calendarId, $objectUri, $calendarType); |
|
| 1257 | - if (is_array($data)) { |
|
| 1258 | - if ($calendarType === self::CALENDAR_TYPE_CALENDAR) { |
|
| 1259 | - $calendarRow = $this->getCalendarById($calendarId); |
|
| 1260 | - $shares = $this->getShares($calendarId); |
|
| 1261 | - |
|
| 1262 | - $this->dispatcher->dispatchTyped(new CalendarObjectDeletedEvent((int)$calendarId, $calendarRow, $shares, $data)); |
|
| 1263 | - } else { |
|
| 1264 | - $subscriptionRow = $this->getSubscriptionById($calendarId); |
|
| 1265 | - |
|
| 1266 | - $this->dispatcher->dispatchTyped(new CachedCalendarObjectDeletedEvent((int)$calendarId, $subscriptionRow, [], $data)); |
|
| 1267 | - $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::deleteCachedCalendarObject', new GenericEvent( |
|
| 1268 | - '\OCA\DAV\CalDAV\CalDavBackend::deleteCachedCalendarObject', |
|
| 1269 | - [ |
|
| 1270 | - 'subscriptionId' => $calendarId, |
|
| 1271 | - 'calendarData' => $subscriptionRow, |
|
| 1272 | - 'shares' => [], |
|
| 1273 | - 'objectData' => $data, |
|
| 1274 | - ] |
|
| 1275 | - )); |
|
| 1276 | - } |
|
| 1277 | - } |
|
| 1278 | - |
|
| 1279 | - $stmt = $this->db->prepare('DELETE FROM `*PREFIX*calendarobjects` WHERE `calendarid` = ? AND `uri` = ? AND `calendartype` = ?'); |
|
| 1280 | - $stmt->execute([$calendarId, $objectUri, $calendarType]); |
|
| 1281 | - |
|
| 1282 | - if (is_array($data)) { |
|
| 1283 | - $this->purgeProperties($calendarId, $data['id'], $calendarType); |
|
| 1284 | - } |
|
| 1285 | - |
|
| 1286 | - $this->addChange($calendarId, $objectUri, 3, $calendarType); |
|
| 1287 | - } |
|
| 1288 | - |
|
| 1289 | - /** |
|
| 1290 | - * Performs a calendar-query on the contents of this calendar. |
|
| 1291 | - * |
|
| 1292 | - * The calendar-query is defined in RFC4791 : CalDAV. Using the |
|
| 1293 | - * calendar-query it is possible for a client to request a specific set of |
|
| 1294 | - * object, based on contents of iCalendar properties, date-ranges and |
|
| 1295 | - * iCalendar component types (VTODO, VEVENT). |
|
| 1296 | - * |
|
| 1297 | - * This method should just return a list of (relative) urls that match this |
|
| 1298 | - * query. |
|
| 1299 | - * |
|
| 1300 | - * The list of filters are specified as an array. The exact array is |
|
| 1301 | - * documented by Sabre\CalDAV\CalendarQueryParser. |
|
| 1302 | - * |
|
| 1303 | - * Note that it is extremely likely that getCalendarObject for every path |
|
| 1304 | - * returned from this method will be called almost immediately after. You |
|
| 1305 | - * may want to anticipate this to speed up these requests. |
|
| 1306 | - * |
|
| 1307 | - * This method provides a default implementation, which parses *all* the |
|
| 1308 | - * iCalendar objects in the specified calendar. |
|
| 1309 | - * |
|
| 1310 | - * This default may well be good enough for personal use, and calendars |
|
| 1311 | - * that aren't very large. But if you anticipate high usage, big calendars |
|
| 1312 | - * or high loads, you are strongly advised to optimize certain paths. |
|
| 1313 | - * |
|
| 1314 | - * The best way to do so is override this method and to optimize |
|
| 1315 | - * specifically for 'common filters'. |
|
| 1316 | - * |
|
| 1317 | - * Requests that are extremely common are: |
|
| 1318 | - * * requests for just VEVENTS |
|
| 1319 | - * * requests for just VTODO |
|
| 1320 | - * * requests with a time-range-filter on either VEVENT or VTODO. |
|
| 1321 | - * |
|
| 1322 | - * ..and combinations of these requests. It may not be worth it to try to |
|
| 1323 | - * handle every possible situation and just rely on the (relatively |
|
| 1324 | - * easy to use) CalendarQueryValidator to handle the rest. |
|
| 1325 | - * |
|
| 1326 | - * Note that especially time-range-filters may be difficult to parse. A |
|
| 1327 | - * time-range filter specified on a VEVENT must for instance also handle |
|
| 1328 | - * recurrence rules correctly. |
|
| 1329 | - * A good example of how to interprete all these filters can also simply |
|
| 1330 | - * be found in Sabre\CalDAV\CalendarQueryFilter. This class is as correct |
|
| 1331 | - * as possible, so it gives you a good idea on what type of stuff you need |
|
| 1332 | - * to think of. |
|
| 1333 | - * |
|
| 1334 | - * @param mixed $calendarId |
|
| 1335 | - * @param array $filters |
|
| 1336 | - * @param int $calendarType |
|
| 1337 | - * @return array |
|
| 1338 | - */ |
|
| 1339 | - public function calendarQuery($calendarId, array $filters, $calendarType = self::CALENDAR_TYPE_CALENDAR):array { |
|
| 1340 | - $componentType = null; |
|
| 1341 | - $requirePostFilter = true; |
|
| 1342 | - $timeRange = null; |
|
| 1343 | - |
|
| 1344 | - // if no filters were specified, we don't need to filter after a query |
|
| 1345 | - if (!$filters['prop-filters'] && !$filters['comp-filters']) { |
|
| 1346 | - $requirePostFilter = false; |
|
| 1347 | - } |
|
| 1348 | - |
|
| 1349 | - // Figuring out if there's a component filter |
|
| 1350 | - if (count($filters['comp-filters']) > 0 && !$filters['comp-filters'][0]['is-not-defined']) { |
|
| 1351 | - $componentType = $filters['comp-filters'][0]['name']; |
|
| 1352 | - |
|
| 1353 | - // Checking if we need post-filters |
|
| 1354 | - if (!$filters['prop-filters'] && !$filters['comp-filters'][0]['comp-filters'] && !$filters['comp-filters'][0]['time-range'] && !$filters['comp-filters'][0]['prop-filters']) { |
|
| 1355 | - $requirePostFilter = false; |
|
| 1356 | - } |
|
| 1357 | - // There was a time-range filter |
|
| 1358 | - if ($componentType === 'VEVENT' && isset($filters['comp-filters'][0]['time-range']) && is_array($filters['comp-filters'][0]['time-range'])) { |
|
| 1359 | - $timeRange = $filters['comp-filters'][0]['time-range']; |
|
| 1360 | - |
|
| 1361 | - // If start time OR the end time is not specified, we can do a |
|
| 1362 | - // 100% accurate mysql query. |
|
| 1363 | - if (!$filters['prop-filters'] && !$filters['comp-filters'][0]['comp-filters'] && !$filters['comp-filters'][0]['prop-filters'] && (!$timeRange['start'] || !$timeRange['end'])) { |
|
| 1364 | - $requirePostFilter = false; |
|
| 1365 | - } |
|
| 1366 | - } |
|
| 1367 | - } |
|
| 1368 | - $columns = ['uri']; |
|
| 1369 | - if ($requirePostFilter) { |
|
| 1370 | - $columns = ['uri', 'calendardata']; |
|
| 1371 | - } |
|
| 1372 | - $query = $this->db->getQueryBuilder(); |
|
| 1373 | - $query->select($columns) |
|
| 1374 | - ->from('calendarobjects') |
|
| 1375 | - ->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId))) |
|
| 1376 | - ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType))); |
|
| 1377 | - |
|
| 1378 | - if ($componentType) { |
|
| 1379 | - $query->andWhere($query->expr()->eq('componenttype', $query->createNamedParameter($componentType))); |
|
| 1380 | - } |
|
| 1381 | - |
|
| 1382 | - if ($timeRange && $timeRange['start']) { |
|
| 1383 | - $query->andWhere($query->expr()->gt('lastoccurence', $query->createNamedParameter($timeRange['start']->getTimeStamp()))); |
|
| 1384 | - } |
|
| 1385 | - if ($timeRange && $timeRange['end']) { |
|
| 1386 | - $query->andWhere($query->expr()->lt('firstoccurence', $query->createNamedParameter($timeRange['end']->getTimeStamp()))); |
|
| 1387 | - } |
|
| 1388 | - |
|
| 1389 | - $stmt = $query->executeQuery(); |
|
| 1390 | - |
|
| 1391 | - $result = []; |
|
| 1392 | - while ($row = $stmt->fetch()) { |
|
| 1393 | - if ($requirePostFilter) { |
|
| 1394 | - // validateFilterForObject will parse the calendar data |
|
| 1395 | - // catch parsing errors |
|
| 1396 | - try { |
|
| 1397 | - $matches = $this->validateFilterForObject($row, $filters); |
|
| 1398 | - } catch (ParseException $ex) { |
|
| 1399 | - $this->logger->logException($ex, [ |
|
| 1400 | - 'app' => 'dav', |
|
| 1401 | - 'message' => 'Caught parsing exception for calendar data. This usually indicates invalid calendar data. calendar-id:'.$calendarId.' uri:'.$row['uri'] |
|
| 1402 | - ]); |
|
| 1403 | - continue; |
|
| 1404 | - } catch (InvalidDataException $ex) { |
|
| 1405 | - $this->logger->logException($ex, [ |
|
| 1406 | - 'app' => 'dav', |
|
| 1407 | - 'message' => 'Caught invalid data exception for calendar data. This usually indicates invalid calendar data. calendar-id:'.$calendarId.' uri:'.$row['uri'] |
|
| 1408 | - ]); |
|
| 1409 | - continue; |
|
| 1410 | - } |
|
| 1411 | - |
|
| 1412 | - if (!$matches) { |
|
| 1413 | - continue; |
|
| 1414 | - } |
|
| 1415 | - } |
|
| 1416 | - $result[] = $row['uri']; |
|
| 1417 | - } |
|
| 1418 | - |
|
| 1419 | - return $result; |
|
| 1420 | - } |
|
| 1421 | - |
|
| 1422 | - /** |
|
| 1423 | - * custom Nextcloud search extension for CalDAV |
|
| 1424 | - * |
|
| 1425 | - * TODO - this should optionally cover cached calendar objects as well |
|
| 1426 | - * |
|
| 1427 | - * @param string $principalUri |
|
| 1428 | - * @param array $filters |
|
| 1429 | - * @param integer|null $limit |
|
| 1430 | - * @param integer|null $offset |
|
| 1431 | - * @return array |
|
| 1432 | - */ |
|
| 1433 | - public function calendarSearch($principalUri, array $filters, $limit = null, $offset = null) { |
|
| 1434 | - $calendars = $this->getCalendarsForUser($principalUri); |
|
| 1435 | - $ownCalendars = []; |
|
| 1436 | - $sharedCalendars = []; |
|
| 1437 | - |
|
| 1438 | - $uriMapper = []; |
|
| 1439 | - |
|
| 1440 | - foreach ($calendars as $calendar) { |
|
| 1441 | - if ($calendar['{http://owncloud.org/ns}owner-principal'] === $principalUri) { |
|
| 1442 | - $ownCalendars[] = $calendar['id']; |
|
| 1443 | - } else { |
|
| 1444 | - $sharedCalendars[] = $calendar['id']; |
|
| 1445 | - } |
|
| 1446 | - $uriMapper[$calendar['id']] = $calendar['uri']; |
|
| 1447 | - } |
|
| 1448 | - if (count($ownCalendars) === 0 && count($sharedCalendars) === 0) { |
|
| 1449 | - return []; |
|
| 1450 | - } |
|
| 1451 | - |
|
| 1452 | - $query = $this->db->getQueryBuilder(); |
|
| 1453 | - // Calendar id expressions |
|
| 1454 | - $calendarExpressions = []; |
|
| 1455 | - foreach ($ownCalendars as $id) { |
|
| 1456 | - $calendarExpressions[] = $query->expr()->andX( |
|
| 1457 | - $query->expr()->eq('c.calendarid', |
|
| 1458 | - $query->createNamedParameter($id)), |
|
| 1459 | - $query->expr()->eq('c.calendartype', |
|
| 1460 | - $query->createNamedParameter(self::CALENDAR_TYPE_CALENDAR))); |
|
| 1461 | - } |
|
| 1462 | - foreach ($sharedCalendars as $id) { |
|
| 1463 | - $calendarExpressions[] = $query->expr()->andX( |
|
| 1464 | - $query->expr()->eq('c.calendarid', |
|
| 1465 | - $query->createNamedParameter($id)), |
|
| 1466 | - $query->expr()->eq('c.classification', |
|
| 1467 | - $query->createNamedParameter(self::CLASSIFICATION_PUBLIC)), |
|
| 1468 | - $query->expr()->eq('c.calendartype', |
|
| 1469 | - $query->createNamedParameter(self::CALENDAR_TYPE_CALENDAR))); |
|
| 1470 | - } |
|
| 1471 | - |
|
| 1472 | - if (count($calendarExpressions) === 1) { |
|
| 1473 | - $calExpr = $calendarExpressions[0]; |
|
| 1474 | - } else { |
|
| 1475 | - $calExpr = call_user_func_array([$query->expr(), 'orX'], $calendarExpressions); |
|
| 1476 | - } |
|
| 1477 | - |
|
| 1478 | - // Component expressions |
|
| 1479 | - $compExpressions = []; |
|
| 1480 | - foreach ($filters['comps'] as $comp) { |
|
| 1481 | - $compExpressions[] = $query->expr() |
|
| 1482 | - ->eq('c.componenttype', $query->createNamedParameter($comp)); |
|
| 1483 | - } |
|
| 1484 | - |
|
| 1485 | - if (count($compExpressions) === 1) { |
|
| 1486 | - $compExpr = $compExpressions[0]; |
|
| 1487 | - } else { |
|
| 1488 | - $compExpr = call_user_func_array([$query->expr(), 'orX'], $compExpressions); |
|
| 1489 | - } |
|
| 1490 | - |
|
| 1491 | - if (!isset($filters['props'])) { |
|
| 1492 | - $filters['props'] = []; |
|
| 1493 | - } |
|
| 1494 | - if (!isset($filters['params'])) { |
|
| 1495 | - $filters['params'] = []; |
|
| 1496 | - } |
|
| 1497 | - |
|
| 1498 | - $propParamExpressions = []; |
|
| 1499 | - foreach ($filters['props'] as $prop) { |
|
| 1500 | - $propParamExpressions[] = $query->expr()->andX( |
|
| 1501 | - $query->expr()->eq('i.name', $query->createNamedParameter($prop)), |
|
| 1502 | - $query->expr()->isNull('i.parameter') |
|
| 1503 | - ); |
|
| 1504 | - } |
|
| 1505 | - foreach ($filters['params'] as $param) { |
|
| 1506 | - $propParamExpressions[] = $query->expr()->andX( |
|
| 1507 | - $query->expr()->eq('i.name', $query->createNamedParameter($param['property'])), |
|
| 1508 | - $query->expr()->eq('i.parameter', $query->createNamedParameter($param['parameter'])) |
|
| 1509 | - ); |
|
| 1510 | - } |
|
| 1511 | - |
|
| 1512 | - if (count($propParamExpressions) === 1) { |
|
| 1513 | - $propParamExpr = $propParamExpressions[0]; |
|
| 1514 | - } else { |
|
| 1515 | - $propParamExpr = call_user_func_array([$query->expr(), 'orX'], $propParamExpressions); |
|
| 1516 | - } |
|
| 1517 | - |
|
| 1518 | - $query->select(['c.calendarid', 'c.uri']) |
|
| 1519 | - ->from($this->dbObjectPropertiesTable, 'i') |
|
| 1520 | - ->join('i', 'calendarobjects', 'c', $query->expr()->eq('i.objectid', 'c.id')) |
|
| 1521 | - ->where($calExpr) |
|
| 1522 | - ->andWhere($compExpr) |
|
| 1523 | - ->andWhere($propParamExpr) |
|
| 1524 | - ->andWhere($query->expr()->iLike('i.value', |
|
| 1525 | - $query->createNamedParameter('%'.$this->db->escapeLikeParameter($filters['search-term']).'%'))); |
|
| 1526 | - |
|
| 1527 | - if ($offset) { |
|
| 1528 | - $query->setFirstResult($offset); |
|
| 1529 | - } |
|
| 1530 | - if ($limit) { |
|
| 1531 | - $query->setMaxResults($limit); |
|
| 1532 | - } |
|
| 1533 | - |
|
| 1534 | - $stmt = $query->executeQuery(); |
|
| 1535 | - |
|
| 1536 | - $result = []; |
|
| 1537 | - while ($row = $stmt->fetch()) { |
|
| 1538 | - $path = $uriMapper[$row['calendarid']] . '/' . $row['uri']; |
|
| 1539 | - if (!in_array($path, $result)) { |
|
| 1540 | - $result[] = $path; |
|
| 1541 | - } |
|
| 1542 | - } |
|
| 1543 | - |
|
| 1544 | - return $result; |
|
| 1545 | - } |
|
| 1546 | - |
|
| 1547 | - /** |
|
| 1548 | - * used for Nextcloud's calendar API |
|
| 1549 | - * |
|
| 1550 | - * @param array $calendarInfo |
|
| 1551 | - * @param string $pattern |
|
| 1552 | - * @param array $searchProperties |
|
| 1553 | - * @param array $options |
|
| 1554 | - * @param integer|null $limit |
|
| 1555 | - * @param integer|null $offset |
|
| 1556 | - * |
|
| 1557 | - * @return array |
|
| 1558 | - */ |
|
| 1559 | - public function search(array $calendarInfo, $pattern, array $searchProperties, |
|
| 1560 | - array $options, $limit, $offset) { |
|
| 1561 | - $outerQuery = $this->db->getQueryBuilder(); |
|
| 1562 | - $innerQuery = $this->db->getQueryBuilder(); |
|
| 1563 | - |
|
| 1564 | - $innerQuery->selectDistinct('op.objectid') |
|
| 1565 | - ->from($this->dbObjectPropertiesTable, 'op') |
|
| 1566 | - ->andWhere($innerQuery->expr()->eq('op.calendarid', |
|
| 1567 | - $outerQuery->createNamedParameter($calendarInfo['id']))) |
|
| 1568 | - ->andWhere($innerQuery->expr()->eq('op.calendartype', |
|
| 1569 | - $outerQuery->createNamedParameter(self::CALENDAR_TYPE_CALENDAR))); |
|
| 1570 | - |
|
| 1571 | - // only return public items for shared calendars for now |
|
| 1572 | - if ($calendarInfo['principaluri'] !== $calendarInfo['{http://owncloud.org/ns}owner-principal']) { |
|
| 1573 | - $innerQuery->andWhere($innerQuery->expr()->eq('c.classification', |
|
| 1574 | - $outerQuery->createNamedParameter(self::CLASSIFICATION_PUBLIC))); |
|
| 1575 | - } |
|
| 1576 | - |
|
| 1577 | - $or = $innerQuery->expr()->orX(); |
|
| 1578 | - foreach ($searchProperties as $searchProperty) { |
|
| 1579 | - $or->add($innerQuery->expr()->eq('op.name', |
|
| 1580 | - $outerQuery->createNamedParameter($searchProperty))); |
|
| 1581 | - } |
|
| 1582 | - $innerQuery->andWhere($or); |
|
| 1583 | - |
|
| 1584 | - if ($pattern !== '') { |
|
| 1585 | - $innerQuery->andWhere($innerQuery->expr()->iLike('op.value', |
|
| 1586 | - $outerQuery->createNamedParameter('%' . |
|
| 1587 | - $this->db->escapeLikeParameter($pattern) . '%'))); |
|
| 1588 | - } |
|
| 1589 | - |
|
| 1590 | - $outerQuery->select('c.id', 'c.calendardata', 'c.componenttype', 'c.uid', 'c.uri') |
|
| 1591 | - ->from('calendarobjects', 'c'); |
|
| 1592 | - |
|
| 1593 | - if (isset($options['timerange'])) { |
|
| 1594 | - if (isset($options['timerange']['start']) && $options['timerange']['start'] instanceof DateTime) { |
|
| 1595 | - $outerQuery->andWhere($outerQuery->expr()->gt('lastoccurence', |
|
| 1596 | - $outerQuery->createNamedParameter($options['timerange']['start']->getTimeStamp()))); |
|
| 1597 | - } |
|
| 1598 | - if (isset($options['timerange']['end']) && $options['timerange']['end'] instanceof DateTime) { |
|
| 1599 | - $outerQuery->andWhere($outerQuery->expr()->lt('firstoccurence', |
|
| 1600 | - $outerQuery->createNamedParameter($options['timerange']['end']->getTimeStamp()))); |
|
| 1601 | - } |
|
| 1602 | - } |
|
| 1603 | - |
|
| 1604 | - if (isset($options['types'])) { |
|
| 1605 | - $or = $outerQuery->expr()->orX(); |
|
| 1606 | - foreach ($options['types'] as $type) { |
|
| 1607 | - $or->add($outerQuery->expr()->eq('componenttype', |
|
| 1608 | - $outerQuery->createNamedParameter($type))); |
|
| 1609 | - } |
|
| 1610 | - $outerQuery->andWhere($or); |
|
| 1611 | - } |
|
| 1612 | - |
|
| 1613 | - $outerQuery->andWhere($outerQuery->expr()->in('c.id', |
|
| 1614 | - $outerQuery->createFunction($innerQuery->getSQL()))); |
|
| 1615 | - |
|
| 1616 | - if ($offset) { |
|
| 1617 | - $outerQuery->setFirstResult($offset); |
|
| 1618 | - } |
|
| 1619 | - if ($limit) { |
|
| 1620 | - $outerQuery->setMaxResults($limit); |
|
| 1621 | - } |
|
| 1622 | - |
|
| 1623 | - $result = $outerQuery->executeQuery(); |
|
| 1624 | - $calendarObjects = $result->fetchAll(); |
|
| 1625 | - |
|
| 1626 | - return array_map(function ($o) { |
|
| 1627 | - $calendarData = Reader::read($o['calendardata']); |
|
| 1628 | - $comps = $calendarData->getComponents(); |
|
| 1629 | - $objects = []; |
|
| 1630 | - $timezones = []; |
|
| 1631 | - foreach ($comps as $comp) { |
|
| 1632 | - if ($comp instanceof VTimeZone) { |
|
| 1633 | - $timezones[] = $comp; |
|
| 1634 | - } else { |
|
| 1635 | - $objects[] = $comp; |
|
| 1636 | - } |
|
| 1637 | - } |
|
| 1638 | - |
|
| 1639 | - return [ |
|
| 1640 | - 'id' => $o['id'], |
|
| 1641 | - 'type' => $o['componenttype'], |
|
| 1642 | - 'uid' => $o['uid'], |
|
| 1643 | - 'uri' => $o['uri'], |
|
| 1644 | - 'objects' => array_map(function ($c) { |
|
| 1645 | - return $this->transformSearchData($c); |
|
| 1646 | - }, $objects), |
|
| 1647 | - 'timezones' => array_map(function ($c) { |
|
| 1648 | - return $this->transformSearchData($c); |
|
| 1649 | - }, $timezones), |
|
| 1650 | - ]; |
|
| 1651 | - }, $calendarObjects); |
|
| 1652 | - } |
|
| 1653 | - |
|
| 1654 | - /** |
|
| 1655 | - * @param Component $comp |
|
| 1656 | - * @return array |
|
| 1657 | - */ |
|
| 1658 | - private function transformSearchData(Component $comp) { |
|
| 1659 | - $data = []; |
|
| 1660 | - /** @var Component[] $subComponents */ |
|
| 1661 | - $subComponents = $comp->getComponents(); |
|
| 1662 | - /** @var Property[] $properties */ |
|
| 1663 | - $properties = array_filter($comp->children(), function ($c) { |
|
| 1664 | - return $c instanceof Property; |
|
| 1665 | - }); |
|
| 1666 | - $validationRules = $comp->getValidationRules(); |
|
| 1667 | - |
|
| 1668 | - foreach ($subComponents as $subComponent) { |
|
| 1669 | - $name = $subComponent->name; |
|
| 1670 | - if (!isset($data[$name])) { |
|
| 1671 | - $data[$name] = []; |
|
| 1672 | - } |
|
| 1673 | - $data[$name][] = $this->transformSearchData($subComponent); |
|
| 1674 | - } |
|
| 1675 | - |
|
| 1676 | - foreach ($properties as $property) { |
|
| 1677 | - $name = $property->name; |
|
| 1678 | - if (!isset($validationRules[$name])) { |
|
| 1679 | - $validationRules[$name] = '*'; |
|
| 1680 | - } |
|
| 1681 | - |
|
| 1682 | - $rule = $validationRules[$property->name]; |
|
| 1683 | - if ($rule === '+' || $rule === '*') { // multiple |
|
| 1684 | - if (!isset($data[$name])) { |
|
| 1685 | - $data[$name] = []; |
|
| 1686 | - } |
|
| 1687 | - |
|
| 1688 | - $data[$name][] = $this->transformSearchProperty($property); |
|
| 1689 | - } else { // once |
|
| 1690 | - $data[$name] = $this->transformSearchProperty($property); |
|
| 1691 | - } |
|
| 1692 | - } |
|
| 1693 | - |
|
| 1694 | - return $data; |
|
| 1695 | - } |
|
| 1696 | - |
|
| 1697 | - /** |
|
| 1698 | - * @param Property $prop |
|
| 1699 | - * @return array |
|
| 1700 | - */ |
|
| 1701 | - private function transformSearchProperty(Property $prop) { |
|
| 1702 | - // No need to check Date, as it extends DateTime |
|
| 1703 | - if ($prop instanceof Property\ICalendar\DateTime) { |
|
| 1704 | - $value = $prop->getDateTime(); |
|
| 1705 | - } else { |
|
| 1706 | - $value = $prop->getValue(); |
|
| 1707 | - } |
|
| 1708 | - |
|
| 1709 | - return [ |
|
| 1710 | - $value, |
|
| 1711 | - $prop->parameters() |
|
| 1712 | - ]; |
|
| 1713 | - } |
|
| 1714 | - |
|
| 1715 | - /** |
|
| 1716 | - * @param string $principalUri |
|
| 1717 | - * @param string $pattern |
|
| 1718 | - * @param array $componentTypes |
|
| 1719 | - * @param array $searchProperties |
|
| 1720 | - * @param array $searchParameters |
|
| 1721 | - * @param array $options |
|
| 1722 | - * @return array |
|
| 1723 | - */ |
|
| 1724 | - public function searchPrincipalUri(string $principalUri, |
|
| 1725 | - string $pattern, |
|
| 1726 | - array $componentTypes, |
|
| 1727 | - array $searchProperties, |
|
| 1728 | - array $searchParameters, |
|
| 1729 | - array $options = []): array { |
|
| 1730 | - $escapePattern = !\array_key_exists('escape_like_param', $options) || $options['escape_like_param'] !== false; |
|
| 1731 | - |
|
| 1732 | - $calendarObjectIdQuery = $this->db->getQueryBuilder(); |
|
| 1733 | - $calendarOr = $calendarObjectIdQuery->expr()->orX(); |
|
| 1734 | - $searchOr = $calendarObjectIdQuery->expr()->orX(); |
|
| 1735 | - |
|
| 1736 | - // Fetch calendars and subscription |
|
| 1737 | - $calendars = $this->getCalendarsForUser($principalUri); |
|
| 1738 | - $subscriptions = $this->getSubscriptionsForUser($principalUri); |
|
| 1739 | - foreach ($calendars as $calendar) { |
|
| 1740 | - $calendarAnd = $calendarObjectIdQuery->expr()->andX(); |
|
| 1741 | - $calendarAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int)$calendar['id']))); |
|
| 1742 | - $calendarAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendartype', $calendarObjectIdQuery->createNamedParameter(self::CALENDAR_TYPE_CALENDAR))); |
|
| 1743 | - |
|
| 1744 | - // If it's shared, limit search to public events |
|
| 1745 | - if (isset($calendar['{http://owncloud.org/ns}owner-principal']) |
|
| 1746 | - && $calendar['principaluri'] !== $calendar['{http://owncloud.org/ns}owner-principal']) { |
|
| 1747 | - $calendarAnd->add($calendarObjectIdQuery->expr()->eq('co.classification', $calendarObjectIdQuery->createNamedParameter(self::CLASSIFICATION_PUBLIC))); |
|
| 1748 | - } |
|
| 1749 | - |
|
| 1750 | - $calendarOr->add($calendarAnd); |
|
| 1751 | - } |
|
| 1752 | - foreach ($subscriptions as $subscription) { |
|
| 1753 | - $subscriptionAnd = $calendarObjectIdQuery->expr()->andX(); |
|
| 1754 | - $subscriptionAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int)$subscription['id']))); |
|
| 1755 | - $subscriptionAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendartype', $calendarObjectIdQuery->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION))); |
|
| 1756 | - |
|
| 1757 | - // If it's shared, limit search to public events |
|
| 1758 | - if (isset($subscription['{http://owncloud.org/ns}owner-principal']) |
|
| 1759 | - && $subscription['principaluri'] !== $subscription['{http://owncloud.org/ns}owner-principal']) { |
|
| 1760 | - $subscriptionAnd->add($calendarObjectIdQuery->expr()->eq('co.classification', $calendarObjectIdQuery->createNamedParameter(self::CLASSIFICATION_PUBLIC))); |
|
| 1761 | - } |
|
| 1762 | - |
|
| 1763 | - $calendarOr->add($subscriptionAnd); |
|
| 1764 | - } |
|
| 1765 | - |
|
| 1766 | - foreach ($searchProperties as $property) { |
|
| 1767 | - $propertyAnd = $calendarObjectIdQuery->expr()->andX(); |
|
| 1768 | - $propertyAnd->add($calendarObjectIdQuery->expr()->eq('cob.name', $calendarObjectIdQuery->createNamedParameter($property, IQueryBuilder::PARAM_STR))); |
|
| 1769 | - $propertyAnd->add($calendarObjectIdQuery->expr()->isNull('cob.parameter')); |
|
| 1770 | - |
|
| 1771 | - $searchOr->add($propertyAnd); |
|
| 1772 | - } |
|
| 1773 | - foreach ($searchParameters as $property => $parameter) { |
|
| 1774 | - $parameterAnd = $calendarObjectIdQuery->expr()->andX(); |
|
| 1775 | - $parameterAnd->add($calendarObjectIdQuery->expr()->eq('cob.name', $calendarObjectIdQuery->createNamedParameter($property, IQueryBuilder::PARAM_STR))); |
|
| 1776 | - $parameterAnd->add($calendarObjectIdQuery->expr()->eq('cob.parameter', $calendarObjectIdQuery->createNamedParameter($parameter, IQueryBuilder::PARAM_STR_ARRAY))); |
|
| 1777 | - |
|
| 1778 | - $searchOr->add($parameterAnd); |
|
| 1779 | - } |
|
| 1780 | - |
|
| 1781 | - if ($calendarOr->count() === 0) { |
|
| 1782 | - return []; |
|
| 1783 | - } |
|
| 1784 | - if ($searchOr->count() === 0) { |
|
| 1785 | - return []; |
|
| 1786 | - } |
|
| 1787 | - |
|
| 1788 | - $calendarObjectIdQuery->selectDistinct('cob.objectid') |
|
| 1789 | - ->from($this->dbObjectPropertiesTable, 'cob') |
|
| 1790 | - ->leftJoin('cob', 'calendarobjects', 'co', $calendarObjectIdQuery->expr()->eq('co.id', 'cob.objectid')) |
|
| 1791 | - ->andWhere($calendarObjectIdQuery->expr()->in('co.componenttype', $calendarObjectIdQuery->createNamedParameter($componentTypes, IQueryBuilder::PARAM_STR_ARRAY))) |
|
| 1792 | - ->andWhere($calendarOr) |
|
| 1793 | - ->andWhere($searchOr); |
|
| 1794 | - |
|
| 1795 | - if ('' !== $pattern) { |
|
| 1796 | - if (!$escapePattern) { |
|
| 1797 | - $calendarObjectIdQuery->andWhere($calendarObjectIdQuery->expr()->ilike('cob.value', $calendarObjectIdQuery->createNamedParameter($pattern))); |
|
| 1798 | - } else { |
|
| 1799 | - $calendarObjectIdQuery->andWhere($calendarObjectIdQuery->expr()->ilike('cob.value', $calendarObjectIdQuery->createNamedParameter('%' . $this->db->escapeLikeParameter($pattern) . '%'))); |
|
| 1800 | - } |
|
| 1801 | - } |
|
| 1802 | - |
|
| 1803 | - if (isset($options['limit'])) { |
|
| 1804 | - $calendarObjectIdQuery->setMaxResults($options['limit']); |
|
| 1805 | - } |
|
| 1806 | - if (isset($options['offset'])) { |
|
| 1807 | - $calendarObjectIdQuery->setFirstResult($options['offset']); |
|
| 1808 | - } |
|
| 1809 | - |
|
| 1810 | - $result = $calendarObjectIdQuery->executeQuery(); |
|
| 1811 | - $matches = $result->fetchAll(); |
|
| 1812 | - $result->closeCursor(); |
|
| 1813 | - $matches = array_map(static function (array $match):int { |
|
| 1814 | - return (int) $match['objectid']; |
|
| 1815 | - }, $matches); |
|
| 1816 | - |
|
| 1817 | - $query = $this->db->getQueryBuilder(); |
|
| 1818 | - $query->select('calendardata', 'uri', 'calendarid', 'calendartype') |
|
| 1819 | - ->from('calendarobjects') |
|
| 1820 | - ->where($query->expr()->in('id', $query->createNamedParameter($matches, IQueryBuilder::PARAM_INT_ARRAY))); |
|
| 1821 | - |
|
| 1822 | - $result = $query->executeQuery(); |
|
| 1823 | - $calendarObjects = $result->fetchAll(); |
|
| 1824 | - $result->closeCursor(); |
|
| 1825 | - |
|
| 1826 | - return array_map(function (array $array): array { |
|
| 1827 | - $array['calendarid'] = (int)$array['calendarid']; |
|
| 1828 | - $array['calendartype'] = (int)$array['calendartype']; |
|
| 1829 | - $array['calendardata'] = $this->readBlob($array['calendardata']); |
|
| 1830 | - |
|
| 1831 | - return $array; |
|
| 1832 | - }, $calendarObjects); |
|
| 1833 | - } |
|
| 1834 | - |
|
| 1835 | - /** |
|
| 1836 | - * Searches through all of a users calendars and calendar objects to find |
|
| 1837 | - * an object with a specific UID. |
|
| 1838 | - * |
|
| 1839 | - * This method should return the path to this object, relative to the |
|
| 1840 | - * calendar home, so this path usually only contains two parts: |
|
| 1841 | - * |
|
| 1842 | - * calendarpath/objectpath.ics |
|
| 1843 | - * |
|
| 1844 | - * If the uid is not found, return null. |
|
| 1845 | - * |
|
| 1846 | - * This method should only consider * objects that the principal owns, so |
|
| 1847 | - * any calendars owned by other principals that also appear in this |
|
| 1848 | - * collection should be ignored. |
|
| 1849 | - * |
|
| 1850 | - * @param string $principalUri |
|
| 1851 | - * @param string $uid |
|
| 1852 | - * @return string|null |
|
| 1853 | - */ |
|
| 1854 | - public function getCalendarObjectByUID($principalUri, $uid) { |
|
| 1855 | - $query = $this->db->getQueryBuilder(); |
|
| 1856 | - $query->selectAlias('c.uri', 'calendaruri')->selectAlias('co.uri', 'objecturi') |
|
| 1857 | - ->from('calendarobjects', 'co') |
|
| 1858 | - ->leftJoin('co', 'calendars', 'c', $query->expr()->eq('co.calendarid', 'c.id')) |
|
| 1859 | - ->where($query->expr()->eq('c.principaluri', $query->createNamedParameter($principalUri))) |
|
| 1860 | - ->andWhere($query->expr()->eq('co.uid', $query->createNamedParameter($uid))); |
|
| 1861 | - |
|
| 1862 | - $stmt = $query->executeQuery(); |
|
| 1863 | - $row = $stmt->fetch(); |
|
| 1864 | - $stmt->closeCursor(); |
|
| 1865 | - if ($row) { |
|
| 1866 | - return $row['calendaruri'] . '/' . $row['objecturi']; |
|
| 1867 | - } |
|
| 1868 | - |
|
| 1869 | - return null; |
|
| 1870 | - } |
|
| 1871 | - |
|
| 1872 | - /** |
|
| 1873 | - * The getChanges method returns all the changes that have happened, since |
|
| 1874 | - * the specified syncToken in the specified calendar. |
|
| 1875 | - * |
|
| 1876 | - * This function should return an array, such as the following: |
|
| 1877 | - * |
|
| 1878 | - * [ |
|
| 1879 | - * 'syncToken' => 'The current synctoken', |
|
| 1880 | - * 'added' => [ |
|
| 1881 | - * 'new.txt', |
|
| 1882 | - * ], |
|
| 1883 | - * 'modified' => [ |
|
| 1884 | - * 'modified.txt', |
|
| 1885 | - * ], |
|
| 1886 | - * 'deleted' => [ |
|
| 1887 | - * 'foo.php.bak', |
|
| 1888 | - * 'old.txt' |
|
| 1889 | - * ] |
|
| 1890 | - * ); |
|
| 1891 | - * |
|
| 1892 | - * The returned syncToken property should reflect the *current* syncToken |
|
| 1893 | - * of the calendar, as reported in the {http://sabredav.org/ns}sync-token |
|
| 1894 | - * property This is * needed here too, to ensure the operation is atomic. |
|
| 1895 | - * |
|
| 1896 | - * If the $syncToken argument is specified as null, this is an initial |
|
| 1897 | - * sync, and all members should be reported. |
|
| 1898 | - * |
|
| 1899 | - * The modified property is an array of nodenames that have changed since |
|
| 1900 | - * the last token. |
|
| 1901 | - * |
|
| 1902 | - * The deleted property is an array with nodenames, that have been deleted |
|
| 1903 | - * from collection. |
|
| 1904 | - * |
|
| 1905 | - * The $syncLevel argument is basically the 'depth' of the report. If it's |
|
| 1906 | - * 1, you only have to report changes that happened only directly in |
|
| 1907 | - * immediate descendants. If it's 2, it should also include changes from |
|
| 1908 | - * the nodes below the child collections. (grandchildren) |
|
| 1909 | - * |
|
| 1910 | - * The $limit argument allows a client to specify how many results should |
|
| 1911 | - * be returned at most. If the limit is not specified, it should be treated |
|
| 1912 | - * as infinite. |
|
| 1913 | - * |
|
| 1914 | - * If the limit (infinite or not) is higher than you're willing to return, |
|
| 1915 | - * you should throw a Sabre\DAV\Exception\TooMuchMatches() exception. |
|
| 1916 | - * |
|
| 1917 | - * If the syncToken is expired (due to data cleanup) or unknown, you must |
|
| 1918 | - * return null. |
|
| 1919 | - * |
|
| 1920 | - * The limit is 'suggestive'. You are free to ignore it. |
|
| 1921 | - * |
|
| 1922 | - * @param string $calendarId |
|
| 1923 | - * @param string $syncToken |
|
| 1924 | - * @param int $syncLevel |
|
| 1925 | - * @param int|null $limit |
|
| 1926 | - * @param int $calendarType |
|
| 1927 | - * @return array |
|
| 1928 | - */ |
|
| 1929 | - public function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null, $calendarType = self::CALENDAR_TYPE_CALENDAR) { |
|
| 1930 | - // Current synctoken |
|
| 1931 | - $qb = $this->db->getQueryBuilder(); |
|
| 1932 | - $qb->select('synctoken') |
|
| 1933 | - ->from('calendars') |
|
| 1934 | - ->where( |
|
| 1935 | - $qb->expr()->eq('id', $qb->createNamedParameter($calendarId)) |
|
| 1936 | - ); |
|
| 1937 | - $stmt = $qb->executeQuery(); |
|
| 1938 | - $currentToken = $stmt->fetchOne(); |
|
| 1939 | - |
|
| 1940 | - if ($currentToken === false) { |
|
| 1941 | - return null; |
|
| 1942 | - } |
|
| 1943 | - |
|
| 1944 | - $result = [ |
|
| 1945 | - 'syncToken' => $currentToken, |
|
| 1946 | - 'added' => [], |
|
| 1947 | - 'modified' => [], |
|
| 1948 | - 'deleted' => [], |
|
| 1949 | - ]; |
|
| 1950 | - |
|
| 1951 | - if ($syncToken) { |
|
| 1952 | - $qb = $this->db->getQueryBuilder(); |
|
| 1953 | - |
|
| 1954 | - $qb->select('uri', 'operation') |
|
| 1955 | - ->from('calendarchanges') |
|
| 1956 | - ->where( |
|
| 1957 | - $qb->expr()->andX( |
|
| 1958 | - $qb->expr()->gte('synctoken', $qb->createNamedParameter($syncToken)), |
|
| 1959 | - $qb->expr()->lt('synctoken', $qb->createNamedParameter($currentToken)), |
|
| 1960 | - $qb->expr()->eq('calendarid', $qb->createNamedParameter($calendarId)), |
|
| 1961 | - $qb->expr()->eq('calendartype', $qb->createNamedParameter($calendarType)) |
|
| 1962 | - ) |
|
| 1963 | - )->orderBy('synctoken'); |
|
| 1964 | - if (is_int($limit) && $limit > 0) { |
|
| 1965 | - $qb->setMaxResults($limit); |
|
| 1966 | - } |
|
| 1967 | - |
|
| 1968 | - // Fetching all changes |
|
| 1969 | - $stmt = $qb->executeQuery(); |
|
| 1970 | - $changes = []; |
|
| 1971 | - |
|
| 1972 | - // This loop ensures that any duplicates are overwritten, only the |
|
| 1973 | - // last change on a node is relevant. |
|
| 1974 | - while ($row = $stmt->fetch()) { |
|
| 1975 | - $changes[$row['uri']] = $row['operation']; |
|
| 1976 | - } |
|
| 1977 | - $stmt->closeCursor(); |
|
| 1978 | - |
|
| 1979 | - foreach ($changes as $uri => $operation) { |
|
| 1980 | - switch ($operation) { |
|
| 1981 | - case 1: |
|
| 1982 | - $result['added'][] = $uri; |
|
| 1983 | - break; |
|
| 1984 | - case 2: |
|
| 1985 | - $result['modified'][] = $uri; |
|
| 1986 | - break; |
|
| 1987 | - case 3: |
|
| 1988 | - $result['deleted'][] = $uri; |
|
| 1989 | - break; |
|
| 1990 | - } |
|
| 1991 | - } |
|
| 1992 | - } else { |
|
| 1993 | - // No synctoken supplied, this is the initial sync. |
|
| 1994 | - $qb = $this->db->getQueryBuilder(); |
|
| 1995 | - $qb->select('uri') |
|
| 1996 | - ->from('calendarobjects') |
|
| 1997 | - ->where( |
|
| 1998 | - $qb->expr()->andX( |
|
| 1999 | - $qb->expr()->eq('calendarid', $qb->createNamedParameter($calendarId)), |
|
| 2000 | - $qb->expr()->eq('calendartype', $qb->createNamedParameter($calendarType)) |
|
| 2001 | - ) |
|
| 2002 | - ); |
|
| 2003 | - $stmt = $qb->executeQuery(); |
|
| 2004 | - $result['added'] = $stmt->fetchAll(\PDO::FETCH_COLUMN); |
|
| 2005 | - $stmt->closeCursor(); |
|
| 2006 | - } |
|
| 2007 | - return $result; |
|
| 2008 | - } |
|
| 2009 | - |
|
| 2010 | - /** |
|
| 2011 | - * Returns a list of subscriptions for a principal. |
|
| 2012 | - * |
|
| 2013 | - * Every subscription is an array with the following keys: |
|
| 2014 | - * * id, a unique id that will be used by other functions to modify the |
|
| 2015 | - * subscription. This can be the same as the uri or a database key. |
|
| 2016 | - * * uri. This is just the 'base uri' or 'filename' of the subscription. |
|
| 2017 | - * * principaluri. The owner of the subscription. Almost always the same as |
|
| 2018 | - * principalUri passed to this method. |
|
| 2019 | - * |
|
| 2020 | - * Furthermore, all the subscription info must be returned too: |
|
| 2021 | - * |
|
| 2022 | - * 1. {DAV:}displayname |
|
| 2023 | - * 2. {http://apple.com/ns/ical/}refreshrate |
|
| 2024 | - * 3. {http://calendarserver.org/ns/}subscribed-strip-todos (omit if todos |
|
| 2025 | - * should not be stripped). |
|
| 2026 | - * 4. {http://calendarserver.org/ns/}subscribed-strip-alarms (omit if alarms |
|
| 2027 | - * should not be stripped). |
|
| 2028 | - * 5. {http://calendarserver.org/ns/}subscribed-strip-attachments (omit if |
|
| 2029 | - * attachments should not be stripped). |
|
| 2030 | - * 6. {http://calendarserver.org/ns/}source (Must be a |
|
| 2031 | - * Sabre\DAV\Property\Href). |
|
| 2032 | - * 7. {http://apple.com/ns/ical/}calendar-color |
|
| 2033 | - * 8. {http://apple.com/ns/ical/}calendar-order |
|
| 2034 | - * 9. {urn:ietf:params:xml:ns:caldav}supported-calendar-component-set |
|
| 2035 | - * (should just be an instance of |
|
| 2036 | - * Sabre\CalDAV\Property\SupportedCalendarComponentSet, with a bunch of |
|
| 2037 | - * default components). |
|
| 2038 | - * |
|
| 2039 | - * @param string $principalUri |
|
| 2040 | - * @return array |
|
| 2041 | - */ |
|
| 2042 | - public function getSubscriptionsForUser($principalUri) { |
|
| 2043 | - $fields = array_values($this->subscriptionPropertyMap); |
|
| 2044 | - $fields[] = 'id'; |
|
| 2045 | - $fields[] = 'uri'; |
|
| 2046 | - $fields[] = 'source'; |
|
| 2047 | - $fields[] = 'principaluri'; |
|
| 2048 | - $fields[] = 'lastmodified'; |
|
| 2049 | - $fields[] = 'synctoken'; |
|
| 2050 | - |
|
| 2051 | - $query = $this->db->getQueryBuilder(); |
|
| 2052 | - $query->select($fields) |
|
| 2053 | - ->from('calendarsubscriptions') |
|
| 2054 | - ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))) |
|
| 2055 | - ->orderBy('calendarorder', 'asc'); |
|
| 2056 | - $stmt = $query->executeQuery(); |
|
| 2057 | - |
|
| 2058 | - $subscriptions = []; |
|
| 2059 | - while ($row = $stmt->fetch()) { |
|
| 2060 | - $subscription = [ |
|
| 2061 | - 'id' => $row['id'], |
|
| 2062 | - 'uri' => $row['uri'], |
|
| 2063 | - 'principaluri' => $row['principaluri'], |
|
| 2064 | - 'source' => $row['source'], |
|
| 2065 | - 'lastmodified' => $row['lastmodified'], |
|
| 2066 | - |
|
| 2067 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
| 2068 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 2069 | - ]; |
|
| 2070 | - |
|
| 2071 | - foreach ($this->subscriptionPropertyMap as $xmlName => $dbName) { |
|
| 2072 | - if (!is_null($row[$dbName])) { |
|
| 2073 | - $subscription[$xmlName] = $row[$dbName]; |
|
| 2074 | - } |
|
| 2075 | - } |
|
| 2076 | - |
|
| 2077 | - $subscriptions[] = $subscription; |
|
| 2078 | - } |
|
| 2079 | - |
|
| 2080 | - return $subscriptions; |
|
| 2081 | - } |
|
| 2082 | - |
|
| 2083 | - /** |
|
| 2084 | - * Creates a new subscription for a principal. |
|
| 2085 | - * |
|
| 2086 | - * If the creation was a success, an id must be returned that can be used to reference |
|
| 2087 | - * this subscription in other methods, such as updateSubscription. |
|
| 2088 | - * |
|
| 2089 | - * @param string $principalUri |
|
| 2090 | - * @param string $uri |
|
| 2091 | - * @param array $properties |
|
| 2092 | - * @return mixed |
|
| 2093 | - */ |
|
| 2094 | - public function createSubscription($principalUri, $uri, array $properties) { |
|
| 2095 | - if (!isset($properties['{http://calendarserver.org/ns/}source'])) { |
|
| 2096 | - throw new Forbidden('The {http://calendarserver.org/ns/}source property is required when creating subscriptions'); |
|
| 2097 | - } |
|
| 2098 | - |
|
| 2099 | - $values = [ |
|
| 2100 | - 'principaluri' => $principalUri, |
|
| 2101 | - 'uri' => $uri, |
|
| 2102 | - 'source' => $properties['{http://calendarserver.org/ns/}source']->getHref(), |
|
| 2103 | - 'lastmodified' => time(), |
|
| 2104 | - ]; |
|
| 2105 | - |
|
| 2106 | - $propertiesBoolean = ['striptodos', 'stripalarms', 'stripattachments']; |
|
| 2107 | - |
|
| 2108 | - foreach ($this->subscriptionPropertyMap as $xmlName => $dbName) { |
|
| 2109 | - if (array_key_exists($xmlName, $properties)) { |
|
| 2110 | - $values[$dbName] = $properties[$xmlName]; |
|
| 2111 | - if (in_array($dbName, $propertiesBoolean)) { |
|
| 2112 | - $values[$dbName] = true; |
|
| 2113 | - } |
|
| 2114 | - } |
|
| 2115 | - } |
|
| 2116 | - |
|
| 2117 | - $valuesToInsert = []; |
|
| 2118 | - |
|
| 2119 | - $query = $this->db->getQueryBuilder(); |
|
| 2120 | - |
|
| 2121 | - foreach (array_keys($values) as $name) { |
|
| 2122 | - $valuesToInsert[$name] = $query->createNamedParameter($values[$name]); |
|
| 2123 | - } |
|
| 2124 | - |
|
| 2125 | - $query->insert('calendarsubscriptions') |
|
| 2126 | - ->values($valuesToInsert) |
|
| 2127 | - ->executeStatement(); |
|
| 2128 | - |
|
| 2129 | - $subscriptionId = $query->getLastInsertId(); |
|
| 2130 | - |
|
| 2131 | - $subscriptionRow = $this->getSubscriptionById($subscriptionId); |
|
| 2132 | - $this->dispatcher->dispatchTyped(new SubscriptionCreatedEvent($subscriptionId, $subscriptionRow)); |
|
| 2133 | - $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::createSubscription', new GenericEvent( |
|
| 2134 | - '\OCA\DAV\CalDAV\CalDavBackend::createSubscription', |
|
| 2135 | - [ |
|
| 2136 | - 'subscriptionId' => $subscriptionId, |
|
| 2137 | - 'subscriptionData' => $subscriptionRow, |
|
| 2138 | - ])); |
|
| 2139 | - |
|
| 2140 | - return $subscriptionId; |
|
| 2141 | - } |
|
| 2142 | - |
|
| 2143 | - /** |
|
| 2144 | - * Updates a subscription |
|
| 2145 | - * |
|
| 2146 | - * The list of mutations is stored in a Sabre\DAV\PropPatch object. |
|
| 2147 | - * To do the actual updates, you must tell this object which properties |
|
| 2148 | - * you're going to process with the handle() method. |
|
| 2149 | - * |
|
| 2150 | - * Calling the handle method is like telling the PropPatch object "I |
|
| 2151 | - * promise I can handle updating this property". |
|
| 2152 | - * |
|
| 2153 | - * Read the PropPatch documentation for more info and examples. |
|
| 2154 | - * |
|
| 2155 | - * @param mixed $subscriptionId |
|
| 2156 | - * @param PropPatch $propPatch |
|
| 2157 | - * @return void |
|
| 2158 | - */ |
|
| 2159 | - public function updateSubscription($subscriptionId, PropPatch $propPatch) { |
|
| 2160 | - $supportedProperties = array_keys($this->subscriptionPropertyMap); |
|
| 2161 | - $supportedProperties[] = '{http://calendarserver.org/ns/}source'; |
|
| 2162 | - |
|
| 2163 | - $propPatch->handle($supportedProperties, function ($mutations) use ($subscriptionId) { |
|
| 2164 | - $newValues = []; |
|
| 2165 | - |
|
| 2166 | - foreach ($mutations as $propertyName => $propertyValue) { |
|
| 2167 | - if ($propertyName === '{http://calendarserver.org/ns/}source') { |
|
| 2168 | - $newValues['source'] = $propertyValue->getHref(); |
|
| 2169 | - } else { |
|
| 2170 | - $fieldName = $this->subscriptionPropertyMap[$propertyName]; |
|
| 2171 | - $newValues[$fieldName] = $propertyValue; |
|
| 2172 | - } |
|
| 2173 | - } |
|
| 2174 | - |
|
| 2175 | - $query = $this->db->getQueryBuilder(); |
|
| 2176 | - $query->update('calendarsubscriptions') |
|
| 2177 | - ->set('lastmodified', $query->createNamedParameter(time())); |
|
| 2178 | - foreach ($newValues as $fieldName => $value) { |
|
| 2179 | - $query->set($fieldName, $query->createNamedParameter($value)); |
|
| 2180 | - } |
|
| 2181 | - $query->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId))) |
|
| 2182 | - ->executeStatement(); |
|
| 2183 | - |
|
| 2184 | - $subscriptionRow = $this->getSubscriptionById($subscriptionId); |
|
| 2185 | - $this->dispatcher->dispatchTyped(new SubscriptionUpdatedEvent((int)$subscriptionId, $subscriptionRow, [], $mutations)); |
|
| 2186 | - $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateSubscription', new GenericEvent( |
|
| 2187 | - '\OCA\DAV\CalDAV\CalDavBackend::updateSubscription', |
|
| 2188 | - [ |
|
| 2189 | - 'subscriptionId' => $subscriptionId, |
|
| 2190 | - 'subscriptionData' => $subscriptionRow, |
|
| 2191 | - 'propertyMutations' => $mutations, |
|
| 2192 | - ])); |
|
| 2193 | - |
|
| 2194 | - return true; |
|
| 2195 | - }); |
|
| 2196 | - } |
|
| 2197 | - |
|
| 2198 | - /** |
|
| 2199 | - * Deletes a subscription. |
|
| 2200 | - * |
|
| 2201 | - * @param mixed $subscriptionId |
|
| 2202 | - * @return void |
|
| 2203 | - */ |
|
| 2204 | - public function deleteSubscription($subscriptionId) { |
|
| 2205 | - $subscriptionRow = $this->getSubscriptionById($subscriptionId); |
|
| 2206 | - |
|
| 2207 | - $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::deleteSubscription', new GenericEvent( |
|
| 2208 | - '\OCA\DAV\CalDAV\CalDavBackend::deleteSubscription', |
|
| 2209 | - [ |
|
| 2210 | - 'subscriptionId' => $subscriptionId, |
|
| 2211 | - 'subscriptionData' => $this->getSubscriptionById($subscriptionId), |
|
| 2212 | - ])); |
|
| 2213 | - |
|
| 2214 | - $query = $this->db->getQueryBuilder(); |
|
| 2215 | - $query->delete('calendarsubscriptions') |
|
| 2216 | - ->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId))) |
|
| 2217 | - ->executeStatement(); |
|
| 2218 | - |
|
| 2219 | - $query = $this->db->getQueryBuilder(); |
|
| 2220 | - $query->delete('calendarobjects') |
|
| 2221 | - ->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId))) |
|
| 2222 | - ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION))) |
|
| 2223 | - ->executeStatement(); |
|
| 2224 | - |
|
| 2225 | - $query->delete('calendarchanges') |
|
| 2226 | - ->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId))) |
|
| 2227 | - ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION))) |
|
| 2228 | - ->executeStatement(); |
|
| 2229 | - |
|
| 2230 | - $query->delete($this->dbObjectPropertiesTable) |
|
| 2231 | - ->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId))) |
|
| 2232 | - ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION))) |
|
| 2233 | - ->executeStatement(); |
|
| 2234 | - |
|
| 2235 | - if ($subscriptionRow) { |
|
| 2236 | - $this->dispatcher->dispatchTyped(new SubscriptionDeletedEvent((int)$subscriptionId, $subscriptionRow, [])); |
|
| 2237 | - } |
|
| 2238 | - } |
|
| 2239 | - |
|
| 2240 | - /** |
|
| 2241 | - * Returns a single scheduling object for the inbox collection. |
|
| 2242 | - * |
|
| 2243 | - * The returned array should contain the following elements: |
|
| 2244 | - * * uri - A unique basename for the object. This will be used to |
|
| 2245 | - * construct a full uri. |
|
| 2246 | - * * calendardata - The iCalendar object |
|
| 2247 | - * * lastmodified - The last modification date. Can be an int for a unix |
|
| 2248 | - * timestamp, or a PHP DateTime object. |
|
| 2249 | - * * etag - A unique token that must change if the object changed. |
|
| 2250 | - * * size - The size of the object, in bytes. |
|
| 2251 | - * |
|
| 2252 | - * @param string $principalUri |
|
| 2253 | - * @param string $objectUri |
|
| 2254 | - * @return array |
|
| 2255 | - */ |
|
| 2256 | - public function getSchedulingObject($principalUri, $objectUri) { |
|
| 2257 | - $query = $this->db->getQueryBuilder(); |
|
| 2258 | - $stmt = $query->select(['uri', 'calendardata', 'lastmodified', 'etag', 'size']) |
|
| 2259 | - ->from('schedulingobjects') |
|
| 2260 | - ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))) |
|
| 2261 | - ->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri))) |
|
| 2262 | - ->executeQuery(); |
|
| 2263 | - |
|
| 2264 | - $row = $stmt->fetch(); |
|
| 2265 | - |
|
| 2266 | - if (!$row) { |
|
| 2267 | - return null; |
|
| 2268 | - } |
|
| 2269 | - |
|
| 2270 | - return [ |
|
| 2271 | - 'uri' => $row['uri'], |
|
| 2272 | - 'calendardata' => $row['calendardata'], |
|
| 2273 | - 'lastmodified' => $row['lastmodified'], |
|
| 2274 | - 'etag' => '"' . $row['etag'] . '"', |
|
| 2275 | - 'size' => (int)$row['size'], |
|
| 2276 | - ]; |
|
| 2277 | - } |
|
| 2278 | - |
|
| 2279 | - /** |
|
| 2280 | - * Returns all scheduling objects for the inbox collection. |
|
| 2281 | - * |
|
| 2282 | - * These objects should be returned as an array. Every item in the array |
|
| 2283 | - * should follow the same structure as returned from getSchedulingObject. |
|
| 2284 | - * |
|
| 2285 | - * The main difference is that 'calendardata' is optional. |
|
| 2286 | - * |
|
| 2287 | - * @param string $principalUri |
|
| 2288 | - * @return array |
|
| 2289 | - */ |
|
| 2290 | - public function getSchedulingObjects($principalUri) { |
|
| 2291 | - $query = $this->db->getQueryBuilder(); |
|
| 2292 | - $stmt = $query->select(['uri', 'calendardata', 'lastmodified', 'etag', 'size']) |
|
| 2293 | - ->from('schedulingobjects') |
|
| 2294 | - ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))) |
|
| 2295 | - ->executeQuery(); |
|
| 2296 | - |
|
| 2297 | - $result = []; |
|
| 2298 | - foreach ($stmt->fetchAll() as $row) { |
|
| 2299 | - $result[] = [ |
|
| 2300 | - 'calendardata' => $row['calendardata'], |
|
| 2301 | - 'uri' => $row['uri'], |
|
| 2302 | - 'lastmodified' => $row['lastmodified'], |
|
| 2303 | - 'etag' => '"' . $row['etag'] . '"', |
|
| 2304 | - 'size' => (int)$row['size'], |
|
| 2305 | - ]; |
|
| 2306 | - } |
|
| 2307 | - |
|
| 2308 | - return $result; |
|
| 2309 | - } |
|
| 2310 | - |
|
| 2311 | - /** |
|
| 2312 | - * Deletes a scheduling object from the inbox collection. |
|
| 2313 | - * |
|
| 2314 | - * @param string $principalUri |
|
| 2315 | - * @param string $objectUri |
|
| 2316 | - * @return void |
|
| 2317 | - */ |
|
| 2318 | - public function deleteSchedulingObject($principalUri, $objectUri) { |
|
| 2319 | - $query = $this->db->getQueryBuilder(); |
|
| 2320 | - $query->delete('schedulingobjects') |
|
| 2321 | - ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))) |
|
| 2322 | - ->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri))) |
|
| 2323 | - ->executeStatement(); |
|
| 2324 | - } |
|
| 2325 | - |
|
| 2326 | - /** |
|
| 2327 | - * Creates a new scheduling object. This should land in a users' inbox. |
|
| 2328 | - * |
|
| 2329 | - * @param string $principalUri |
|
| 2330 | - * @param string $objectUri |
|
| 2331 | - * @param string $objectData |
|
| 2332 | - * @return void |
|
| 2333 | - */ |
|
| 2334 | - public function createSchedulingObject($principalUri, $objectUri, $objectData) { |
|
| 2335 | - $query = $this->db->getQueryBuilder(); |
|
| 2336 | - $query->insert('schedulingobjects') |
|
| 2337 | - ->values([ |
|
| 2338 | - 'principaluri' => $query->createNamedParameter($principalUri), |
|
| 2339 | - 'calendardata' => $query->createNamedParameter($objectData, IQueryBuilder::PARAM_LOB), |
|
| 2340 | - 'uri' => $query->createNamedParameter($objectUri), |
|
| 2341 | - 'lastmodified' => $query->createNamedParameter(time()), |
|
| 2342 | - 'etag' => $query->createNamedParameter(md5($objectData)), |
|
| 2343 | - 'size' => $query->createNamedParameter(strlen($objectData)) |
|
| 2344 | - ]) |
|
| 2345 | - ->executeStatement(); |
|
| 2346 | - } |
|
| 2347 | - |
|
| 2348 | - /** |
|
| 2349 | - * Adds a change record to the calendarchanges table. |
|
| 2350 | - * |
|
| 2351 | - * @param mixed $calendarId |
|
| 2352 | - * @param string $objectUri |
|
| 2353 | - * @param int $operation 1 = add, 2 = modify, 3 = delete. |
|
| 2354 | - * @param int $calendarType |
|
| 2355 | - * @return void |
|
| 2356 | - */ |
|
| 2357 | - protected function addChange($calendarId, $objectUri, $operation, $calendarType = self::CALENDAR_TYPE_CALENDAR) { |
|
| 2358 | - $table = $calendarType === self::CALENDAR_TYPE_CALENDAR ? 'calendars': 'calendarsubscriptions'; |
|
| 2359 | - |
|
| 2360 | - $query = $this->db->getQueryBuilder(); |
|
| 2361 | - $query->select('synctoken') |
|
| 2362 | - ->from($table) |
|
| 2363 | - ->where($query->expr()->eq('id', $query->createNamedParameter($calendarId))); |
|
| 2364 | - $result = $query->executeQuery(); |
|
| 2365 | - $syncToken = (int)$result->fetchOne(); |
|
| 2366 | - $result->closeCursor(); |
|
| 2367 | - |
|
| 2368 | - $query = $this->db->getQueryBuilder(); |
|
| 2369 | - $query->insert('calendarchanges') |
|
| 2370 | - ->values([ |
|
| 2371 | - 'uri' => $query->createNamedParameter($objectUri), |
|
| 2372 | - 'synctoken' => $query->createNamedParameter($syncToken), |
|
| 2373 | - 'calendarid' => $query->createNamedParameter($calendarId), |
|
| 2374 | - 'operation' => $query->createNamedParameter($operation), |
|
| 2375 | - 'calendartype' => $query->createNamedParameter($calendarType), |
|
| 2376 | - ]) |
|
| 2377 | - ->executeStatement(); |
|
| 2378 | - |
|
| 2379 | - $stmt = $this->db->prepare("UPDATE `*PREFIX*$table` SET `synctoken` = `synctoken` + 1 WHERE `id` = ?"); |
|
| 2380 | - $stmt->execute([ |
|
| 2381 | - $calendarId |
|
| 2382 | - ]); |
|
| 2383 | - } |
|
| 2384 | - |
|
| 2385 | - /** |
|
| 2386 | - * Parses some information from calendar objects, used for optimized |
|
| 2387 | - * calendar-queries. |
|
| 2388 | - * |
|
| 2389 | - * Returns an array with the following keys: |
|
| 2390 | - * * etag - An md5 checksum of the object without the quotes. |
|
| 2391 | - * * size - Size of the object in bytes |
|
| 2392 | - * * componentType - VEVENT, VTODO or VJOURNAL |
|
| 2393 | - * * firstOccurence |
|
| 2394 | - * * lastOccurence |
|
| 2395 | - * * uid - value of the UID property |
|
| 2396 | - * |
|
| 2397 | - * @param string $calendarData |
|
| 2398 | - * @return array |
|
| 2399 | - */ |
|
| 2400 | - public function getDenormalizedData($calendarData) { |
|
| 2401 | - $vObject = Reader::read($calendarData); |
|
| 2402 | - $vEvents = []; |
|
| 2403 | - $componentType = null; |
|
| 2404 | - $component = null; |
|
| 2405 | - $firstOccurrence = null; |
|
| 2406 | - $lastOccurrence = null; |
|
| 2407 | - $uid = null; |
|
| 2408 | - $classification = self::CLASSIFICATION_PUBLIC; |
|
| 2409 | - $hasDTSTART = false; |
|
| 2410 | - foreach ($vObject->getComponents() as $component) { |
|
| 2411 | - if ($component->name !== 'VTIMEZONE') { |
|
| 2412 | - // Finding all VEVENTs, and track them |
|
| 2413 | - if ($component->name === 'VEVENT') { |
|
| 2414 | - array_push($vEvents, $component); |
|
| 2415 | - if ($component->DTSTART) { |
|
| 2416 | - $hasDTSTART = true; |
|
| 2417 | - } |
|
| 2418 | - } |
|
| 2419 | - // Track first component type and uid |
|
| 2420 | - if ($uid === null) { |
|
| 2421 | - $componentType = $component->name; |
|
| 2422 | - $uid = (string)$component->UID; |
|
| 2423 | - } |
|
| 2424 | - } |
|
| 2425 | - } |
|
| 2426 | - if (!$componentType) { |
|
| 2427 | - throw new \Sabre\DAV\Exception\BadRequest('Calendar objects must have a VJOURNAL, VEVENT or VTODO component'); |
|
| 2428 | - } |
|
| 2429 | - |
|
| 2430 | - if ($hasDTSTART) { |
|
| 2431 | - $component = $vEvents[0]; |
|
| 2432 | - |
|
| 2433 | - // Finding the last occurrence is a bit harder |
|
| 2434 | - if (!isset($component->RRULE) && count($vEvents) === 1) { |
|
| 2435 | - $firstOccurrence = $component->DTSTART->getDateTime()->getTimeStamp(); |
|
| 2436 | - if (isset($component->DTEND)) { |
|
| 2437 | - $lastOccurrence = $component->DTEND->getDateTime()->getTimeStamp(); |
|
| 2438 | - } elseif (isset($component->DURATION)) { |
|
| 2439 | - $endDate = clone $component->DTSTART->getDateTime(); |
|
| 2440 | - $endDate->add(DateTimeParser::parse($component->DURATION->getValue())); |
|
| 2441 | - $lastOccurrence = $endDate->getTimeStamp(); |
|
| 2442 | - } elseif (!$component->DTSTART->hasTime()) { |
|
| 2443 | - $endDate = clone $component->DTSTART->getDateTime(); |
|
| 2444 | - $endDate->modify('+1 day'); |
|
| 2445 | - $lastOccurrence = $endDate->getTimeStamp(); |
|
| 2446 | - } else { |
|
| 2447 | - $lastOccurrence = $firstOccurrence; |
|
| 2448 | - } |
|
| 2449 | - } else { |
|
| 2450 | - $it = new EventIterator($vEvents); |
|
| 2451 | - $maxDate = new DateTime(self::MAX_DATE); |
|
| 2452 | - $firstOccurrence = $it->getDtStart()->getTimestamp(); |
|
| 2453 | - if ($it->isInfinite()) { |
|
| 2454 | - $lastOccurrence = $maxDate->getTimestamp(); |
|
| 2455 | - } else { |
|
| 2456 | - $end = $it->getDtEnd(); |
|
| 2457 | - while ($it->valid() && $end < $maxDate) { |
|
| 2458 | - $end = $it->getDtEnd(); |
|
| 2459 | - $it->next(); |
|
| 2460 | - } |
|
| 2461 | - $lastOccurrence = $end->getTimestamp(); |
|
| 2462 | - } |
|
| 2463 | - } |
|
| 2464 | - } |
|
| 2465 | - |
|
| 2466 | - if ($component->CLASS) { |
|
| 2467 | - $classification = CalDavBackend::CLASSIFICATION_PRIVATE; |
|
| 2468 | - switch ($component->CLASS->getValue()) { |
|
| 2469 | - case 'PUBLIC': |
|
| 2470 | - $classification = CalDavBackend::CLASSIFICATION_PUBLIC; |
|
| 2471 | - break; |
|
| 2472 | - case 'CONFIDENTIAL': |
|
| 2473 | - $classification = CalDavBackend::CLASSIFICATION_CONFIDENTIAL; |
|
| 2474 | - break; |
|
| 2475 | - } |
|
| 2476 | - } |
|
| 2477 | - return [ |
|
| 2478 | - 'etag' => md5($calendarData), |
|
| 2479 | - 'size' => strlen($calendarData), |
|
| 2480 | - 'componentType' => $componentType, |
|
| 2481 | - 'firstOccurence' => is_null($firstOccurrence) ? null : max(0, $firstOccurrence), |
|
| 2482 | - 'lastOccurence' => $lastOccurrence, |
|
| 2483 | - 'uid' => $uid, |
|
| 2484 | - 'classification' => $classification |
|
| 2485 | - ]; |
|
| 2486 | - } |
|
| 2487 | - |
|
| 2488 | - /** |
|
| 2489 | - * @param $cardData |
|
| 2490 | - * @return bool|string |
|
| 2491 | - */ |
|
| 2492 | - private function readBlob($cardData) { |
|
| 2493 | - if (is_resource($cardData)) { |
|
| 2494 | - return stream_get_contents($cardData); |
|
| 2495 | - } |
|
| 2496 | - |
|
| 2497 | - return $cardData; |
|
| 2498 | - } |
|
| 2499 | - |
|
| 2500 | - /** |
|
| 2501 | - * @param IShareable $shareable |
|
| 2502 | - * @param array $add |
|
| 2503 | - * @param array $remove |
|
| 2504 | - */ |
|
| 2505 | - public function updateShares($shareable, $add, $remove) { |
|
| 2506 | - $calendarId = $shareable->getResourceId(); |
|
| 2507 | - $calendarRow = $this->getCalendarById($calendarId); |
|
| 2508 | - $oldShares = $this->getShares($calendarId); |
|
| 2509 | - |
|
| 2510 | - $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateShares', new GenericEvent( |
|
| 2511 | - '\OCA\DAV\CalDAV\CalDavBackend::updateShares', |
|
| 2512 | - [ |
|
| 2513 | - 'calendarId' => $calendarId, |
|
| 2514 | - 'calendarData' => $calendarRow, |
|
| 2515 | - 'shares' => $oldShares, |
|
| 2516 | - 'add' => $add, |
|
| 2517 | - 'remove' => $remove, |
|
| 2518 | - ])); |
|
| 2519 | - $this->calendarSharingBackend->updateShares($shareable, $add, $remove); |
|
| 2520 | - |
|
| 2521 | - $this->dispatcher->dispatchTyped(new CalendarShareUpdatedEvent((int)$calendarId, $calendarRow, $oldShares, $add, $remove)); |
|
| 2522 | - } |
|
| 2523 | - |
|
| 2524 | - /** |
|
| 2525 | - * @param int $resourceId |
|
| 2526 | - * @return array |
|
| 2527 | - */ |
|
| 2528 | - public function getShares($resourceId) { |
|
| 2529 | - return $this->calendarSharingBackend->getShares($resourceId); |
|
| 2530 | - } |
|
| 2531 | - |
|
| 2532 | - /** |
|
| 2533 | - * @param boolean $value |
|
| 2534 | - * @param \OCA\DAV\CalDAV\Calendar $calendar |
|
| 2535 | - * @return string|null |
|
| 2536 | - */ |
|
| 2537 | - public function setPublishStatus($value, $calendar) { |
|
| 2538 | - $calendarId = $calendar->getResourceId(); |
|
| 2539 | - $calendarData = $this->getCalendarById($calendarId); |
|
| 2540 | - $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::publishCalendar', new GenericEvent( |
|
| 2541 | - '\OCA\DAV\CalDAV\CalDavBackend::updateShares', |
|
| 2542 | - [ |
|
| 2543 | - 'calendarId' => $calendarId, |
|
| 2544 | - 'calendarData' => $calendarData, |
|
| 2545 | - 'public' => $value, |
|
| 2546 | - ])); |
|
| 2547 | - |
|
| 2548 | - $query = $this->db->getQueryBuilder(); |
|
| 2549 | - if ($value) { |
|
| 2550 | - $publicUri = $this->random->generate(16, ISecureRandom::CHAR_HUMAN_READABLE); |
|
| 2551 | - $query->insert('dav_shares') |
|
| 2552 | - ->values([ |
|
| 2553 | - 'principaluri' => $query->createNamedParameter($calendar->getPrincipalURI()), |
|
| 2554 | - 'type' => $query->createNamedParameter('calendar'), |
|
| 2555 | - 'access' => $query->createNamedParameter(self::ACCESS_PUBLIC), |
|
| 2556 | - 'resourceid' => $query->createNamedParameter($calendar->getResourceId()), |
|
| 2557 | - 'publicuri' => $query->createNamedParameter($publicUri) |
|
| 2558 | - ]); |
|
| 2559 | - $query->executeStatement(); |
|
| 2560 | - |
|
| 2561 | - $this->dispatcher->dispatchTyped(new CalendarPublishedEvent((int)$calendarId, $calendarData, $publicUri)); |
|
| 2562 | - return $publicUri; |
|
| 2563 | - } |
|
| 2564 | - $query->delete('dav_shares') |
|
| 2565 | - ->where($query->expr()->eq('resourceid', $query->createNamedParameter($calendar->getResourceId()))) |
|
| 2566 | - ->andWhere($query->expr()->eq('access', $query->createNamedParameter(self::ACCESS_PUBLIC))); |
|
| 2567 | - $query->executeStatement(); |
|
| 2568 | - |
|
| 2569 | - $this->dispatcher->dispatchTyped(new CalendarUnpublishedEvent((int)$calendarId, $calendarData)); |
|
| 2570 | - return null; |
|
| 2571 | - } |
|
| 2572 | - |
|
| 2573 | - /** |
|
| 2574 | - * @param \OCA\DAV\CalDAV\Calendar $calendar |
|
| 2575 | - * @return mixed |
|
| 2576 | - */ |
|
| 2577 | - public function getPublishStatus($calendar) { |
|
| 2578 | - $query = $this->db->getQueryBuilder(); |
|
| 2579 | - $result = $query->select('publicuri') |
|
| 2580 | - ->from('dav_shares') |
|
| 2581 | - ->where($query->expr()->eq('resourceid', $query->createNamedParameter($calendar->getResourceId()))) |
|
| 2582 | - ->andWhere($query->expr()->eq('access', $query->createNamedParameter(self::ACCESS_PUBLIC))) |
|
| 2583 | - ->executeQuery(); |
|
| 2584 | - |
|
| 2585 | - $row = $result->fetch(); |
|
| 2586 | - $result->closeCursor(); |
|
| 2587 | - return $row ? reset($row) : false; |
|
| 2588 | - } |
|
| 2589 | - |
|
| 2590 | - /** |
|
| 2591 | - * @param int $resourceId |
|
| 2592 | - * @param array $acl |
|
| 2593 | - * @return array |
|
| 2594 | - */ |
|
| 2595 | - public function applyShareAcl($resourceId, $acl) { |
|
| 2596 | - return $this->calendarSharingBackend->applyShareAcl($resourceId, $acl); |
|
| 2597 | - } |
|
| 2598 | - |
|
| 2599 | - |
|
| 2600 | - |
|
| 2601 | - /** |
|
| 2602 | - * update properties table |
|
| 2603 | - * |
|
| 2604 | - * @param int $calendarId |
|
| 2605 | - * @param string $objectUri |
|
| 2606 | - * @param string $calendarData |
|
| 2607 | - * @param int $calendarType |
|
| 2608 | - */ |
|
| 2609 | - public function updateProperties($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) { |
|
| 2610 | - $objectId = $this->getCalendarObjectId($calendarId, $objectUri, $calendarType); |
|
| 2611 | - |
|
| 2612 | - try { |
|
| 2613 | - $vCalendar = $this->readCalendarData($calendarData); |
|
| 2614 | - } catch (\Exception $ex) { |
|
| 2615 | - return; |
|
| 2616 | - } |
|
| 2617 | - |
|
| 2618 | - $this->purgeProperties($calendarId, $objectId); |
|
| 2619 | - |
|
| 2620 | - $query = $this->db->getQueryBuilder(); |
|
| 2621 | - $query->insert($this->dbObjectPropertiesTable) |
|
| 2622 | - ->values( |
|
| 2623 | - [ |
|
| 2624 | - 'calendarid' => $query->createNamedParameter($calendarId), |
|
| 2625 | - 'calendartype' => $query->createNamedParameter($calendarType), |
|
| 2626 | - 'objectid' => $query->createNamedParameter($objectId), |
|
| 2627 | - 'name' => $query->createParameter('name'), |
|
| 2628 | - 'parameter' => $query->createParameter('parameter'), |
|
| 2629 | - 'value' => $query->createParameter('value'), |
|
| 2630 | - ] |
|
| 2631 | - ); |
|
| 2632 | - |
|
| 2633 | - $indexComponents = ['VEVENT', 'VJOURNAL', 'VTODO']; |
|
| 2634 | - foreach ($vCalendar->getComponents() as $component) { |
|
| 2635 | - if (!in_array($component->name, $indexComponents)) { |
|
| 2636 | - continue; |
|
| 2637 | - } |
|
| 2638 | - |
|
| 2639 | - foreach ($component->children() as $property) { |
|
| 2640 | - if (in_array($property->name, self::$indexProperties)) { |
|
| 2641 | - $value = $property->getValue(); |
|
| 2642 | - // is this a shitty db? |
|
| 2643 | - if (!$this->db->supports4ByteText()) { |
|
| 2644 | - $value = preg_replace('/[\x{10000}-\x{10FFFF}]/u', "\xEF\xBF\xBD", $value); |
|
| 2645 | - } |
|
| 2646 | - $value = mb_strcut($value, 0, 254); |
|
| 2647 | - |
|
| 2648 | - $query->setParameter('name', $property->name); |
|
| 2649 | - $query->setParameter('parameter', null); |
|
| 2650 | - $query->setParameter('value', $value); |
|
| 2651 | - $query->executeStatement(); |
|
| 2652 | - } |
|
| 2653 | - |
|
| 2654 | - if (array_key_exists($property->name, self::$indexParameters)) { |
|
| 2655 | - $parameters = $property->parameters(); |
|
| 2656 | - $indexedParametersForProperty = self::$indexParameters[$property->name]; |
|
| 2657 | - |
|
| 2658 | - foreach ($parameters as $key => $value) { |
|
| 2659 | - if (in_array($key, $indexedParametersForProperty)) { |
|
| 2660 | - // is this a shitty db? |
|
| 2661 | - if ($this->db->supports4ByteText()) { |
|
| 2662 | - $value = preg_replace('/[\x{10000}-\x{10FFFF}]/u', "\xEF\xBF\xBD", $value); |
|
| 2663 | - } |
|
| 2664 | - |
|
| 2665 | - $query->setParameter('name', $property->name); |
|
| 2666 | - $query->setParameter('parameter', mb_strcut($key, 0, 254)); |
|
| 2667 | - $query->setParameter('value', mb_strcut($value, 0, 254)); |
|
| 2668 | - $query->executeStatement(); |
|
| 2669 | - } |
|
| 2670 | - } |
|
| 2671 | - } |
|
| 2672 | - } |
|
| 2673 | - } |
|
| 2674 | - } |
|
| 2675 | - |
|
| 2676 | - /** |
|
| 2677 | - * deletes all birthday calendars |
|
| 2678 | - */ |
|
| 2679 | - public function deleteAllBirthdayCalendars() { |
|
| 2680 | - $query = $this->db->getQueryBuilder(); |
|
| 2681 | - $result = $query->select(['id'])->from('calendars') |
|
| 2682 | - ->where($query->expr()->eq('uri', $query->createNamedParameter(BirthdayService::BIRTHDAY_CALENDAR_URI))) |
|
| 2683 | - ->executeQuery(); |
|
| 2684 | - |
|
| 2685 | - $ids = $result->fetchAll(); |
|
| 2686 | - foreach ($ids as $id) { |
|
| 2687 | - $this->deleteCalendar($id['id']); |
|
| 2688 | - } |
|
| 2689 | - } |
|
| 2690 | - |
|
| 2691 | - /** |
|
| 2692 | - * @param $subscriptionId |
|
| 2693 | - */ |
|
| 2694 | - public function purgeAllCachedEventsForSubscription($subscriptionId) { |
|
| 2695 | - $query = $this->db->getQueryBuilder(); |
|
| 2696 | - $query->select('uri') |
|
| 2697 | - ->from('calendarobjects') |
|
| 2698 | - ->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId))) |
|
| 2699 | - ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION))); |
|
| 2700 | - $stmt = $query->executeQuery(); |
|
| 2701 | - |
|
| 2702 | - $uris = []; |
|
| 2703 | - foreach ($stmt->fetchAll() as $row) { |
|
| 2704 | - $uris[] = $row['uri']; |
|
| 2705 | - } |
|
| 2706 | - $stmt->closeCursor(); |
|
| 2707 | - |
|
| 2708 | - $query = $this->db->getQueryBuilder(); |
|
| 2709 | - $query->delete('calendarobjects') |
|
| 2710 | - ->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId))) |
|
| 2711 | - ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION))) |
|
| 2712 | - ->executeStatement(); |
|
| 2713 | - |
|
| 2714 | - $query->delete('calendarchanges') |
|
| 2715 | - ->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId))) |
|
| 2716 | - ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION))) |
|
| 2717 | - ->executeStatement(); |
|
| 2718 | - |
|
| 2719 | - $query->delete($this->dbObjectPropertiesTable) |
|
| 2720 | - ->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId))) |
|
| 2721 | - ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION))) |
|
| 2722 | - ->executeStatement(); |
|
| 2723 | - |
|
| 2724 | - foreach ($uris as $uri) { |
|
| 2725 | - $this->addChange($subscriptionId, $uri, 3, self::CALENDAR_TYPE_SUBSCRIPTION); |
|
| 2726 | - } |
|
| 2727 | - } |
|
| 2728 | - |
|
| 2729 | - /** |
|
| 2730 | - * Move a calendar from one user to another |
|
| 2731 | - * |
|
| 2732 | - * @param string $uriName |
|
| 2733 | - * @param string $uriOrigin |
|
| 2734 | - * @param string $uriDestination |
|
| 2735 | - * @param string $newUriName (optional) the new uriName |
|
| 2736 | - */ |
|
| 2737 | - public function moveCalendar($uriName, $uriOrigin, $uriDestination, $newUriName = null) { |
|
| 2738 | - $query = $this->db->getQueryBuilder(); |
|
| 2739 | - $query->update('calendars') |
|
| 2740 | - ->set('principaluri', $query->createNamedParameter($uriDestination)) |
|
| 2741 | - ->set('uri', $query->createNamedParameter($newUriName ?: $uriName)) |
|
| 2742 | - ->where($query->expr()->eq('principaluri', $query->createNamedParameter($uriOrigin))) |
|
| 2743 | - ->andWhere($query->expr()->eq('uri', $query->createNamedParameter($uriName))) |
|
| 2744 | - ->executeStatement(); |
|
| 2745 | - } |
|
| 2746 | - |
|
| 2747 | - /** |
|
| 2748 | - * read VCalendar data into a VCalendar object |
|
| 2749 | - * |
|
| 2750 | - * @param string $objectData |
|
| 2751 | - * @return VCalendar |
|
| 2752 | - */ |
|
| 2753 | - protected function readCalendarData($objectData) { |
|
| 2754 | - return Reader::read($objectData); |
|
| 2755 | - } |
|
| 2756 | - |
|
| 2757 | - /** |
|
| 2758 | - * delete all properties from a given calendar object |
|
| 2759 | - * |
|
| 2760 | - * @param int $calendarId |
|
| 2761 | - * @param int $objectId |
|
| 2762 | - */ |
|
| 2763 | - protected function purgeProperties($calendarId, $objectId) { |
|
| 2764 | - $query = $this->db->getQueryBuilder(); |
|
| 2765 | - $query->delete($this->dbObjectPropertiesTable) |
|
| 2766 | - ->where($query->expr()->eq('objectid', $query->createNamedParameter($objectId))) |
|
| 2767 | - ->andWhere($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId))); |
|
| 2768 | - $query->executeStatement(); |
|
| 2769 | - } |
|
| 2770 | - |
|
| 2771 | - /** |
|
| 2772 | - * get ID from a given calendar object |
|
| 2773 | - * |
|
| 2774 | - * @param int $calendarId |
|
| 2775 | - * @param string $uri |
|
| 2776 | - * @param int $calendarType |
|
| 2777 | - * @return int |
|
| 2778 | - */ |
|
| 2779 | - protected function getCalendarObjectId($calendarId, $uri, $calendarType):int { |
|
| 2780 | - $query = $this->db->getQueryBuilder(); |
|
| 2781 | - $query->select('id') |
|
| 2782 | - ->from('calendarobjects') |
|
| 2783 | - ->where($query->expr()->eq('uri', $query->createNamedParameter($uri))) |
|
| 2784 | - ->andWhere($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId))) |
|
| 2785 | - ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType))); |
|
| 2786 | - |
|
| 2787 | - $result = $query->executeQuery(); |
|
| 2788 | - $objectIds = $result->fetch(); |
|
| 2789 | - $result->closeCursor(); |
|
| 2790 | - |
|
| 2791 | - if (!isset($objectIds['id'])) { |
|
| 2792 | - throw new \InvalidArgumentException('Calendarobject does not exists: ' . $uri); |
|
| 2793 | - } |
|
| 2794 | - |
|
| 2795 | - return (int)$objectIds['id']; |
|
| 2796 | - } |
|
| 2797 | - |
|
| 2798 | - /** |
|
| 2799 | - * return legacy endpoint principal name to new principal name |
|
| 2800 | - * |
|
| 2801 | - * @param $principalUri |
|
| 2802 | - * @param $toV2 |
|
| 2803 | - * @return string |
|
| 2804 | - */ |
|
| 2805 | - private function convertPrincipal($principalUri, $toV2) { |
|
| 2806 | - if ($this->principalBackend->getPrincipalPrefix() === 'principals') { |
|
| 2807 | - [, $name] = Uri\split($principalUri); |
|
| 2808 | - if ($toV2 === true) { |
|
| 2809 | - return "principals/users/$name"; |
|
| 2810 | - } |
|
| 2811 | - return "principals/$name"; |
|
| 2812 | - } |
|
| 2813 | - return $principalUri; |
|
| 2814 | - } |
|
| 2815 | - |
|
| 2816 | - /** |
|
| 2817 | - * adds information about an owner to the calendar data |
|
| 2818 | - * |
|
| 2819 | - * @param $calendarInfo |
|
| 2820 | - */ |
|
| 2821 | - private function addOwnerPrincipal(&$calendarInfo) { |
|
| 2822 | - $ownerPrincipalKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal'; |
|
| 2823 | - $displaynameKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}owner-displayname'; |
|
| 2824 | - if (isset($calendarInfo[$ownerPrincipalKey])) { |
|
| 2825 | - $uri = $calendarInfo[$ownerPrincipalKey]; |
|
| 2826 | - } else { |
|
| 2827 | - $uri = $calendarInfo['principaluri']; |
|
| 2828 | - } |
|
| 2829 | - |
|
| 2830 | - $principalInformation = $this->principalBackend->getPrincipalByPath($uri); |
|
| 2831 | - if (isset($principalInformation['{DAV:}displayname'])) { |
|
| 2832 | - $calendarInfo[$displaynameKey] = $principalInformation['{DAV:}displayname']; |
|
| 2833 | - } |
|
| 2834 | - } |
|
| 99 | + public const CALENDAR_TYPE_CALENDAR = 0; |
|
| 100 | + public const CALENDAR_TYPE_SUBSCRIPTION = 1; |
|
| 101 | + |
|
| 102 | + public const PERSONAL_CALENDAR_URI = 'personal'; |
|
| 103 | + public const PERSONAL_CALENDAR_NAME = 'Personal'; |
|
| 104 | + |
|
| 105 | + public const RESOURCE_BOOKING_CALENDAR_URI = 'calendar'; |
|
| 106 | + public const RESOURCE_BOOKING_CALENDAR_NAME = 'Calendar'; |
|
| 107 | + |
|
| 108 | + /** |
|
| 109 | + * We need to specify a max date, because we need to stop *somewhere* |
|
| 110 | + * |
|
| 111 | + * On 32 bit system the maximum for a signed integer is 2147483647, so |
|
| 112 | + * MAX_DATE cannot be higher than date('Y-m-d', 2147483647) which results |
|
| 113 | + * in 2038-01-19 to avoid problems when the date is converted |
|
| 114 | + * to a unix timestamp. |
|
| 115 | + */ |
|
| 116 | + public const MAX_DATE = '2038-01-01'; |
|
| 117 | + |
|
| 118 | + public const ACCESS_PUBLIC = 4; |
|
| 119 | + public const CLASSIFICATION_PUBLIC = 0; |
|
| 120 | + public const CLASSIFICATION_PRIVATE = 1; |
|
| 121 | + public const CLASSIFICATION_CONFIDENTIAL = 2; |
|
| 122 | + |
|
| 123 | + /** |
|
| 124 | + * List of CalDAV properties, and how they map to database field names |
|
| 125 | + * Add your own properties by simply adding on to this array. |
|
| 126 | + * |
|
| 127 | + * Note that only string-based properties are supported here. |
|
| 128 | + * |
|
| 129 | + * @var array |
|
| 130 | + */ |
|
| 131 | + public $propertyMap = [ |
|
| 132 | + '{DAV:}displayname' => 'displayname', |
|
| 133 | + '{urn:ietf:params:xml:ns:caldav}calendar-description' => 'description', |
|
| 134 | + '{urn:ietf:params:xml:ns:caldav}calendar-timezone' => 'timezone', |
|
| 135 | + '{http://apple.com/ns/ical/}calendar-order' => 'calendarorder', |
|
| 136 | + '{http://apple.com/ns/ical/}calendar-color' => 'calendarcolor', |
|
| 137 | + ]; |
|
| 138 | + |
|
| 139 | + /** |
|
| 140 | + * List of subscription properties, and how they map to database field names. |
|
| 141 | + * |
|
| 142 | + * @var array |
|
| 143 | + */ |
|
| 144 | + public $subscriptionPropertyMap = [ |
|
| 145 | + '{DAV:}displayname' => 'displayname', |
|
| 146 | + '{http://apple.com/ns/ical/}refreshrate' => 'refreshrate', |
|
| 147 | + '{http://apple.com/ns/ical/}calendar-order' => 'calendarorder', |
|
| 148 | + '{http://apple.com/ns/ical/}calendar-color' => 'calendarcolor', |
|
| 149 | + '{http://calendarserver.org/ns/}subscribed-strip-todos' => 'striptodos', |
|
| 150 | + '{http://calendarserver.org/ns/}subscribed-strip-alarms' => 'stripalarms', |
|
| 151 | + '{http://calendarserver.org/ns/}subscribed-strip-attachments' => 'stripattachments', |
|
| 152 | + ]; |
|
| 153 | + |
|
| 154 | + /** @var array properties to index */ |
|
| 155 | + public static $indexProperties = ['CATEGORIES', 'COMMENT', 'DESCRIPTION', |
|
| 156 | + 'LOCATION', 'RESOURCES', 'STATUS', 'SUMMARY', 'ATTENDEE', 'CONTACT', |
|
| 157 | + 'ORGANIZER']; |
|
| 158 | + |
|
| 159 | + /** @var array parameters to index */ |
|
| 160 | + public static $indexParameters = [ |
|
| 161 | + 'ATTENDEE' => ['CN'], |
|
| 162 | + 'ORGANIZER' => ['CN'], |
|
| 163 | + ]; |
|
| 164 | + |
|
| 165 | + /** |
|
| 166 | + * @var string[] Map of uid => display name |
|
| 167 | + */ |
|
| 168 | + protected $userDisplayNames; |
|
| 169 | + |
|
| 170 | + /** @var IDBConnection */ |
|
| 171 | + private $db; |
|
| 172 | + |
|
| 173 | + /** @var Backend */ |
|
| 174 | + private $calendarSharingBackend; |
|
| 175 | + |
|
| 176 | + /** @var Principal */ |
|
| 177 | + private $principalBackend; |
|
| 178 | + |
|
| 179 | + /** @var IUserManager */ |
|
| 180 | + private $userManager; |
|
| 181 | + |
|
| 182 | + /** @var ISecureRandom */ |
|
| 183 | + private $random; |
|
| 184 | + |
|
| 185 | + /** @var ILogger */ |
|
| 186 | + private $logger; |
|
| 187 | + |
|
| 188 | + /** @var IEventDispatcher */ |
|
| 189 | + private $dispatcher; |
|
| 190 | + |
|
| 191 | + /** @var EventDispatcherInterface */ |
|
| 192 | + private $legacyDispatcher; |
|
| 193 | + |
|
| 194 | + /** @var bool */ |
|
| 195 | + private $legacyEndpoint; |
|
| 196 | + |
|
| 197 | + /** @var string */ |
|
| 198 | + private $dbObjectPropertiesTable = 'calendarobjects_props'; |
|
| 199 | + |
|
| 200 | + /** |
|
| 201 | + * CalDavBackend constructor. |
|
| 202 | + * |
|
| 203 | + * @param IDBConnection $db |
|
| 204 | + * @param Principal $principalBackend |
|
| 205 | + * @param IUserManager $userManager |
|
| 206 | + * @param IGroupManager $groupManager |
|
| 207 | + * @param ISecureRandom $random |
|
| 208 | + * @param ILogger $logger |
|
| 209 | + * @param IEventDispatcher $dispatcher |
|
| 210 | + * @param EventDispatcherInterface $legacyDispatcher |
|
| 211 | + * @param bool $legacyEndpoint |
|
| 212 | + */ |
|
| 213 | + public function __construct(IDBConnection $db, |
|
| 214 | + Principal $principalBackend, |
|
| 215 | + IUserManager $userManager, |
|
| 216 | + IGroupManager $groupManager, |
|
| 217 | + ISecureRandom $random, |
|
| 218 | + ILogger $logger, |
|
| 219 | + IEventDispatcher $dispatcher, |
|
| 220 | + EventDispatcherInterface $legacyDispatcher, |
|
| 221 | + bool $legacyEndpoint = false) { |
|
| 222 | + $this->db = $db; |
|
| 223 | + $this->principalBackend = $principalBackend; |
|
| 224 | + $this->userManager = $userManager; |
|
| 225 | + $this->calendarSharingBackend = new Backend($this->db, $this->userManager, $groupManager, $principalBackend, 'calendar'); |
|
| 226 | + $this->random = $random; |
|
| 227 | + $this->logger = $logger; |
|
| 228 | + $this->dispatcher = $dispatcher; |
|
| 229 | + $this->legacyDispatcher = $legacyDispatcher; |
|
| 230 | + $this->legacyEndpoint = $legacyEndpoint; |
|
| 231 | + } |
|
| 232 | + |
|
| 233 | + /** |
|
| 234 | + * Return the number of calendars for a principal |
|
| 235 | + * |
|
| 236 | + * By default this excludes the automatically generated birthday calendar |
|
| 237 | + * |
|
| 238 | + * @param $principalUri |
|
| 239 | + * @param bool $excludeBirthday |
|
| 240 | + * @return int |
|
| 241 | + */ |
|
| 242 | + public function getCalendarsForUserCount($principalUri, $excludeBirthday = true) { |
|
| 243 | + $principalUri = $this->convertPrincipal($principalUri, true); |
|
| 244 | + $query = $this->db->getQueryBuilder(); |
|
| 245 | + $query->select($query->func()->count('*')) |
|
| 246 | + ->from('calendars'); |
|
| 247 | + |
|
| 248 | + if ($principalUri === '') { |
|
| 249 | + $query->where($query->expr()->emptyString('principaluri')); |
|
| 250 | + } else { |
|
| 251 | + $query->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))); |
|
| 252 | + } |
|
| 253 | + |
|
| 254 | + if ($excludeBirthday) { |
|
| 255 | + $query->andWhere($query->expr()->neq('uri', $query->createNamedParameter(BirthdayService::BIRTHDAY_CALENDAR_URI))); |
|
| 256 | + } |
|
| 257 | + |
|
| 258 | + $result = $query->executeQuery(); |
|
| 259 | + $column = (int)$result->fetchOne(); |
|
| 260 | + $result->closeCursor(); |
|
| 261 | + return $column; |
|
| 262 | + } |
|
| 263 | + |
|
| 264 | + /** |
|
| 265 | + * Returns a list of calendars for a principal. |
|
| 266 | + * |
|
| 267 | + * Every project is an array with the following keys: |
|
| 268 | + * * id, a unique id that will be used by other functions to modify the |
|
| 269 | + * calendar. This can be the same as the uri or a database key. |
|
| 270 | + * * uri, which the basename of the uri with which the calendar is |
|
| 271 | + * accessed. |
|
| 272 | + * * principaluri. The owner of the calendar. Almost always the same as |
|
| 273 | + * principalUri passed to this method. |
|
| 274 | + * |
|
| 275 | + * Furthermore it can contain webdav properties in clark notation. A very |
|
| 276 | + * common one is '{DAV:}displayname'. |
|
| 277 | + * |
|
| 278 | + * Many clients also require: |
|
| 279 | + * {urn:ietf:params:xml:ns:caldav}supported-calendar-component-set |
|
| 280 | + * For this property, you can just return an instance of |
|
| 281 | + * Sabre\CalDAV\Property\SupportedCalendarComponentSet. |
|
| 282 | + * |
|
| 283 | + * If you return {http://sabredav.org/ns}read-only and set the value to 1, |
|
| 284 | + * ACL will automatically be put in read-only mode. |
|
| 285 | + * |
|
| 286 | + * @param string $principalUri |
|
| 287 | + * @return array |
|
| 288 | + */ |
|
| 289 | + public function getCalendarsForUser($principalUri) { |
|
| 290 | + $principalUriOriginal = $principalUri; |
|
| 291 | + $principalUri = $this->convertPrincipal($principalUri, true); |
|
| 292 | + $fields = array_values($this->propertyMap); |
|
| 293 | + $fields[] = 'id'; |
|
| 294 | + $fields[] = 'uri'; |
|
| 295 | + $fields[] = 'synctoken'; |
|
| 296 | + $fields[] = 'components'; |
|
| 297 | + $fields[] = 'principaluri'; |
|
| 298 | + $fields[] = 'transparent'; |
|
| 299 | + |
|
| 300 | + // Making fields a comma-delimited list |
|
| 301 | + $query = $this->db->getQueryBuilder(); |
|
| 302 | + $query->select($fields) |
|
| 303 | + ->from('calendars') |
|
| 304 | + ->orderBy('calendarorder', 'ASC'); |
|
| 305 | + |
|
| 306 | + if ($principalUri === '') { |
|
| 307 | + $query->where($query->expr()->emptyString('principaluri')); |
|
| 308 | + } else { |
|
| 309 | + $query->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))); |
|
| 310 | + } |
|
| 311 | + |
|
| 312 | + $result = $query->executeQuery(); |
|
| 313 | + |
|
| 314 | + $calendars = []; |
|
| 315 | + while ($row = $result->fetch()) { |
|
| 316 | + $row['principaluri'] = (string) $row['principaluri']; |
|
| 317 | + $components = []; |
|
| 318 | + if ($row['components']) { |
|
| 319 | + $components = explode(',',$row['components']); |
|
| 320 | + } |
|
| 321 | + |
|
| 322 | + $calendar = [ |
|
| 323 | + 'id' => $row['id'], |
|
| 324 | + 'uri' => $row['uri'], |
|
| 325 | + 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 326 | + '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 327 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 328 | + '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 329 | + '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 330 | + '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint), |
|
| 331 | + ]; |
|
| 332 | + |
|
| 333 | + foreach ($this->propertyMap as $xmlName => $dbName) { |
|
| 334 | + $calendar[$xmlName] = $row[$dbName]; |
|
| 335 | + } |
|
| 336 | + |
|
| 337 | + $this->addOwnerPrincipal($calendar); |
|
| 338 | + |
|
| 339 | + if (!isset($calendars[$calendar['id']])) { |
|
| 340 | + $calendars[$calendar['id']] = $calendar; |
|
| 341 | + } |
|
| 342 | + } |
|
| 343 | + $result->closeCursor(); |
|
| 344 | + |
|
| 345 | + // query for shared calendars |
|
| 346 | + $principals = $this->principalBackend->getGroupMembership($principalUriOriginal, true); |
|
| 347 | + $principals = array_merge($principals, $this->principalBackend->getCircleMembership($principalUriOriginal)); |
|
| 348 | + |
|
| 349 | + $principals[] = $principalUri; |
|
| 350 | + |
|
| 351 | + $fields = array_values($this->propertyMap); |
|
| 352 | + $fields[] = 'a.id'; |
|
| 353 | + $fields[] = 'a.uri'; |
|
| 354 | + $fields[] = 'a.synctoken'; |
|
| 355 | + $fields[] = 'a.components'; |
|
| 356 | + $fields[] = 'a.principaluri'; |
|
| 357 | + $fields[] = 'a.transparent'; |
|
| 358 | + $fields[] = 's.access'; |
|
| 359 | + $query = $this->db->getQueryBuilder(); |
|
| 360 | + $query->select($fields) |
|
| 361 | + ->from('dav_shares', 's') |
|
| 362 | + ->join('s', 'calendars', 'a', $query->expr()->eq('s.resourceid', 'a.id')) |
|
| 363 | + ->where($query->expr()->in('s.principaluri', $query->createParameter('principaluri'))) |
|
| 364 | + ->andWhere($query->expr()->eq('s.type', $query->createParameter('type'))) |
|
| 365 | + ->setParameter('type', 'calendar') |
|
| 366 | + ->setParameter('principaluri', $principals, \Doctrine\DBAL\Connection::PARAM_STR_ARRAY); |
|
| 367 | + |
|
| 368 | + $result = $query->executeQuery(); |
|
| 369 | + |
|
| 370 | + $readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only'; |
|
| 371 | + while ($row = $result->fetch()) { |
|
| 372 | + $row['principaluri'] = (string) $row['principaluri']; |
|
| 373 | + if ($row['principaluri'] === $principalUri) { |
|
| 374 | + continue; |
|
| 375 | + } |
|
| 376 | + |
|
| 377 | + $readOnly = (int) $row['access'] === Backend::ACCESS_READ; |
|
| 378 | + if (isset($calendars[$row['id']])) { |
|
| 379 | + if ($readOnly) { |
|
| 380 | + // New share can not have more permissions then the old one. |
|
| 381 | + continue; |
|
| 382 | + } |
|
| 383 | + if (isset($calendars[$row['id']][$readOnlyPropertyName]) && |
|
| 384 | + $calendars[$row['id']][$readOnlyPropertyName] === 0) { |
|
| 385 | + // Old share is already read-write, no more permissions can be gained |
|
| 386 | + continue; |
|
| 387 | + } |
|
| 388 | + } |
|
| 389 | + |
|
| 390 | + [, $name] = Uri\split($row['principaluri']); |
|
| 391 | + $uri = $row['uri'] . '_shared_by_' . $name; |
|
| 392 | + $row['displayname'] = $row['displayname'] . ' (' . $this->getUserDisplayName($name) . ')'; |
|
| 393 | + $components = []; |
|
| 394 | + if ($row['components']) { |
|
| 395 | + $components = explode(',',$row['components']); |
|
| 396 | + } |
|
| 397 | + $calendar = [ |
|
| 398 | + 'id' => $row['id'], |
|
| 399 | + 'uri' => $uri, |
|
| 400 | + 'principaluri' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint), |
|
| 401 | + '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 402 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 403 | + '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 404 | + '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp('transparent'), |
|
| 405 | + '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 406 | + $readOnlyPropertyName => $readOnly, |
|
| 407 | + ]; |
|
| 408 | + |
|
| 409 | + foreach ($this->propertyMap as $xmlName => $dbName) { |
|
| 410 | + $calendar[$xmlName] = $row[$dbName]; |
|
| 411 | + } |
|
| 412 | + |
|
| 413 | + $this->addOwnerPrincipal($calendar); |
|
| 414 | + |
|
| 415 | + $calendars[$calendar['id']] = $calendar; |
|
| 416 | + } |
|
| 417 | + $result->closeCursor(); |
|
| 418 | + |
|
| 419 | + return array_values($calendars); |
|
| 420 | + } |
|
| 421 | + |
|
| 422 | + /** |
|
| 423 | + * @param $principalUri |
|
| 424 | + * @return array |
|
| 425 | + */ |
|
| 426 | + public function getUsersOwnCalendars($principalUri) { |
|
| 427 | + $principalUri = $this->convertPrincipal($principalUri, true); |
|
| 428 | + $fields = array_values($this->propertyMap); |
|
| 429 | + $fields[] = 'id'; |
|
| 430 | + $fields[] = 'uri'; |
|
| 431 | + $fields[] = 'synctoken'; |
|
| 432 | + $fields[] = 'components'; |
|
| 433 | + $fields[] = 'principaluri'; |
|
| 434 | + $fields[] = 'transparent'; |
|
| 435 | + // Making fields a comma-delimited list |
|
| 436 | + $query = $this->db->getQueryBuilder(); |
|
| 437 | + $query->select($fields)->from('calendars') |
|
| 438 | + ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))) |
|
| 439 | + ->orderBy('calendarorder', 'ASC'); |
|
| 440 | + $stmt = $query->executeQuery(); |
|
| 441 | + $calendars = []; |
|
| 442 | + while ($row = $stmt->fetch()) { |
|
| 443 | + $row['principaluri'] = (string) $row['principaluri']; |
|
| 444 | + $components = []; |
|
| 445 | + if ($row['components']) { |
|
| 446 | + $components = explode(',',$row['components']); |
|
| 447 | + } |
|
| 448 | + $calendar = [ |
|
| 449 | + 'id' => $row['id'], |
|
| 450 | + 'uri' => $row['uri'], |
|
| 451 | + 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 452 | + '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 453 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 454 | + '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 455 | + '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 456 | + ]; |
|
| 457 | + foreach ($this->propertyMap as $xmlName => $dbName) { |
|
| 458 | + $calendar[$xmlName] = $row[$dbName]; |
|
| 459 | + } |
|
| 460 | + |
|
| 461 | + $this->addOwnerPrincipal($calendar); |
|
| 462 | + |
|
| 463 | + if (!isset($calendars[$calendar['id']])) { |
|
| 464 | + $calendars[$calendar['id']] = $calendar; |
|
| 465 | + } |
|
| 466 | + } |
|
| 467 | + $stmt->closeCursor(); |
|
| 468 | + return array_values($calendars); |
|
| 469 | + } |
|
| 470 | + |
|
| 471 | + |
|
| 472 | + /** |
|
| 473 | + * @param $uid |
|
| 474 | + * @return string |
|
| 475 | + */ |
|
| 476 | + private function getUserDisplayName($uid) { |
|
| 477 | + if (!isset($this->userDisplayNames[$uid])) { |
|
| 478 | + $user = $this->userManager->get($uid); |
|
| 479 | + |
|
| 480 | + if ($user instanceof IUser) { |
|
| 481 | + $this->userDisplayNames[$uid] = $user->getDisplayName(); |
|
| 482 | + } else { |
|
| 483 | + $this->userDisplayNames[$uid] = $uid; |
|
| 484 | + } |
|
| 485 | + } |
|
| 486 | + |
|
| 487 | + return $this->userDisplayNames[$uid]; |
|
| 488 | + } |
|
| 489 | + |
|
| 490 | + /** |
|
| 491 | + * @return array |
|
| 492 | + */ |
|
| 493 | + public function getPublicCalendars() { |
|
| 494 | + $fields = array_values($this->propertyMap); |
|
| 495 | + $fields[] = 'a.id'; |
|
| 496 | + $fields[] = 'a.uri'; |
|
| 497 | + $fields[] = 'a.synctoken'; |
|
| 498 | + $fields[] = 'a.components'; |
|
| 499 | + $fields[] = 'a.principaluri'; |
|
| 500 | + $fields[] = 'a.transparent'; |
|
| 501 | + $fields[] = 's.access'; |
|
| 502 | + $fields[] = 's.publicuri'; |
|
| 503 | + $calendars = []; |
|
| 504 | + $query = $this->db->getQueryBuilder(); |
|
| 505 | + $result = $query->select($fields) |
|
| 506 | + ->from('dav_shares', 's') |
|
| 507 | + ->join('s', 'calendars', 'a', $query->expr()->eq('s.resourceid', 'a.id')) |
|
| 508 | + ->where($query->expr()->in('s.access', $query->createNamedParameter(self::ACCESS_PUBLIC))) |
|
| 509 | + ->andWhere($query->expr()->eq('s.type', $query->createNamedParameter('calendar'))) |
|
| 510 | + ->executeQuery(); |
|
| 511 | + |
|
| 512 | + while ($row = $result->fetch()) { |
|
| 513 | + $row['principaluri'] = (string) $row['principaluri']; |
|
| 514 | + [, $name] = Uri\split($row['principaluri']); |
|
| 515 | + $row['displayname'] = $row['displayname'] . "($name)"; |
|
| 516 | + $components = []; |
|
| 517 | + if ($row['components']) { |
|
| 518 | + $components = explode(',',$row['components']); |
|
| 519 | + } |
|
| 520 | + $calendar = [ |
|
| 521 | + 'id' => $row['id'], |
|
| 522 | + 'uri' => $row['publicuri'], |
|
| 523 | + 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 524 | + '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 525 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 526 | + '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 527 | + '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 528 | + '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], $this->legacyEndpoint), |
|
| 529 | + '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ, |
|
| 530 | + '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC, |
|
| 531 | + ]; |
|
| 532 | + |
|
| 533 | + foreach ($this->propertyMap as $xmlName => $dbName) { |
|
| 534 | + $calendar[$xmlName] = $row[$dbName]; |
|
| 535 | + } |
|
| 536 | + |
|
| 537 | + $this->addOwnerPrincipal($calendar); |
|
| 538 | + |
|
| 539 | + if (!isset($calendars[$calendar['id']])) { |
|
| 540 | + $calendars[$calendar['id']] = $calendar; |
|
| 541 | + } |
|
| 542 | + } |
|
| 543 | + $result->closeCursor(); |
|
| 544 | + |
|
| 545 | + return array_values($calendars); |
|
| 546 | + } |
|
| 547 | + |
|
| 548 | + /** |
|
| 549 | + * @param string $uri |
|
| 550 | + * @return array |
|
| 551 | + * @throws NotFound |
|
| 552 | + */ |
|
| 553 | + public function getPublicCalendar($uri) { |
|
| 554 | + $fields = array_values($this->propertyMap); |
|
| 555 | + $fields[] = 'a.id'; |
|
| 556 | + $fields[] = 'a.uri'; |
|
| 557 | + $fields[] = 'a.synctoken'; |
|
| 558 | + $fields[] = 'a.components'; |
|
| 559 | + $fields[] = 'a.principaluri'; |
|
| 560 | + $fields[] = 'a.transparent'; |
|
| 561 | + $fields[] = 's.access'; |
|
| 562 | + $fields[] = 's.publicuri'; |
|
| 563 | + $query = $this->db->getQueryBuilder(); |
|
| 564 | + $result = $query->select($fields) |
|
| 565 | + ->from('dav_shares', 's') |
|
| 566 | + ->join('s', 'calendars', 'a', $query->expr()->eq('s.resourceid', 'a.id')) |
|
| 567 | + ->where($query->expr()->in('s.access', $query->createNamedParameter(self::ACCESS_PUBLIC))) |
|
| 568 | + ->andWhere($query->expr()->eq('s.type', $query->createNamedParameter('calendar'))) |
|
| 569 | + ->andWhere($query->expr()->eq('s.publicuri', $query->createNamedParameter($uri))) |
|
| 570 | + ->executeQuery(); |
|
| 571 | + |
|
| 572 | + $row = $result->fetch(); |
|
| 573 | + |
|
| 574 | + $result->closeCursor(); |
|
| 575 | + |
|
| 576 | + if ($row === false) { |
|
| 577 | + throw new NotFound('Node with name \'' . $uri . '\' could not be found'); |
|
| 578 | + } |
|
| 579 | + |
|
| 580 | + $row['principaluri'] = (string) $row['principaluri']; |
|
| 581 | + [, $name] = Uri\split($row['principaluri']); |
|
| 582 | + $row['displayname'] = $row['displayname'] . ' ' . "($name)"; |
|
| 583 | + $components = []; |
|
| 584 | + if ($row['components']) { |
|
| 585 | + $components = explode(',',$row['components']); |
|
| 586 | + } |
|
| 587 | + $calendar = [ |
|
| 588 | + 'id' => $row['id'], |
|
| 589 | + 'uri' => $row['publicuri'], |
|
| 590 | + 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 591 | + '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 592 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 593 | + '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 594 | + '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 595 | + '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 596 | + '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ, |
|
| 597 | + '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC, |
|
| 598 | + ]; |
|
| 599 | + |
|
| 600 | + foreach ($this->propertyMap as $xmlName => $dbName) { |
|
| 601 | + $calendar[$xmlName] = $row[$dbName]; |
|
| 602 | + } |
|
| 603 | + |
|
| 604 | + $this->addOwnerPrincipal($calendar); |
|
| 605 | + |
|
| 606 | + return $calendar; |
|
| 607 | + } |
|
| 608 | + |
|
| 609 | + /** |
|
| 610 | + * @param string $principal |
|
| 611 | + * @param string $uri |
|
| 612 | + * @return array|null |
|
| 613 | + */ |
|
| 614 | + public function getCalendarByUri($principal, $uri) { |
|
| 615 | + $fields = array_values($this->propertyMap); |
|
| 616 | + $fields[] = 'id'; |
|
| 617 | + $fields[] = 'uri'; |
|
| 618 | + $fields[] = 'synctoken'; |
|
| 619 | + $fields[] = 'components'; |
|
| 620 | + $fields[] = 'principaluri'; |
|
| 621 | + $fields[] = 'transparent'; |
|
| 622 | + |
|
| 623 | + // Making fields a comma-delimited list |
|
| 624 | + $query = $this->db->getQueryBuilder(); |
|
| 625 | + $query->select($fields)->from('calendars') |
|
| 626 | + ->where($query->expr()->eq('uri', $query->createNamedParameter($uri))) |
|
| 627 | + ->andWhere($query->expr()->eq('principaluri', $query->createNamedParameter($principal))) |
|
| 628 | + ->setMaxResults(1); |
|
| 629 | + $stmt = $query->executeQuery(); |
|
| 630 | + |
|
| 631 | + $row = $stmt->fetch(); |
|
| 632 | + $stmt->closeCursor(); |
|
| 633 | + if ($row === false) { |
|
| 634 | + return null; |
|
| 635 | + } |
|
| 636 | + |
|
| 637 | + $row['principaluri'] = (string) $row['principaluri']; |
|
| 638 | + $components = []; |
|
| 639 | + if ($row['components']) { |
|
| 640 | + $components = explode(',',$row['components']); |
|
| 641 | + } |
|
| 642 | + |
|
| 643 | + $calendar = [ |
|
| 644 | + 'id' => $row['id'], |
|
| 645 | + 'uri' => $row['uri'], |
|
| 646 | + 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 647 | + '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 648 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 649 | + '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 650 | + '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 651 | + ]; |
|
| 652 | + |
|
| 653 | + foreach ($this->propertyMap as $xmlName => $dbName) { |
|
| 654 | + $calendar[$xmlName] = $row[$dbName]; |
|
| 655 | + } |
|
| 656 | + |
|
| 657 | + $this->addOwnerPrincipal($calendar); |
|
| 658 | + |
|
| 659 | + return $calendar; |
|
| 660 | + } |
|
| 661 | + |
|
| 662 | + /** |
|
| 663 | + * @param $calendarId |
|
| 664 | + * @return array|null |
|
| 665 | + */ |
|
| 666 | + public function getCalendarById($calendarId) { |
|
| 667 | + $fields = array_values($this->propertyMap); |
|
| 668 | + $fields[] = 'id'; |
|
| 669 | + $fields[] = 'uri'; |
|
| 670 | + $fields[] = 'synctoken'; |
|
| 671 | + $fields[] = 'components'; |
|
| 672 | + $fields[] = 'principaluri'; |
|
| 673 | + $fields[] = 'transparent'; |
|
| 674 | + |
|
| 675 | + // Making fields a comma-delimited list |
|
| 676 | + $query = $this->db->getQueryBuilder(); |
|
| 677 | + $query->select($fields)->from('calendars') |
|
| 678 | + ->where($query->expr()->eq('id', $query->createNamedParameter($calendarId))) |
|
| 679 | + ->setMaxResults(1); |
|
| 680 | + $stmt = $query->executeQuery(); |
|
| 681 | + |
|
| 682 | + $row = $stmt->fetch(); |
|
| 683 | + $stmt->closeCursor(); |
|
| 684 | + if ($row === false) { |
|
| 685 | + return null; |
|
| 686 | + } |
|
| 687 | + |
|
| 688 | + $row['principaluri'] = (string) $row['principaluri']; |
|
| 689 | + $components = []; |
|
| 690 | + if ($row['components']) { |
|
| 691 | + $components = explode(',',$row['components']); |
|
| 692 | + } |
|
| 693 | + |
|
| 694 | + $calendar = [ |
|
| 695 | + 'id' => $row['id'], |
|
| 696 | + 'uri' => $row['uri'], |
|
| 697 | + 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 698 | + '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 699 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 700 | + '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 701 | + '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 702 | + ]; |
|
| 703 | + |
|
| 704 | + foreach ($this->propertyMap as $xmlName => $dbName) { |
|
| 705 | + $calendar[$xmlName] = $row[$dbName]; |
|
| 706 | + } |
|
| 707 | + |
|
| 708 | + $this->addOwnerPrincipal($calendar); |
|
| 709 | + |
|
| 710 | + return $calendar; |
|
| 711 | + } |
|
| 712 | + |
|
| 713 | + /** |
|
| 714 | + * @param $subscriptionId |
|
| 715 | + */ |
|
| 716 | + public function getSubscriptionById($subscriptionId) { |
|
| 717 | + $fields = array_values($this->subscriptionPropertyMap); |
|
| 718 | + $fields[] = 'id'; |
|
| 719 | + $fields[] = 'uri'; |
|
| 720 | + $fields[] = 'source'; |
|
| 721 | + $fields[] = 'synctoken'; |
|
| 722 | + $fields[] = 'principaluri'; |
|
| 723 | + $fields[] = 'lastmodified'; |
|
| 724 | + |
|
| 725 | + $query = $this->db->getQueryBuilder(); |
|
| 726 | + $query->select($fields) |
|
| 727 | + ->from('calendarsubscriptions') |
|
| 728 | + ->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId))) |
|
| 729 | + ->orderBy('calendarorder', 'asc'); |
|
| 730 | + $stmt = $query->executeQuery(); |
|
| 731 | + |
|
| 732 | + $row = $stmt->fetch(); |
|
| 733 | + $stmt->closeCursor(); |
|
| 734 | + if ($row === false) { |
|
| 735 | + return null; |
|
| 736 | + } |
|
| 737 | + |
|
| 738 | + $row['principaluri'] = (string) $row['principaluri']; |
|
| 739 | + $subscription = [ |
|
| 740 | + 'id' => $row['id'], |
|
| 741 | + 'uri' => $row['uri'], |
|
| 742 | + 'principaluri' => $row['principaluri'], |
|
| 743 | + 'source' => $row['source'], |
|
| 744 | + 'lastmodified' => $row['lastmodified'], |
|
| 745 | + '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
| 746 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 747 | + ]; |
|
| 748 | + |
|
| 749 | + foreach ($this->subscriptionPropertyMap as $xmlName => $dbName) { |
|
| 750 | + if (!is_null($row[$dbName])) { |
|
| 751 | + $subscription[$xmlName] = $row[$dbName]; |
|
| 752 | + } |
|
| 753 | + } |
|
| 754 | + |
|
| 755 | + return $subscription; |
|
| 756 | + } |
|
| 757 | + |
|
| 758 | + /** |
|
| 759 | + * Creates a new calendar for a principal. |
|
| 760 | + * |
|
| 761 | + * If the creation was a success, an id must be returned that can be used to reference |
|
| 762 | + * this calendar in other methods, such as updateCalendar. |
|
| 763 | + * |
|
| 764 | + * @param string $principalUri |
|
| 765 | + * @param string $calendarUri |
|
| 766 | + * @param array $properties |
|
| 767 | + * @return int |
|
| 768 | + */ |
|
| 769 | + public function createCalendar($principalUri, $calendarUri, array $properties) { |
|
| 770 | + $values = [ |
|
| 771 | + 'principaluri' => $this->convertPrincipal($principalUri, true), |
|
| 772 | + 'uri' => $calendarUri, |
|
| 773 | + 'synctoken' => 1, |
|
| 774 | + 'transparent' => 0, |
|
| 775 | + 'components' => 'VEVENT,VTODO', |
|
| 776 | + 'displayname' => $calendarUri |
|
| 777 | + ]; |
|
| 778 | + |
|
| 779 | + // Default value |
|
| 780 | + $sccs = '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set'; |
|
| 781 | + if (isset($properties[$sccs])) { |
|
| 782 | + if (!($properties[$sccs] instanceof SupportedCalendarComponentSet)) { |
|
| 783 | + throw new DAV\Exception('The ' . $sccs . ' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet'); |
|
| 784 | + } |
|
| 785 | + $values['components'] = implode(',',$properties[$sccs]->getValue()); |
|
| 786 | + } elseif (isset($properties['components'])) { |
|
| 787 | + // Allow to provide components internally without having |
|
| 788 | + // to create a SupportedCalendarComponentSet object |
|
| 789 | + $values['components'] = $properties['components']; |
|
| 790 | + } |
|
| 791 | + |
|
| 792 | + $transp = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp'; |
|
| 793 | + if (isset($properties[$transp])) { |
|
| 794 | + $values['transparent'] = (int) ($properties[$transp]->getValue() === 'transparent'); |
|
| 795 | + } |
|
| 796 | + |
|
| 797 | + foreach ($this->propertyMap as $xmlName => $dbName) { |
|
| 798 | + if (isset($properties[$xmlName])) { |
|
| 799 | + $values[$dbName] = $properties[$xmlName]; |
|
| 800 | + } |
|
| 801 | + } |
|
| 802 | + |
|
| 803 | + $query = $this->db->getQueryBuilder(); |
|
| 804 | + $query->insert('calendars'); |
|
| 805 | + foreach ($values as $column => $value) { |
|
| 806 | + $query->setValue($column, $query->createNamedParameter($value)); |
|
| 807 | + } |
|
| 808 | + $query->executeStatement(); |
|
| 809 | + $calendarId = $query->getLastInsertId(); |
|
| 810 | + |
|
| 811 | + $calendarData = $this->getCalendarById($calendarId); |
|
| 812 | + $this->dispatcher->dispatchTyped(new CalendarCreatedEvent((int)$calendarId, $calendarData)); |
|
| 813 | + $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::createCalendar', new GenericEvent( |
|
| 814 | + '\OCA\DAV\CalDAV\CalDavBackend::createCalendar', |
|
| 815 | + [ |
|
| 816 | + 'calendarId' => $calendarId, |
|
| 817 | + 'calendarData' => $calendarData, |
|
| 818 | + ])); |
|
| 819 | + |
|
| 820 | + return $calendarId; |
|
| 821 | + } |
|
| 822 | + |
|
| 823 | + /** |
|
| 824 | + * Updates properties for a calendar. |
|
| 825 | + * |
|
| 826 | + * The list of mutations is stored in a Sabre\DAV\PropPatch object. |
|
| 827 | + * To do the actual updates, you must tell this object which properties |
|
| 828 | + * you're going to process with the handle() method. |
|
| 829 | + * |
|
| 830 | + * Calling the handle method is like telling the PropPatch object "I |
|
| 831 | + * promise I can handle updating this property". |
|
| 832 | + * |
|
| 833 | + * Read the PropPatch documentation for more info and examples. |
|
| 834 | + * |
|
| 835 | + * @param mixed $calendarId |
|
| 836 | + * @param PropPatch $propPatch |
|
| 837 | + * @return void |
|
| 838 | + */ |
|
| 839 | + public function updateCalendar($calendarId, PropPatch $propPatch) { |
|
| 840 | + $supportedProperties = array_keys($this->propertyMap); |
|
| 841 | + $supportedProperties[] = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp'; |
|
| 842 | + |
|
| 843 | + $propPatch->handle($supportedProperties, function ($mutations) use ($calendarId) { |
|
| 844 | + $newValues = []; |
|
| 845 | + foreach ($mutations as $propertyName => $propertyValue) { |
|
| 846 | + switch ($propertyName) { |
|
| 847 | + case '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp': |
|
| 848 | + $fieldName = 'transparent'; |
|
| 849 | + $newValues[$fieldName] = (int) ($propertyValue->getValue() === 'transparent'); |
|
| 850 | + break; |
|
| 851 | + default: |
|
| 852 | + $fieldName = $this->propertyMap[$propertyName]; |
|
| 853 | + $newValues[$fieldName] = $propertyValue; |
|
| 854 | + break; |
|
| 855 | + } |
|
| 856 | + } |
|
| 857 | + $query = $this->db->getQueryBuilder(); |
|
| 858 | + $query->update('calendars'); |
|
| 859 | + foreach ($newValues as $fieldName => $value) { |
|
| 860 | + $query->set($fieldName, $query->createNamedParameter($value)); |
|
| 861 | + } |
|
| 862 | + $query->where($query->expr()->eq('id', $query->createNamedParameter($calendarId))); |
|
| 863 | + $query->executeStatement(); |
|
| 864 | + |
|
| 865 | + $this->addChange($calendarId, "", 2); |
|
| 866 | + |
|
| 867 | + $calendarData = $this->getCalendarById($calendarId); |
|
| 868 | + $shares = $this->getShares($calendarId); |
|
| 869 | + $this->dispatcher->dispatchTyped(new CalendarUpdatedEvent((int)$calendarId, $calendarData, $shares, $mutations)); |
|
| 870 | + $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateCalendar', new GenericEvent( |
|
| 871 | + '\OCA\DAV\CalDAV\CalDavBackend::updateCalendar', |
|
| 872 | + [ |
|
| 873 | + 'calendarId' => $calendarId, |
|
| 874 | + 'calendarData' => $calendarData, |
|
| 875 | + 'shares' => $shares, |
|
| 876 | + 'propertyMutations' => $mutations, |
|
| 877 | + ])); |
|
| 878 | + |
|
| 879 | + return true; |
|
| 880 | + }); |
|
| 881 | + } |
|
| 882 | + |
|
| 883 | + /** |
|
| 884 | + * Delete a calendar and all it's objects |
|
| 885 | + * |
|
| 886 | + * @param mixed $calendarId |
|
| 887 | + * @return void |
|
| 888 | + */ |
|
| 889 | + public function deleteCalendar($calendarId) { |
|
| 890 | + $calendarData = $this->getCalendarById($calendarId); |
|
| 891 | + $shares = $this->getShares($calendarId); |
|
| 892 | + |
|
| 893 | + $stmt = $this->db->prepare('DELETE FROM `*PREFIX*calendarobjects` WHERE `calendarid` = ? AND `calendartype` = ?'); |
|
| 894 | + $stmt->execute([$calendarId, self::CALENDAR_TYPE_CALENDAR]); |
|
| 895 | + |
|
| 896 | + $stmt = $this->db->prepare('DELETE FROM `*PREFIX*calendars` WHERE `id` = ?'); |
|
| 897 | + $stmt->execute([$calendarId]); |
|
| 898 | + |
|
| 899 | + $stmt = $this->db->prepare('DELETE FROM `*PREFIX*calendarchanges` WHERE `calendarid` = ? AND `calendartype` = ?'); |
|
| 900 | + $stmt->execute([$calendarId, self::CALENDAR_TYPE_CALENDAR]); |
|
| 901 | + |
|
| 902 | + $this->calendarSharingBackend->deleteAllShares($calendarId); |
|
| 903 | + |
|
| 904 | + $query = $this->db->getQueryBuilder(); |
|
| 905 | + $query->delete($this->dbObjectPropertiesTable) |
|
| 906 | + ->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId))) |
|
| 907 | + ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_CALENDAR))) |
|
| 908 | + ->executeStatement(); |
|
| 909 | + |
|
| 910 | + // Only dispatch if we actually deleted anything |
|
| 911 | + if ($calendarData) { |
|
| 912 | + $this->dispatcher->dispatchTyped(new CalendarDeletedEvent((int)$calendarId, $calendarData, $shares)); |
|
| 913 | + } |
|
| 914 | + } |
|
| 915 | + |
|
| 916 | + /** |
|
| 917 | + * Delete all of an user's shares |
|
| 918 | + * |
|
| 919 | + * @param string $principaluri |
|
| 920 | + * @return void |
|
| 921 | + */ |
|
| 922 | + public function deleteAllSharesByUser($principaluri) { |
|
| 923 | + $this->calendarSharingBackend->deleteAllSharesByUser($principaluri); |
|
| 924 | + } |
|
| 925 | + |
|
| 926 | + /** |
|
| 927 | + * Returns all calendar objects within a calendar. |
|
| 928 | + * |
|
| 929 | + * Every item contains an array with the following keys: |
|
| 930 | + * * calendardata - The iCalendar-compatible calendar data |
|
| 931 | + * * uri - a unique key which will be used to construct the uri. This can |
|
| 932 | + * be any arbitrary string, but making sure it ends with '.ics' is a |
|
| 933 | + * good idea. This is only the basename, or filename, not the full |
|
| 934 | + * path. |
|
| 935 | + * * lastmodified - a timestamp of the last modification time |
|
| 936 | + * * etag - An arbitrary string, surrounded by double-quotes. (e.g.: |
|
| 937 | + * '"abcdef"') |
|
| 938 | + * * size - The size of the calendar objects, in bytes. |
|
| 939 | + * * component - optional, a string containing the type of object, such |
|
| 940 | + * as 'vevent' or 'vtodo'. If specified, this will be used to populate |
|
| 941 | + * the Content-Type header. |
|
| 942 | + * |
|
| 943 | + * Note that the etag is optional, but it's highly encouraged to return for |
|
| 944 | + * speed reasons. |
|
| 945 | + * |
|
| 946 | + * The calendardata is also optional. If it's not returned |
|
| 947 | + * 'getCalendarObject' will be called later, which *is* expected to return |
|
| 948 | + * calendardata. |
|
| 949 | + * |
|
| 950 | + * If neither etag or size are specified, the calendardata will be |
|
| 951 | + * used/fetched to determine these numbers. If both are specified the |
|
| 952 | + * amount of times this is needed is reduced by a great degree. |
|
| 953 | + * |
|
| 954 | + * @param mixed $calendarId |
|
| 955 | + * @param int $calendarType |
|
| 956 | + * @return array |
|
| 957 | + */ |
|
| 958 | + public function getCalendarObjects($calendarId, $calendarType = self::CALENDAR_TYPE_CALENDAR):array { |
|
| 959 | + $query = $this->db->getQueryBuilder(); |
|
| 960 | + $query->select(['id', 'uri', 'lastmodified', 'etag', 'calendarid', 'size', 'componenttype', 'classification']) |
|
| 961 | + ->from('calendarobjects') |
|
| 962 | + ->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId))) |
|
| 963 | + ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType))); |
|
| 964 | + $stmt = $query->executeQuery(); |
|
| 965 | + |
|
| 966 | + $result = []; |
|
| 967 | + foreach ($stmt->fetchAll() as $row) { |
|
| 968 | + $result[] = [ |
|
| 969 | + 'id' => $row['id'], |
|
| 970 | + 'uri' => $row['uri'], |
|
| 971 | + 'lastmodified' => $row['lastmodified'], |
|
| 972 | + 'etag' => '"' . $row['etag'] . '"', |
|
| 973 | + 'calendarid' => $row['calendarid'], |
|
| 974 | + 'size' => (int)$row['size'], |
|
| 975 | + 'component' => strtolower($row['componenttype']), |
|
| 976 | + 'classification' => (int)$row['classification'] |
|
| 977 | + ]; |
|
| 978 | + } |
|
| 979 | + $stmt->closeCursor(); |
|
| 980 | + |
|
| 981 | + return $result; |
|
| 982 | + } |
|
| 983 | + |
|
| 984 | + /** |
|
| 985 | + * Returns information from a single calendar object, based on it's object |
|
| 986 | + * uri. |
|
| 987 | + * |
|
| 988 | + * The object uri is only the basename, or filename and not a full path. |
|
| 989 | + * |
|
| 990 | + * The returned array must have the same keys as getCalendarObjects. The |
|
| 991 | + * 'calendardata' object is required here though, while it's not required |
|
| 992 | + * for getCalendarObjects. |
|
| 993 | + * |
|
| 994 | + * This method must return null if the object did not exist. |
|
| 995 | + * |
|
| 996 | + * @param mixed $calendarId |
|
| 997 | + * @param string $objectUri |
|
| 998 | + * @param int $calendarType |
|
| 999 | + * @return array|null |
|
| 1000 | + */ |
|
| 1001 | + public function getCalendarObject($calendarId, $objectUri, $calendarType = self::CALENDAR_TYPE_CALENDAR) { |
|
| 1002 | + $query = $this->db->getQueryBuilder(); |
|
| 1003 | + $query->select(['id', 'uri', 'lastmodified', 'etag', 'calendarid', 'size', 'calendardata', 'componenttype', 'classification']) |
|
| 1004 | + ->from('calendarobjects') |
|
| 1005 | + ->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId))) |
|
| 1006 | + ->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri))) |
|
| 1007 | + ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType))); |
|
| 1008 | + $stmt = $query->executeQuery(); |
|
| 1009 | + $row = $stmt->fetch(); |
|
| 1010 | + $stmt->closeCursor(); |
|
| 1011 | + |
|
| 1012 | + if (!$row) { |
|
| 1013 | + return null; |
|
| 1014 | + } |
|
| 1015 | + |
|
| 1016 | + return [ |
|
| 1017 | + 'id' => $row['id'], |
|
| 1018 | + 'uri' => $row['uri'], |
|
| 1019 | + 'lastmodified' => $row['lastmodified'], |
|
| 1020 | + 'etag' => '"' . $row['etag'] . '"', |
|
| 1021 | + 'calendarid' => $row['calendarid'], |
|
| 1022 | + 'size' => (int)$row['size'], |
|
| 1023 | + 'calendardata' => $this->readBlob($row['calendardata']), |
|
| 1024 | + 'component' => strtolower($row['componenttype']), |
|
| 1025 | + 'classification' => (int)$row['classification'] |
|
| 1026 | + ]; |
|
| 1027 | + } |
|
| 1028 | + |
|
| 1029 | + /** |
|
| 1030 | + * Returns a list of calendar objects. |
|
| 1031 | + * |
|
| 1032 | + * This method should work identical to getCalendarObject, but instead |
|
| 1033 | + * return all the calendar objects in the list as an array. |
|
| 1034 | + * |
|
| 1035 | + * If the backend supports this, it may allow for some speed-ups. |
|
| 1036 | + * |
|
| 1037 | + * @param mixed $calendarId |
|
| 1038 | + * @param string[] $uris |
|
| 1039 | + * @param int $calendarType |
|
| 1040 | + * @return array |
|
| 1041 | + */ |
|
| 1042 | + public function getMultipleCalendarObjects($calendarId, array $uris, $calendarType = self::CALENDAR_TYPE_CALENDAR):array { |
|
| 1043 | + if (empty($uris)) { |
|
| 1044 | + return []; |
|
| 1045 | + } |
|
| 1046 | + |
|
| 1047 | + $chunks = array_chunk($uris, 100); |
|
| 1048 | + $objects = []; |
|
| 1049 | + |
|
| 1050 | + $query = $this->db->getQueryBuilder(); |
|
| 1051 | + $query->select(['id', 'uri', 'lastmodified', 'etag', 'calendarid', 'size', 'calendardata', 'componenttype', 'classification']) |
|
| 1052 | + ->from('calendarobjects') |
|
| 1053 | + ->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId))) |
|
| 1054 | + ->andWhere($query->expr()->in('uri', $query->createParameter('uri'))) |
|
| 1055 | + ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType))); |
|
| 1056 | + |
|
| 1057 | + foreach ($chunks as $uris) { |
|
| 1058 | + $query->setParameter('uri', $uris, IQueryBuilder::PARAM_STR_ARRAY); |
|
| 1059 | + $result = $query->executeQuery(); |
|
| 1060 | + |
|
| 1061 | + while ($row = $result->fetch()) { |
|
| 1062 | + $objects[] = [ |
|
| 1063 | + 'id' => $row['id'], |
|
| 1064 | + 'uri' => $row['uri'], |
|
| 1065 | + 'lastmodified' => $row['lastmodified'], |
|
| 1066 | + 'etag' => '"' . $row['etag'] . '"', |
|
| 1067 | + 'calendarid' => $row['calendarid'], |
|
| 1068 | + 'size' => (int)$row['size'], |
|
| 1069 | + 'calendardata' => $this->readBlob($row['calendardata']), |
|
| 1070 | + 'component' => strtolower($row['componenttype']), |
|
| 1071 | + 'classification' => (int)$row['classification'] |
|
| 1072 | + ]; |
|
| 1073 | + } |
|
| 1074 | + $result->closeCursor(); |
|
| 1075 | + } |
|
| 1076 | + |
|
| 1077 | + return $objects; |
|
| 1078 | + } |
|
| 1079 | + |
|
| 1080 | + /** |
|
| 1081 | + * Creates a new calendar object. |
|
| 1082 | + * |
|
| 1083 | + * The object uri is only the basename, or filename and not a full path. |
|
| 1084 | + * |
|
| 1085 | + * It is possible return an etag from this function, which will be used in |
|
| 1086 | + * the response to this PUT request. Note that the ETag must be surrounded |
|
| 1087 | + * by double-quotes. |
|
| 1088 | + * |
|
| 1089 | + * However, you should only really return this ETag if you don't mangle the |
|
| 1090 | + * calendar-data. If the result of a subsequent GET to this object is not |
|
| 1091 | + * the exact same as this request body, you should omit the ETag. |
|
| 1092 | + * |
|
| 1093 | + * @param mixed $calendarId |
|
| 1094 | + * @param string $objectUri |
|
| 1095 | + * @param string $calendarData |
|
| 1096 | + * @param int $calendarType |
|
| 1097 | + * @return string |
|
| 1098 | + */ |
|
| 1099 | + public function createCalendarObject($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) { |
|
| 1100 | + $extraData = $this->getDenormalizedData($calendarData); |
|
| 1101 | + |
|
| 1102 | + $q = $this->db->getQueryBuilder(); |
|
| 1103 | + $q->select($q->func()->count('*')) |
|
| 1104 | + ->from('calendarobjects') |
|
| 1105 | + ->where($q->expr()->eq('calendarid', $q->createNamedParameter($calendarId))) |
|
| 1106 | + ->andWhere($q->expr()->eq('uid', $q->createNamedParameter($extraData['uid']))) |
|
| 1107 | + ->andWhere($q->expr()->eq('calendartype', $q->createNamedParameter($calendarType))); |
|
| 1108 | + |
|
| 1109 | + $result = $q->executeQuery(); |
|
| 1110 | + $count = (int) $result->fetchOne(); |
|
| 1111 | + $result->closeCursor(); |
|
| 1112 | + |
|
| 1113 | + if ($count !== 0) { |
|
| 1114 | + throw new \Sabre\DAV\Exception\BadRequest('Calendar object with uid already exists in this calendar collection.'); |
|
| 1115 | + } |
|
| 1116 | + |
|
| 1117 | + $query = $this->db->getQueryBuilder(); |
|
| 1118 | + $query->insert('calendarobjects') |
|
| 1119 | + ->values([ |
|
| 1120 | + 'calendarid' => $query->createNamedParameter($calendarId), |
|
| 1121 | + 'uri' => $query->createNamedParameter($objectUri), |
|
| 1122 | + 'calendardata' => $query->createNamedParameter($calendarData, IQueryBuilder::PARAM_LOB), |
|
| 1123 | + 'lastmodified' => $query->createNamedParameter(time()), |
|
| 1124 | + 'etag' => $query->createNamedParameter($extraData['etag']), |
|
| 1125 | + 'size' => $query->createNamedParameter($extraData['size']), |
|
| 1126 | + 'componenttype' => $query->createNamedParameter($extraData['componentType']), |
|
| 1127 | + 'firstoccurence' => $query->createNamedParameter($extraData['firstOccurence']), |
|
| 1128 | + 'lastoccurence' => $query->createNamedParameter($extraData['lastOccurence']), |
|
| 1129 | + 'classification' => $query->createNamedParameter($extraData['classification']), |
|
| 1130 | + 'uid' => $query->createNamedParameter($extraData['uid']), |
|
| 1131 | + 'calendartype' => $query->createNamedParameter($calendarType), |
|
| 1132 | + ]) |
|
| 1133 | + ->executeStatement(); |
|
| 1134 | + |
|
| 1135 | + $this->updateProperties($calendarId, $objectUri, $calendarData, $calendarType); |
|
| 1136 | + $this->addChange($calendarId, $objectUri, 1, $calendarType); |
|
| 1137 | + |
|
| 1138 | + $objectRow = $this->getCalendarObject($calendarId, $objectUri, $calendarType); |
|
| 1139 | + if ($calendarType === self::CALENDAR_TYPE_CALENDAR) { |
|
| 1140 | + $calendarRow = $this->getCalendarById($calendarId); |
|
| 1141 | + $shares = $this->getShares($calendarId); |
|
| 1142 | + |
|
| 1143 | + $this->dispatcher->dispatchTyped(new CalendarObjectCreatedEvent((int)$calendarId, $calendarRow, $shares, $objectRow)); |
|
| 1144 | + } else { |
|
| 1145 | + $subscriptionRow = $this->getSubscriptionById($calendarId); |
|
| 1146 | + |
|
| 1147 | + $this->dispatcher->dispatchTyped(new CachedCalendarObjectCreatedEvent((int)$calendarId, $subscriptionRow, [], $objectRow)); |
|
| 1148 | + $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::createCachedCalendarObject', new GenericEvent( |
|
| 1149 | + '\OCA\DAV\CalDAV\CalDavBackend::createCachedCalendarObject', |
|
| 1150 | + [ |
|
| 1151 | + 'subscriptionId' => $calendarId, |
|
| 1152 | + 'calendarData' => $subscriptionRow, |
|
| 1153 | + 'shares' => [], |
|
| 1154 | + 'objectData' => $objectRow, |
|
| 1155 | + ] |
|
| 1156 | + )); |
|
| 1157 | + } |
|
| 1158 | + |
|
| 1159 | + return '"' . $extraData['etag'] . '"'; |
|
| 1160 | + } |
|
| 1161 | + |
|
| 1162 | + /** |
|
| 1163 | + * Updates an existing calendarobject, based on it's uri. |
|
| 1164 | + * |
|
| 1165 | + * The object uri is only the basename, or filename and not a full path. |
|
| 1166 | + * |
|
| 1167 | + * It is possible return an etag from this function, which will be used in |
|
| 1168 | + * the response to this PUT request. Note that the ETag must be surrounded |
|
| 1169 | + * by double-quotes. |
|
| 1170 | + * |
|
| 1171 | + * However, you should only really return this ETag if you don't mangle the |
|
| 1172 | + * calendar-data. If the result of a subsequent GET to this object is not |
|
| 1173 | + * the exact same as this request body, you should omit the ETag. |
|
| 1174 | + * |
|
| 1175 | + * @param mixed $calendarId |
|
| 1176 | + * @param string $objectUri |
|
| 1177 | + * @param string $calendarData |
|
| 1178 | + * @param int $calendarType |
|
| 1179 | + * @return string |
|
| 1180 | + */ |
|
| 1181 | + public function updateCalendarObject($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) { |
|
| 1182 | + $extraData = $this->getDenormalizedData($calendarData); |
|
| 1183 | + $query = $this->db->getQueryBuilder(); |
|
| 1184 | + $query->update('calendarobjects') |
|
| 1185 | + ->set('calendardata', $query->createNamedParameter($calendarData, IQueryBuilder::PARAM_LOB)) |
|
| 1186 | + ->set('lastmodified', $query->createNamedParameter(time())) |
|
| 1187 | + ->set('etag', $query->createNamedParameter($extraData['etag'])) |
|
| 1188 | + ->set('size', $query->createNamedParameter($extraData['size'])) |
|
| 1189 | + ->set('componenttype', $query->createNamedParameter($extraData['componentType'])) |
|
| 1190 | + ->set('firstoccurence', $query->createNamedParameter($extraData['firstOccurence'])) |
|
| 1191 | + ->set('lastoccurence', $query->createNamedParameter($extraData['lastOccurence'])) |
|
| 1192 | + ->set('classification', $query->createNamedParameter($extraData['classification'])) |
|
| 1193 | + ->set('uid', $query->createNamedParameter($extraData['uid'])) |
|
| 1194 | + ->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId))) |
|
| 1195 | + ->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri))) |
|
| 1196 | + ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType))) |
|
| 1197 | + ->executeStatement(); |
|
| 1198 | + |
|
| 1199 | + $this->updateProperties($calendarId, $objectUri, $calendarData, $calendarType); |
|
| 1200 | + $this->addChange($calendarId, $objectUri, 2, $calendarType); |
|
| 1201 | + |
|
| 1202 | + $objectRow = $this->getCalendarObject($calendarId, $objectUri, $calendarType); |
|
| 1203 | + if (is_array($objectRow)) { |
|
| 1204 | + if ($calendarType === self::CALENDAR_TYPE_CALENDAR) { |
|
| 1205 | + $calendarRow = $this->getCalendarById($calendarId); |
|
| 1206 | + $shares = $this->getShares($calendarId); |
|
| 1207 | + |
|
| 1208 | + $this->dispatcher->dispatchTyped(new CalendarObjectUpdatedEvent((int)$calendarId, $calendarRow, $shares, $objectRow)); |
|
| 1209 | + } else { |
|
| 1210 | + $subscriptionRow = $this->getSubscriptionById($calendarId); |
|
| 1211 | + |
|
| 1212 | + $this->dispatcher->dispatchTyped(new CachedCalendarObjectUpdatedEvent((int)$calendarId, $subscriptionRow, [], $objectRow)); |
|
| 1213 | + $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateCachedCalendarObject', new GenericEvent( |
|
| 1214 | + '\OCA\DAV\CalDAV\CalDavBackend::updateCachedCalendarObject', |
|
| 1215 | + [ |
|
| 1216 | + 'subscriptionId' => $calendarId, |
|
| 1217 | + 'calendarData' => $subscriptionRow, |
|
| 1218 | + 'shares' => [], |
|
| 1219 | + 'objectData' => $objectRow, |
|
| 1220 | + ] |
|
| 1221 | + )); |
|
| 1222 | + } |
|
| 1223 | + } |
|
| 1224 | + |
|
| 1225 | + return '"' . $extraData['etag'] . '"'; |
|
| 1226 | + } |
|
| 1227 | + |
|
| 1228 | + /** |
|
| 1229 | + * @param int $calendarObjectId |
|
| 1230 | + * @param int $classification |
|
| 1231 | + */ |
|
| 1232 | + public function setClassification($calendarObjectId, $classification) { |
|
| 1233 | + if (!in_array($classification, [ |
|
| 1234 | + self::CLASSIFICATION_PUBLIC, self::CLASSIFICATION_PRIVATE, self::CLASSIFICATION_CONFIDENTIAL |
|
| 1235 | + ])) { |
|
| 1236 | + throw new \InvalidArgumentException(); |
|
| 1237 | + } |
|
| 1238 | + $query = $this->db->getQueryBuilder(); |
|
| 1239 | + $query->update('calendarobjects') |
|
| 1240 | + ->set('classification', $query->createNamedParameter($classification)) |
|
| 1241 | + ->where($query->expr()->eq('id', $query->createNamedParameter($calendarObjectId))) |
|
| 1242 | + ->executeStatement(); |
|
| 1243 | + } |
|
| 1244 | + |
|
| 1245 | + /** |
|
| 1246 | + * Deletes an existing calendar object. |
|
| 1247 | + * |
|
| 1248 | + * The object uri is only the basename, or filename and not a full path. |
|
| 1249 | + * |
|
| 1250 | + * @param mixed $calendarId |
|
| 1251 | + * @param string $objectUri |
|
| 1252 | + * @param int $calendarType |
|
| 1253 | + * @return void |
|
| 1254 | + */ |
|
| 1255 | + public function deleteCalendarObject($calendarId, $objectUri, $calendarType = self::CALENDAR_TYPE_CALENDAR) { |
|
| 1256 | + $data = $this->getCalendarObject($calendarId, $objectUri, $calendarType); |
|
| 1257 | + if (is_array($data)) { |
|
| 1258 | + if ($calendarType === self::CALENDAR_TYPE_CALENDAR) { |
|
| 1259 | + $calendarRow = $this->getCalendarById($calendarId); |
|
| 1260 | + $shares = $this->getShares($calendarId); |
|
| 1261 | + |
|
| 1262 | + $this->dispatcher->dispatchTyped(new CalendarObjectDeletedEvent((int)$calendarId, $calendarRow, $shares, $data)); |
|
| 1263 | + } else { |
|
| 1264 | + $subscriptionRow = $this->getSubscriptionById($calendarId); |
|
| 1265 | + |
|
| 1266 | + $this->dispatcher->dispatchTyped(new CachedCalendarObjectDeletedEvent((int)$calendarId, $subscriptionRow, [], $data)); |
|
| 1267 | + $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::deleteCachedCalendarObject', new GenericEvent( |
|
| 1268 | + '\OCA\DAV\CalDAV\CalDavBackend::deleteCachedCalendarObject', |
|
| 1269 | + [ |
|
| 1270 | + 'subscriptionId' => $calendarId, |
|
| 1271 | + 'calendarData' => $subscriptionRow, |
|
| 1272 | + 'shares' => [], |
|
| 1273 | + 'objectData' => $data, |
|
| 1274 | + ] |
|
| 1275 | + )); |
|
| 1276 | + } |
|
| 1277 | + } |
|
| 1278 | + |
|
| 1279 | + $stmt = $this->db->prepare('DELETE FROM `*PREFIX*calendarobjects` WHERE `calendarid` = ? AND `uri` = ? AND `calendartype` = ?'); |
|
| 1280 | + $stmt->execute([$calendarId, $objectUri, $calendarType]); |
|
| 1281 | + |
|
| 1282 | + if (is_array($data)) { |
|
| 1283 | + $this->purgeProperties($calendarId, $data['id'], $calendarType); |
|
| 1284 | + } |
|
| 1285 | + |
|
| 1286 | + $this->addChange($calendarId, $objectUri, 3, $calendarType); |
|
| 1287 | + } |
|
| 1288 | + |
|
| 1289 | + /** |
|
| 1290 | + * Performs a calendar-query on the contents of this calendar. |
|
| 1291 | + * |
|
| 1292 | + * The calendar-query is defined in RFC4791 : CalDAV. Using the |
|
| 1293 | + * calendar-query it is possible for a client to request a specific set of |
|
| 1294 | + * object, based on contents of iCalendar properties, date-ranges and |
|
| 1295 | + * iCalendar component types (VTODO, VEVENT). |
|
| 1296 | + * |
|
| 1297 | + * This method should just return a list of (relative) urls that match this |
|
| 1298 | + * query. |
|
| 1299 | + * |
|
| 1300 | + * The list of filters are specified as an array. The exact array is |
|
| 1301 | + * documented by Sabre\CalDAV\CalendarQueryParser. |
|
| 1302 | + * |
|
| 1303 | + * Note that it is extremely likely that getCalendarObject for every path |
|
| 1304 | + * returned from this method will be called almost immediately after. You |
|
| 1305 | + * may want to anticipate this to speed up these requests. |
|
| 1306 | + * |
|
| 1307 | + * This method provides a default implementation, which parses *all* the |
|
| 1308 | + * iCalendar objects in the specified calendar. |
|
| 1309 | + * |
|
| 1310 | + * This default may well be good enough for personal use, and calendars |
|
| 1311 | + * that aren't very large. But if you anticipate high usage, big calendars |
|
| 1312 | + * or high loads, you are strongly advised to optimize certain paths. |
|
| 1313 | + * |
|
| 1314 | + * The best way to do so is override this method and to optimize |
|
| 1315 | + * specifically for 'common filters'. |
|
| 1316 | + * |
|
| 1317 | + * Requests that are extremely common are: |
|
| 1318 | + * * requests for just VEVENTS |
|
| 1319 | + * * requests for just VTODO |
|
| 1320 | + * * requests with a time-range-filter on either VEVENT or VTODO. |
|
| 1321 | + * |
|
| 1322 | + * ..and combinations of these requests. It may not be worth it to try to |
|
| 1323 | + * handle every possible situation and just rely on the (relatively |
|
| 1324 | + * easy to use) CalendarQueryValidator to handle the rest. |
|
| 1325 | + * |
|
| 1326 | + * Note that especially time-range-filters may be difficult to parse. A |
|
| 1327 | + * time-range filter specified on a VEVENT must for instance also handle |
|
| 1328 | + * recurrence rules correctly. |
|
| 1329 | + * A good example of how to interprete all these filters can also simply |
|
| 1330 | + * be found in Sabre\CalDAV\CalendarQueryFilter. This class is as correct |
|
| 1331 | + * as possible, so it gives you a good idea on what type of stuff you need |
|
| 1332 | + * to think of. |
|
| 1333 | + * |
|
| 1334 | + * @param mixed $calendarId |
|
| 1335 | + * @param array $filters |
|
| 1336 | + * @param int $calendarType |
|
| 1337 | + * @return array |
|
| 1338 | + */ |
|
| 1339 | + public function calendarQuery($calendarId, array $filters, $calendarType = self::CALENDAR_TYPE_CALENDAR):array { |
|
| 1340 | + $componentType = null; |
|
| 1341 | + $requirePostFilter = true; |
|
| 1342 | + $timeRange = null; |
|
| 1343 | + |
|
| 1344 | + // if no filters were specified, we don't need to filter after a query |
|
| 1345 | + if (!$filters['prop-filters'] && !$filters['comp-filters']) { |
|
| 1346 | + $requirePostFilter = false; |
|
| 1347 | + } |
|
| 1348 | + |
|
| 1349 | + // Figuring out if there's a component filter |
|
| 1350 | + if (count($filters['comp-filters']) > 0 && !$filters['comp-filters'][0]['is-not-defined']) { |
|
| 1351 | + $componentType = $filters['comp-filters'][0]['name']; |
|
| 1352 | + |
|
| 1353 | + // Checking if we need post-filters |
|
| 1354 | + if (!$filters['prop-filters'] && !$filters['comp-filters'][0]['comp-filters'] && !$filters['comp-filters'][0]['time-range'] && !$filters['comp-filters'][0]['prop-filters']) { |
|
| 1355 | + $requirePostFilter = false; |
|
| 1356 | + } |
|
| 1357 | + // There was a time-range filter |
|
| 1358 | + if ($componentType === 'VEVENT' && isset($filters['comp-filters'][0]['time-range']) && is_array($filters['comp-filters'][0]['time-range'])) { |
|
| 1359 | + $timeRange = $filters['comp-filters'][0]['time-range']; |
|
| 1360 | + |
|
| 1361 | + // If start time OR the end time is not specified, we can do a |
|
| 1362 | + // 100% accurate mysql query. |
|
| 1363 | + if (!$filters['prop-filters'] && !$filters['comp-filters'][0]['comp-filters'] && !$filters['comp-filters'][0]['prop-filters'] && (!$timeRange['start'] || !$timeRange['end'])) { |
|
| 1364 | + $requirePostFilter = false; |
|
| 1365 | + } |
|
| 1366 | + } |
|
| 1367 | + } |
|
| 1368 | + $columns = ['uri']; |
|
| 1369 | + if ($requirePostFilter) { |
|
| 1370 | + $columns = ['uri', 'calendardata']; |
|
| 1371 | + } |
|
| 1372 | + $query = $this->db->getQueryBuilder(); |
|
| 1373 | + $query->select($columns) |
|
| 1374 | + ->from('calendarobjects') |
|
| 1375 | + ->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId))) |
|
| 1376 | + ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType))); |
|
| 1377 | + |
|
| 1378 | + if ($componentType) { |
|
| 1379 | + $query->andWhere($query->expr()->eq('componenttype', $query->createNamedParameter($componentType))); |
|
| 1380 | + } |
|
| 1381 | + |
|
| 1382 | + if ($timeRange && $timeRange['start']) { |
|
| 1383 | + $query->andWhere($query->expr()->gt('lastoccurence', $query->createNamedParameter($timeRange['start']->getTimeStamp()))); |
|
| 1384 | + } |
|
| 1385 | + if ($timeRange && $timeRange['end']) { |
|
| 1386 | + $query->andWhere($query->expr()->lt('firstoccurence', $query->createNamedParameter($timeRange['end']->getTimeStamp()))); |
|
| 1387 | + } |
|
| 1388 | + |
|
| 1389 | + $stmt = $query->executeQuery(); |
|
| 1390 | + |
|
| 1391 | + $result = []; |
|
| 1392 | + while ($row = $stmt->fetch()) { |
|
| 1393 | + if ($requirePostFilter) { |
|
| 1394 | + // validateFilterForObject will parse the calendar data |
|
| 1395 | + // catch parsing errors |
|
| 1396 | + try { |
|
| 1397 | + $matches = $this->validateFilterForObject($row, $filters); |
|
| 1398 | + } catch (ParseException $ex) { |
|
| 1399 | + $this->logger->logException($ex, [ |
|
| 1400 | + 'app' => 'dav', |
|
| 1401 | + 'message' => 'Caught parsing exception for calendar data. This usually indicates invalid calendar data. calendar-id:'.$calendarId.' uri:'.$row['uri'] |
|
| 1402 | + ]); |
|
| 1403 | + continue; |
|
| 1404 | + } catch (InvalidDataException $ex) { |
|
| 1405 | + $this->logger->logException($ex, [ |
|
| 1406 | + 'app' => 'dav', |
|
| 1407 | + 'message' => 'Caught invalid data exception for calendar data. This usually indicates invalid calendar data. calendar-id:'.$calendarId.' uri:'.$row['uri'] |
|
| 1408 | + ]); |
|
| 1409 | + continue; |
|
| 1410 | + } |
|
| 1411 | + |
|
| 1412 | + if (!$matches) { |
|
| 1413 | + continue; |
|
| 1414 | + } |
|
| 1415 | + } |
|
| 1416 | + $result[] = $row['uri']; |
|
| 1417 | + } |
|
| 1418 | + |
|
| 1419 | + return $result; |
|
| 1420 | + } |
|
| 1421 | + |
|
| 1422 | + /** |
|
| 1423 | + * custom Nextcloud search extension for CalDAV |
|
| 1424 | + * |
|
| 1425 | + * TODO - this should optionally cover cached calendar objects as well |
|
| 1426 | + * |
|
| 1427 | + * @param string $principalUri |
|
| 1428 | + * @param array $filters |
|
| 1429 | + * @param integer|null $limit |
|
| 1430 | + * @param integer|null $offset |
|
| 1431 | + * @return array |
|
| 1432 | + */ |
|
| 1433 | + public function calendarSearch($principalUri, array $filters, $limit = null, $offset = null) { |
|
| 1434 | + $calendars = $this->getCalendarsForUser($principalUri); |
|
| 1435 | + $ownCalendars = []; |
|
| 1436 | + $sharedCalendars = []; |
|
| 1437 | + |
|
| 1438 | + $uriMapper = []; |
|
| 1439 | + |
|
| 1440 | + foreach ($calendars as $calendar) { |
|
| 1441 | + if ($calendar['{http://owncloud.org/ns}owner-principal'] === $principalUri) { |
|
| 1442 | + $ownCalendars[] = $calendar['id']; |
|
| 1443 | + } else { |
|
| 1444 | + $sharedCalendars[] = $calendar['id']; |
|
| 1445 | + } |
|
| 1446 | + $uriMapper[$calendar['id']] = $calendar['uri']; |
|
| 1447 | + } |
|
| 1448 | + if (count($ownCalendars) === 0 && count($sharedCalendars) === 0) { |
|
| 1449 | + return []; |
|
| 1450 | + } |
|
| 1451 | + |
|
| 1452 | + $query = $this->db->getQueryBuilder(); |
|
| 1453 | + // Calendar id expressions |
|
| 1454 | + $calendarExpressions = []; |
|
| 1455 | + foreach ($ownCalendars as $id) { |
|
| 1456 | + $calendarExpressions[] = $query->expr()->andX( |
|
| 1457 | + $query->expr()->eq('c.calendarid', |
|
| 1458 | + $query->createNamedParameter($id)), |
|
| 1459 | + $query->expr()->eq('c.calendartype', |
|
| 1460 | + $query->createNamedParameter(self::CALENDAR_TYPE_CALENDAR))); |
|
| 1461 | + } |
|
| 1462 | + foreach ($sharedCalendars as $id) { |
|
| 1463 | + $calendarExpressions[] = $query->expr()->andX( |
|
| 1464 | + $query->expr()->eq('c.calendarid', |
|
| 1465 | + $query->createNamedParameter($id)), |
|
| 1466 | + $query->expr()->eq('c.classification', |
|
| 1467 | + $query->createNamedParameter(self::CLASSIFICATION_PUBLIC)), |
|
| 1468 | + $query->expr()->eq('c.calendartype', |
|
| 1469 | + $query->createNamedParameter(self::CALENDAR_TYPE_CALENDAR))); |
|
| 1470 | + } |
|
| 1471 | + |
|
| 1472 | + if (count($calendarExpressions) === 1) { |
|
| 1473 | + $calExpr = $calendarExpressions[0]; |
|
| 1474 | + } else { |
|
| 1475 | + $calExpr = call_user_func_array([$query->expr(), 'orX'], $calendarExpressions); |
|
| 1476 | + } |
|
| 1477 | + |
|
| 1478 | + // Component expressions |
|
| 1479 | + $compExpressions = []; |
|
| 1480 | + foreach ($filters['comps'] as $comp) { |
|
| 1481 | + $compExpressions[] = $query->expr() |
|
| 1482 | + ->eq('c.componenttype', $query->createNamedParameter($comp)); |
|
| 1483 | + } |
|
| 1484 | + |
|
| 1485 | + if (count($compExpressions) === 1) { |
|
| 1486 | + $compExpr = $compExpressions[0]; |
|
| 1487 | + } else { |
|
| 1488 | + $compExpr = call_user_func_array([$query->expr(), 'orX'], $compExpressions); |
|
| 1489 | + } |
|
| 1490 | + |
|
| 1491 | + if (!isset($filters['props'])) { |
|
| 1492 | + $filters['props'] = []; |
|
| 1493 | + } |
|
| 1494 | + if (!isset($filters['params'])) { |
|
| 1495 | + $filters['params'] = []; |
|
| 1496 | + } |
|
| 1497 | + |
|
| 1498 | + $propParamExpressions = []; |
|
| 1499 | + foreach ($filters['props'] as $prop) { |
|
| 1500 | + $propParamExpressions[] = $query->expr()->andX( |
|
| 1501 | + $query->expr()->eq('i.name', $query->createNamedParameter($prop)), |
|
| 1502 | + $query->expr()->isNull('i.parameter') |
|
| 1503 | + ); |
|
| 1504 | + } |
|
| 1505 | + foreach ($filters['params'] as $param) { |
|
| 1506 | + $propParamExpressions[] = $query->expr()->andX( |
|
| 1507 | + $query->expr()->eq('i.name', $query->createNamedParameter($param['property'])), |
|
| 1508 | + $query->expr()->eq('i.parameter', $query->createNamedParameter($param['parameter'])) |
|
| 1509 | + ); |
|
| 1510 | + } |
|
| 1511 | + |
|
| 1512 | + if (count($propParamExpressions) === 1) { |
|
| 1513 | + $propParamExpr = $propParamExpressions[0]; |
|
| 1514 | + } else { |
|
| 1515 | + $propParamExpr = call_user_func_array([$query->expr(), 'orX'], $propParamExpressions); |
|
| 1516 | + } |
|
| 1517 | + |
|
| 1518 | + $query->select(['c.calendarid', 'c.uri']) |
|
| 1519 | + ->from($this->dbObjectPropertiesTable, 'i') |
|
| 1520 | + ->join('i', 'calendarobjects', 'c', $query->expr()->eq('i.objectid', 'c.id')) |
|
| 1521 | + ->where($calExpr) |
|
| 1522 | + ->andWhere($compExpr) |
|
| 1523 | + ->andWhere($propParamExpr) |
|
| 1524 | + ->andWhere($query->expr()->iLike('i.value', |
|
| 1525 | + $query->createNamedParameter('%'.$this->db->escapeLikeParameter($filters['search-term']).'%'))); |
|
| 1526 | + |
|
| 1527 | + if ($offset) { |
|
| 1528 | + $query->setFirstResult($offset); |
|
| 1529 | + } |
|
| 1530 | + if ($limit) { |
|
| 1531 | + $query->setMaxResults($limit); |
|
| 1532 | + } |
|
| 1533 | + |
|
| 1534 | + $stmt = $query->executeQuery(); |
|
| 1535 | + |
|
| 1536 | + $result = []; |
|
| 1537 | + while ($row = $stmt->fetch()) { |
|
| 1538 | + $path = $uriMapper[$row['calendarid']] . '/' . $row['uri']; |
|
| 1539 | + if (!in_array($path, $result)) { |
|
| 1540 | + $result[] = $path; |
|
| 1541 | + } |
|
| 1542 | + } |
|
| 1543 | + |
|
| 1544 | + return $result; |
|
| 1545 | + } |
|
| 1546 | + |
|
| 1547 | + /** |
|
| 1548 | + * used for Nextcloud's calendar API |
|
| 1549 | + * |
|
| 1550 | + * @param array $calendarInfo |
|
| 1551 | + * @param string $pattern |
|
| 1552 | + * @param array $searchProperties |
|
| 1553 | + * @param array $options |
|
| 1554 | + * @param integer|null $limit |
|
| 1555 | + * @param integer|null $offset |
|
| 1556 | + * |
|
| 1557 | + * @return array |
|
| 1558 | + */ |
|
| 1559 | + public function search(array $calendarInfo, $pattern, array $searchProperties, |
|
| 1560 | + array $options, $limit, $offset) { |
|
| 1561 | + $outerQuery = $this->db->getQueryBuilder(); |
|
| 1562 | + $innerQuery = $this->db->getQueryBuilder(); |
|
| 1563 | + |
|
| 1564 | + $innerQuery->selectDistinct('op.objectid') |
|
| 1565 | + ->from($this->dbObjectPropertiesTable, 'op') |
|
| 1566 | + ->andWhere($innerQuery->expr()->eq('op.calendarid', |
|
| 1567 | + $outerQuery->createNamedParameter($calendarInfo['id']))) |
|
| 1568 | + ->andWhere($innerQuery->expr()->eq('op.calendartype', |
|
| 1569 | + $outerQuery->createNamedParameter(self::CALENDAR_TYPE_CALENDAR))); |
|
| 1570 | + |
|
| 1571 | + // only return public items for shared calendars for now |
|
| 1572 | + if ($calendarInfo['principaluri'] !== $calendarInfo['{http://owncloud.org/ns}owner-principal']) { |
|
| 1573 | + $innerQuery->andWhere($innerQuery->expr()->eq('c.classification', |
|
| 1574 | + $outerQuery->createNamedParameter(self::CLASSIFICATION_PUBLIC))); |
|
| 1575 | + } |
|
| 1576 | + |
|
| 1577 | + $or = $innerQuery->expr()->orX(); |
|
| 1578 | + foreach ($searchProperties as $searchProperty) { |
|
| 1579 | + $or->add($innerQuery->expr()->eq('op.name', |
|
| 1580 | + $outerQuery->createNamedParameter($searchProperty))); |
|
| 1581 | + } |
|
| 1582 | + $innerQuery->andWhere($or); |
|
| 1583 | + |
|
| 1584 | + if ($pattern !== '') { |
|
| 1585 | + $innerQuery->andWhere($innerQuery->expr()->iLike('op.value', |
|
| 1586 | + $outerQuery->createNamedParameter('%' . |
|
| 1587 | + $this->db->escapeLikeParameter($pattern) . '%'))); |
|
| 1588 | + } |
|
| 1589 | + |
|
| 1590 | + $outerQuery->select('c.id', 'c.calendardata', 'c.componenttype', 'c.uid', 'c.uri') |
|
| 1591 | + ->from('calendarobjects', 'c'); |
|
| 1592 | + |
|
| 1593 | + if (isset($options['timerange'])) { |
|
| 1594 | + if (isset($options['timerange']['start']) && $options['timerange']['start'] instanceof DateTime) { |
|
| 1595 | + $outerQuery->andWhere($outerQuery->expr()->gt('lastoccurence', |
|
| 1596 | + $outerQuery->createNamedParameter($options['timerange']['start']->getTimeStamp()))); |
|
| 1597 | + } |
|
| 1598 | + if (isset($options['timerange']['end']) && $options['timerange']['end'] instanceof DateTime) { |
|
| 1599 | + $outerQuery->andWhere($outerQuery->expr()->lt('firstoccurence', |
|
| 1600 | + $outerQuery->createNamedParameter($options['timerange']['end']->getTimeStamp()))); |
|
| 1601 | + } |
|
| 1602 | + } |
|
| 1603 | + |
|
| 1604 | + if (isset($options['types'])) { |
|
| 1605 | + $or = $outerQuery->expr()->orX(); |
|
| 1606 | + foreach ($options['types'] as $type) { |
|
| 1607 | + $or->add($outerQuery->expr()->eq('componenttype', |
|
| 1608 | + $outerQuery->createNamedParameter($type))); |
|
| 1609 | + } |
|
| 1610 | + $outerQuery->andWhere($or); |
|
| 1611 | + } |
|
| 1612 | + |
|
| 1613 | + $outerQuery->andWhere($outerQuery->expr()->in('c.id', |
|
| 1614 | + $outerQuery->createFunction($innerQuery->getSQL()))); |
|
| 1615 | + |
|
| 1616 | + if ($offset) { |
|
| 1617 | + $outerQuery->setFirstResult($offset); |
|
| 1618 | + } |
|
| 1619 | + if ($limit) { |
|
| 1620 | + $outerQuery->setMaxResults($limit); |
|
| 1621 | + } |
|
| 1622 | + |
|
| 1623 | + $result = $outerQuery->executeQuery(); |
|
| 1624 | + $calendarObjects = $result->fetchAll(); |
|
| 1625 | + |
|
| 1626 | + return array_map(function ($o) { |
|
| 1627 | + $calendarData = Reader::read($o['calendardata']); |
|
| 1628 | + $comps = $calendarData->getComponents(); |
|
| 1629 | + $objects = []; |
|
| 1630 | + $timezones = []; |
|
| 1631 | + foreach ($comps as $comp) { |
|
| 1632 | + if ($comp instanceof VTimeZone) { |
|
| 1633 | + $timezones[] = $comp; |
|
| 1634 | + } else { |
|
| 1635 | + $objects[] = $comp; |
|
| 1636 | + } |
|
| 1637 | + } |
|
| 1638 | + |
|
| 1639 | + return [ |
|
| 1640 | + 'id' => $o['id'], |
|
| 1641 | + 'type' => $o['componenttype'], |
|
| 1642 | + 'uid' => $o['uid'], |
|
| 1643 | + 'uri' => $o['uri'], |
|
| 1644 | + 'objects' => array_map(function ($c) { |
|
| 1645 | + return $this->transformSearchData($c); |
|
| 1646 | + }, $objects), |
|
| 1647 | + 'timezones' => array_map(function ($c) { |
|
| 1648 | + return $this->transformSearchData($c); |
|
| 1649 | + }, $timezones), |
|
| 1650 | + ]; |
|
| 1651 | + }, $calendarObjects); |
|
| 1652 | + } |
|
| 1653 | + |
|
| 1654 | + /** |
|
| 1655 | + * @param Component $comp |
|
| 1656 | + * @return array |
|
| 1657 | + */ |
|
| 1658 | + private function transformSearchData(Component $comp) { |
|
| 1659 | + $data = []; |
|
| 1660 | + /** @var Component[] $subComponents */ |
|
| 1661 | + $subComponents = $comp->getComponents(); |
|
| 1662 | + /** @var Property[] $properties */ |
|
| 1663 | + $properties = array_filter($comp->children(), function ($c) { |
|
| 1664 | + return $c instanceof Property; |
|
| 1665 | + }); |
|
| 1666 | + $validationRules = $comp->getValidationRules(); |
|
| 1667 | + |
|
| 1668 | + foreach ($subComponents as $subComponent) { |
|
| 1669 | + $name = $subComponent->name; |
|
| 1670 | + if (!isset($data[$name])) { |
|
| 1671 | + $data[$name] = []; |
|
| 1672 | + } |
|
| 1673 | + $data[$name][] = $this->transformSearchData($subComponent); |
|
| 1674 | + } |
|
| 1675 | + |
|
| 1676 | + foreach ($properties as $property) { |
|
| 1677 | + $name = $property->name; |
|
| 1678 | + if (!isset($validationRules[$name])) { |
|
| 1679 | + $validationRules[$name] = '*'; |
|
| 1680 | + } |
|
| 1681 | + |
|
| 1682 | + $rule = $validationRules[$property->name]; |
|
| 1683 | + if ($rule === '+' || $rule === '*') { // multiple |
|
| 1684 | + if (!isset($data[$name])) { |
|
| 1685 | + $data[$name] = []; |
|
| 1686 | + } |
|
| 1687 | + |
|
| 1688 | + $data[$name][] = $this->transformSearchProperty($property); |
|
| 1689 | + } else { // once |
|
| 1690 | + $data[$name] = $this->transformSearchProperty($property); |
|
| 1691 | + } |
|
| 1692 | + } |
|
| 1693 | + |
|
| 1694 | + return $data; |
|
| 1695 | + } |
|
| 1696 | + |
|
| 1697 | + /** |
|
| 1698 | + * @param Property $prop |
|
| 1699 | + * @return array |
|
| 1700 | + */ |
|
| 1701 | + private function transformSearchProperty(Property $prop) { |
|
| 1702 | + // No need to check Date, as it extends DateTime |
|
| 1703 | + if ($prop instanceof Property\ICalendar\DateTime) { |
|
| 1704 | + $value = $prop->getDateTime(); |
|
| 1705 | + } else { |
|
| 1706 | + $value = $prop->getValue(); |
|
| 1707 | + } |
|
| 1708 | + |
|
| 1709 | + return [ |
|
| 1710 | + $value, |
|
| 1711 | + $prop->parameters() |
|
| 1712 | + ]; |
|
| 1713 | + } |
|
| 1714 | + |
|
| 1715 | + /** |
|
| 1716 | + * @param string $principalUri |
|
| 1717 | + * @param string $pattern |
|
| 1718 | + * @param array $componentTypes |
|
| 1719 | + * @param array $searchProperties |
|
| 1720 | + * @param array $searchParameters |
|
| 1721 | + * @param array $options |
|
| 1722 | + * @return array |
|
| 1723 | + */ |
|
| 1724 | + public function searchPrincipalUri(string $principalUri, |
|
| 1725 | + string $pattern, |
|
| 1726 | + array $componentTypes, |
|
| 1727 | + array $searchProperties, |
|
| 1728 | + array $searchParameters, |
|
| 1729 | + array $options = []): array { |
|
| 1730 | + $escapePattern = !\array_key_exists('escape_like_param', $options) || $options['escape_like_param'] !== false; |
|
| 1731 | + |
|
| 1732 | + $calendarObjectIdQuery = $this->db->getQueryBuilder(); |
|
| 1733 | + $calendarOr = $calendarObjectIdQuery->expr()->orX(); |
|
| 1734 | + $searchOr = $calendarObjectIdQuery->expr()->orX(); |
|
| 1735 | + |
|
| 1736 | + // Fetch calendars and subscription |
|
| 1737 | + $calendars = $this->getCalendarsForUser($principalUri); |
|
| 1738 | + $subscriptions = $this->getSubscriptionsForUser($principalUri); |
|
| 1739 | + foreach ($calendars as $calendar) { |
|
| 1740 | + $calendarAnd = $calendarObjectIdQuery->expr()->andX(); |
|
| 1741 | + $calendarAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int)$calendar['id']))); |
|
| 1742 | + $calendarAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendartype', $calendarObjectIdQuery->createNamedParameter(self::CALENDAR_TYPE_CALENDAR))); |
|
| 1743 | + |
|
| 1744 | + // If it's shared, limit search to public events |
|
| 1745 | + if (isset($calendar['{http://owncloud.org/ns}owner-principal']) |
|
| 1746 | + && $calendar['principaluri'] !== $calendar['{http://owncloud.org/ns}owner-principal']) { |
|
| 1747 | + $calendarAnd->add($calendarObjectIdQuery->expr()->eq('co.classification', $calendarObjectIdQuery->createNamedParameter(self::CLASSIFICATION_PUBLIC))); |
|
| 1748 | + } |
|
| 1749 | + |
|
| 1750 | + $calendarOr->add($calendarAnd); |
|
| 1751 | + } |
|
| 1752 | + foreach ($subscriptions as $subscription) { |
|
| 1753 | + $subscriptionAnd = $calendarObjectIdQuery->expr()->andX(); |
|
| 1754 | + $subscriptionAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int)$subscription['id']))); |
|
| 1755 | + $subscriptionAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendartype', $calendarObjectIdQuery->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION))); |
|
| 1756 | + |
|
| 1757 | + // If it's shared, limit search to public events |
|
| 1758 | + if (isset($subscription['{http://owncloud.org/ns}owner-principal']) |
|
| 1759 | + && $subscription['principaluri'] !== $subscription['{http://owncloud.org/ns}owner-principal']) { |
|
| 1760 | + $subscriptionAnd->add($calendarObjectIdQuery->expr()->eq('co.classification', $calendarObjectIdQuery->createNamedParameter(self::CLASSIFICATION_PUBLIC))); |
|
| 1761 | + } |
|
| 1762 | + |
|
| 1763 | + $calendarOr->add($subscriptionAnd); |
|
| 1764 | + } |
|
| 1765 | + |
|
| 1766 | + foreach ($searchProperties as $property) { |
|
| 1767 | + $propertyAnd = $calendarObjectIdQuery->expr()->andX(); |
|
| 1768 | + $propertyAnd->add($calendarObjectIdQuery->expr()->eq('cob.name', $calendarObjectIdQuery->createNamedParameter($property, IQueryBuilder::PARAM_STR))); |
|
| 1769 | + $propertyAnd->add($calendarObjectIdQuery->expr()->isNull('cob.parameter')); |
|
| 1770 | + |
|
| 1771 | + $searchOr->add($propertyAnd); |
|
| 1772 | + } |
|
| 1773 | + foreach ($searchParameters as $property => $parameter) { |
|
| 1774 | + $parameterAnd = $calendarObjectIdQuery->expr()->andX(); |
|
| 1775 | + $parameterAnd->add($calendarObjectIdQuery->expr()->eq('cob.name', $calendarObjectIdQuery->createNamedParameter($property, IQueryBuilder::PARAM_STR))); |
|
| 1776 | + $parameterAnd->add($calendarObjectIdQuery->expr()->eq('cob.parameter', $calendarObjectIdQuery->createNamedParameter($parameter, IQueryBuilder::PARAM_STR_ARRAY))); |
|
| 1777 | + |
|
| 1778 | + $searchOr->add($parameterAnd); |
|
| 1779 | + } |
|
| 1780 | + |
|
| 1781 | + if ($calendarOr->count() === 0) { |
|
| 1782 | + return []; |
|
| 1783 | + } |
|
| 1784 | + if ($searchOr->count() === 0) { |
|
| 1785 | + return []; |
|
| 1786 | + } |
|
| 1787 | + |
|
| 1788 | + $calendarObjectIdQuery->selectDistinct('cob.objectid') |
|
| 1789 | + ->from($this->dbObjectPropertiesTable, 'cob') |
|
| 1790 | + ->leftJoin('cob', 'calendarobjects', 'co', $calendarObjectIdQuery->expr()->eq('co.id', 'cob.objectid')) |
|
| 1791 | + ->andWhere($calendarObjectIdQuery->expr()->in('co.componenttype', $calendarObjectIdQuery->createNamedParameter($componentTypes, IQueryBuilder::PARAM_STR_ARRAY))) |
|
| 1792 | + ->andWhere($calendarOr) |
|
| 1793 | + ->andWhere($searchOr); |
|
| 1794 | + |
|
| 1795 | + if ('' !== $pattern) { |
|
| 1796 | + if (!$escapePattern) { |
|
| 1797 | + $calendarObjectIdQuery->andWhere($calendarObjectIdQuery->expr()->ilike('cob.value', $calendarObjectIdQuery->createNamedParameter($pattern))); |
|
| 1798 | + } else { |
|
| 1799 | + $calendarObjectIdQuery->andWhere($calendarObjectIdQuery->expr()->ilike('cob.value', $calendarObjectIdQuery->createNamedParameter('%' . $this->db->escapeLikeParameter($pattern) . '%'))); |
|
| 1800 | + } |
|
| 1801 | + } |
|
| 1802 | + |
|
| 1803 | + if (isset($options['limit'])) { |
|
| 1804 | + $calendarObjectIdQuery->setMaxResults($options['limit']); |
|
| 1805 | + } |
|
| 1806 | + if (isset($options['offset'])) { |
|
| 1807 | + $calendarObjectIdQuery->setFirstResult($options['offset']); |
|
| 1808 | + } |
|
| 1809 | + |
|
| 1810 | + $result = $calendarObjectIdQuery->executeQuery(); |
|
| 1811 | + $matches = $result->fetchAll(); |
|
| 1812 | + $result->closeCursor(); |
|
| 1813 | + $matches = array_map(static function (array $match):int { |
|
| 1814 | + return (int) $match['objectid']; |
|
| 1815 | + }, $matches); |
|
| 1816 | + |
|
| 1817 | + $query = $this->db->getQueryBuilder(); |
|
| 1818 | + $query->select('calendardata', 'uri', 'calendarid', 'calendartype') |
|
| 1819 | + ->from('calendarobjects') |
|
| 1820 | + ->where($query->expr()->in('id', $query->createNamedParameter($matches, IQueryBuilder::PARAM_INT_ARRAY))); |
|
| 1821 | + |
|
| 1822 | + $result = $query->executeQuery(); |
|
| 1823 | + $calendarObjects = $result->fetchAll(); |
|
| 1824 | + $result->closeCursor(); |
|
| 1825 | + |
|
| 1826 | + return array_map(function (array $array): array { |
|
| 1827 | + $array['calendarid'] = (int)$array['calendarid']; |
|
| 1828 | + $array['calendartype'] = (int)$array['calendartype']; |
|
| 1829 | + $array['calendardata'] = $this->readBlob($array['calendardata']); |
|
| 1830 | + |
|
| 1831 | + return $array; |
|
| 1832 | + }, $calendarObjects); |
|
| 1833 | + } |
|
| 1834 | + |
|
| 1835 | + /** |
|
| 1836 | + * Searches through all of a users calendars and calendar objects to find |
|
| 1837 | + * an object with a specific UID. |
|
| 1838 | + * |
|
| 1839 | + * This method should return the path to this object, relative to the |
|
| 1840 | + * calendar home, so this path usually only contains two parts: |
|
| 1841 | + * |
|
| 1842 | + * calendarpath/objectpath.ics |
|
| 1843 | + * |
|
| 1844 | + * If the uid is not found, return null. |
|
| 1845 | + * |
|
| 1846 | + * This method should only consider * objects that the principal owns, so |
|
| 1847 | + * any calendars owned by other principals that also appear in this |
|
| 1848 | + * collection should be ignored. |
|
| 1849 | + * |
|
| 1850 | + * @param string $principalUri |
|
| 1851 | + * @param string $uid |
|
| 1852 | + * @return string|null |
|
| 1853 | + */ |
|
| 1854 | + public function getCalendarObjectByUID($principalUri, $uid) { |
|
| 1855 | + $query = $this->db->getQueryBuilder(); |
|
| 1856 | + $query->selectAlias('c.uri', 'calendaruri')->selectAlias('co.uri', 'objecturi') |
|
| 1857 | + ->from('calendarobjects', 'co') |
|
| 1858 | + ->leftJoin('co', 'calendars', 'c', $query->expr()->eq('co.calendarid', 'c.id')) |
|
| 1859 | + ->where($query->expr()->eq('c.principaluri', $query->createNamedParameter($principalUri))) |
|
| 1860 | + ->andWhere($query->expr()->eq('co.uid', $query->createNamedParameter($uid))); |
|
| 1861 | + |
|
| 1862 | + $stmt = $query->executeQuery(); |
|
| 1863 | + $row = $stmt->fetch(); |
|
| 1864 | + $stmt->closeCursor(); |
|
| 1865 | + if ($row) { |
|
| 1866 | + return $row['calendaruri'] . '/' . $row['objecturi']; |
|
| 1867 | + } |
|
| 1868 | + |
|
| 1869 | + return null; |
|
| 1870 | + } |
|
| 1871 | + |
|
| 1872 | + /** |
|
| 1873 | + * The getChanges method returns all the changes that have happened, since |
|
| 1874 | + * the specified syncToken in the specified calendar. |
|
| 1875 | + * |
|
| 1876 | + * This function should return an array, such as the following: |
|
| 1877 | + * |
|
| 1878 | + * [ |
|
| 1879 | + * 'syncToken' => 'The current synctoken', |
|
| 1880 | + * 'added' => [ |
|
| 1881 | + * 'new.txt', |
|
| 1882 | + * ], |
|
| 1883 | + * 'modified' => [ |
|
| 1884 | + * 'modified.txt', |
|
| 1885 | + * ], |
|
| 1886 | + * 'deleted' => [ |
|
| 1887 | + * 'foo.php.bak', |
|
| 1888 | + * 'old.txt' |
|
| 1889 | + * ] |
|
| 1890 | + * ); |
|
| 1891 | + * |
|
| 1892 | + * The returned syncToken property should reflect the *current* syncToken |
|
| 1893 | + * of the calendar, as reported in the {http://sabredav.org/ns}sync-token |
|
| 1894 | + * property This is * needed here too, to ensure the operation is atomic. |
|
| 1895 | + * |
|
| 1896 | + * If the $syncToken argument is specified as null, this is an initial |
|
| 1897 | + * sync, and all members should be reported. |
|
| 1898 | + * |
|
| 1899 | + * The modified property is an array of nodenames that have changed since |
|
| 1900 | + * the last token. |
|
| 1901 | + * |
|
| 1902 | + * The deleted property is an array with nodenames, that have been deleted |
|
| 1903 | + * from collection. |
|
| 1904 | + * |
|
| 1905 | + * The $syncLevel argument is basically the 'depth' of the report. If it's |
|
| 1906 | + * 1, you only have to report changes that happened only directly in |
|
| 1907 | + * immediate descendants. If it's 2, it should also include changes from |
|
| 1908 | + * the nodes below the child collections. (grandchildren) |
|
| 1909 | + * |
|
| 1910 | + * The $limit argument allows a client to specify how many results should |
|
| 1911 | + * be returned at most. If the limit is not specified, it should be treated |
|
| 1912 | + * as infinite. |
|
| 1913 | + * |
|
| 1914 | + * If the limit (infinite or not) is higher than you're willing to return, |
|
| 1915 | + * you should throw a Sabre\DAV\Exception\TooMuchMatches() exception. |
|
| 1916 | + * |
|
| 1917 | + * If the syncToken is expired (due to data cleanup) or unknown, you must |
|
| 1918 | + * return null. |
|
| 1919 | + * |
|
| 1920 | + * The limit is 'suggestive'. You are free to ignore it. |
|
| 1921 | + * |
|
| 1922 | + * @param string $calendarId |
|
| 1923 | + * @param string $syncToken |
|
| 1924 | + * @param int $syncLevel |
|
| 1925 | + * @param int|null $limit |
|
| 1926 | + * @param int $calendarType |
|
| 1927 | + * @return array |
|
| 1928 | + */ |
|
| 1929 | + public function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null, $calendarType = self::CALENDAR_TYPE_CALENDAR) { |
|
| 1930 | + // Current synctoken |
|
| 1931 | + $qb = $this->db->getQueryBuilder(); |
|
| 1932 | + $qb->select('synctoken') |
|
| 1933 | + ->from('calendars') |
|
| 1934 | + ->where( |
|
| 1935 | + $qb->expr()->eq('id', $qb->createNamedParameter($calendarId)) |
|
| 1936 | + ); |
|
| 1937 | + $stmt = $qb->executeQuery(); |
|
| 1938 | + $currentToken = $stmt->fetchOne(); |
|
| 1939 | + |
|
| 1940 | + if ($currentToken === false) { |
|
| 1941 | + return null; |
|
| 1942 | + } |
|
| 1943 | + |
|
| 1944 | + $result = [ |
|
| 1945 | + 'syncToken' => $currentToken, |
|
| 1946 | + 'added' => [], |
|
| 1947 | + 'modified' => [], |
|
| 1948 | + 'deleted' => [], |
|
| 1949 | + ]; |
|
| 1950 | + |
|
| 1951 | + if ($syncToken) { |
|
| 1952 | + $qb = $this->db->getQueryBuilder(); |
|
| 1953 | + |
|
| 1954 | + $qb->select('uri', 'operation') |
|
| 1955 | + ->from('calendarchanges') |
|
| 1956 | + ->where( |
|
| 1957 | + $qb->expr()->andX( |
|
| 1958 | + $qb->expr()->gte('synctoken', $qb->createNamedParameter($syncToken)), |
|
| 1959 | + $qb->expr()->lt('synctoken', $qb->createNamedParameter($currentToken)), |
|
| 1960 | + $qb->expr()->eq('calendarid', $qb->createNamedParameter($calendarId)), |
|
| 1961 | + $qb->expr()->eq('calendartype', $qb->createNamedParameter($calendarType)) |
|
| 1962 | + ) |
|
| 1963 | + )->orderBy('synctoken'); |
|
| 1964 | + if (is_int($limit) && $limit > 0) { |
|
| 1965 | + $qb->setMaxResults($limit); |
|
| 1966 | + } |
|
| 1967 | + |
|
| 1968 | + // Fetching all changes |
|
| 1969 | + $stmt = $qb->executeQuery(); |
|
| 1970 | + $changes = []; |
|
| 1971 | + |
|
| 1972 | + // This loop ensures that any duplicates are overwritten, only the |
|
| 1973 | + // last change on a node is relevant. |
|
| 1974 | + while ($row = $stmt->fetch()) { |
|
| 1975 | + $changes[$row['uri']] = $row['operation']; |
|
| 1976 | + } |
|
| 1977 | + $stmt->closeCursor(); |
|
| 1978 | + |
|
| 1979 | + foreach ($changes as $uri => $operation) { |
|
| 1980 | + switch ($operation) { |
|
| 1981 | + case 1: |
|
| 1982 | + $result['added'][] = $uri; |
|
| 1983 | + break; |
|
| 1984 | + case 2: |
|
| 1985 | + $result['modified'][] = $uri; |
|
| 1986 | + break; |
|
| 1987 | + case 3: |
|
| 1988 | + $result['deleted'][] = $uri; |
|
| 1989 | + break; |
|
| 1990 | + } |
|
| 1991 | + } |
|
| 1992 | + } else { |
|
| 1993 | + // No synctoken supplied, this is the initial sync. |
|
| 1994 | + $qb = $this->db->getQueryBuilder(); |
|
| 1995 | + $qb->select('uri') |
|
| 1996 | + ->from('calendarobjects') |
|
| 1997 | + ->where( |
|
| 1998 | + $qb->expr()->andX( |
|
| 1999 | + $qb->expr()->eq('calendarid', $qb->createNamedParameter($calendarId)), |
|
| 2000 | + $qb->expr()->eq('calendartype', $qb->createNamedParameter($calendarType)) |
|
| 2001 | + ) |
|
| 2002 | + ); |
|
| 2003 | + $stmt = $qb->executeQuery(); |
|
| 2004 | + $result['added'] = $stmt->fetchAll(\PDO::FETCH_COLUMN); |
|
| 2005 | + $stmt->closeCursor(); |
|
| 2006 | + } |
|
| 2007 | + return $result; |
|
| 2008 | + } |
|
| 2009 | + |
|
| 2010 | + /** |
|
| 2011 | + * Returns a list of subscriptions for a principal. |
|
| 2012 | + * |
|
| 2013 | + * Every subscription is an array with the following keys: |
|
| 2014 | + * * id, a unique id that will be used by other functions to modify the |
|
| 2015 | + * subscription. This can be the same as the uri or a database key. |
|
| 2016 | + * * uri. This is just the 'base uri' or 'filename' of the subscription. |
|
| 2017 | + * * principaluri. The owner of the subscription. Almost always the same as |
|
| 2018 | + * principalUri passed to this method. |
|
| 2019 | + * |
|
| 2020 | + * Furthermore, all the subscription info must be returned too: |
|
| 2021 | + * |
|
| 2022 | + * 1. {DAV:}displayname |
|
| 2023 | + * 2. {http://apple.com/ns/ical/}refreshrate |
|
| 2024 | + * 3. {http://calendarserver.org/ns/}subscribed-strip-todos (omit if todos |
|
| 2025 | + * should not be stripped). |
|
| 2026 | + * 4. {http://calendarserver.org/ns/}subscribed-strip-alarms (omit if alarms |
|
| 2027 | + * should not be stripped). |
|
| 2028 | + * 5. {http://calendarserver.org/ns/}subscribed-strip-attachments (omit if |
|
| 2029 | + * attachments should not be stripped). |
|
| 2030 | + * 6. {http://calendarserver.org/ns/}source (Must be a |
|
| 2031 | + * Sabre\DAV\Property\Href). |
|
| 2032 | + * 7. {http://apple.com/ns/ical/}calendar-color |
|
| 2033 | + * 8. {http://apple.com/ns/ical/}calendar-order |
|
| 2034 | + * 9. {urn:ietf:params:xml:ns:caldav}supported-calendar-component-set |
|
| 2035 | + * (should just be an instance of |
|
| 2036 | + * Sabre\CalDAV\Property\SupportedCalendarComponentSet, with a bunch of |
|
| 2037 | + * default components). |
|
| 2038 | + * |
|
| 2039 | + * @param string $principalUri |
|
| 2040 | + * @return array |
|
| 2041 | + */ |
|
| 2042 | + public function getSubscriptionsForUser($principalUri) { |
|
| 2043 | + $fields = array_values($this->subscriptionPropertyMap); |
|
| 2044 | + $fields[] = 'id'; |
|
| 2045 | + $fields[] = 'uri'; |
|
| 2046 | + $fields[] = 'source'; |
|
| 2047 | + $fields[] = 'principaluri'; |
|
| 2048 | + $fields[] = 'lastmodified'; |
|
| 2049 | + $fields[] = 'synctoken'; |
|
| 2050 | + |
|
| 2051 | + $query = $this->db->getQueryBuilder(); |
|
| 2052 | + $query->select($fields) |
|
| 2053 | + ->from('calendarsubscriptions') |
|
| 2054 | + ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))) |
|
| 2055 | + ->orderBy('calendarorder', 'asc'); |
|
| 2056 | + $stmt = $query->executeQuery(); |
|
| 2057 | + |
|
| 2058 | + $subscriptions = []; |
|
| 2059 | + while ($row = $stmt->fetch()) { |
|
| 2060 | + $subscription = [ |
|
| 2061 | + 'id' => $row['id'], |
|
| 2062 | + 'uri' => $row['uri'], |
|
| 2063 | + 'principaluri' => $row['principaluri'], |
|
| 2064 | + 'source' => $row['source'], |
|
| 2065 | + 'lastmodified' => $row['lastmodified'], |
|
| 2066 | + |
|
| 2067 | + '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
| 2068 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 2069 | + ]; |
|
| 2070 | + |
|
| 2071 | + foreach ($this->subscriptionPropertyMap as $xmlName => $dbName) { |
|
| 2072 | + if (!is_null($row[$dbName])) { |
|
| 2073 | + $subscription[$xmlName] = $row[$dbName]; |
|
| 2074 | + } |
|
| 2075 | + } |
|
| 2076 | + |
|
| 2077 | + $subscriptions[] = $subscription; |
|
| 2078 | + } |
|
| 2079 | + |
|
| 2080 | + return $subscriptions; |
|
| 2081 | + } |
|
| 2082 | + |
|
| 2083 | + /** |
|
| 2084 | + * Creates a new subscription for a principal. |
|
| 2085 | + * |
|
| 2086 | + * If the creation was a success, an id must be returned that can be used to reference |
|
| 2087 | + * this subscription in other methods, such as updateSubscription. |
|
| 2088 | + * |
|
| 2089 | + * @param string $principalUri |
|
| 2090 | + * @param string $uri |
|
| 2091 | + * @param array $properties |
|
| 2092 | + * @return mixed |
|
| 2093 | + */ |
|
| 2094 | + public function createSubscription($principalUri, $uri, array $properties) { |
|
| 2095 | + if (!isset($properties['{http://calendarserver.org/ns/}source'])) { |
|
| 2096 | + throw new Forbidden('The {http://calendarserver.org/ns/}source property is required when creating subscriptions'); |
|
| 2097 | + } |
|
| 2098 | + |
|
| 2099 | + $values = [ |
|
| 2100 | + 'principaluri' => $principalUri, |
|
| 2101 | + 'uri' => $uri, |
|
| 2102 | + 'source' => $properties['{http://calendarserver.org/ns/}source']->getHref(), |
|
| 2103 | + 'lastmodified' => time(), |
|
| 2104 | + ]; |
|
| 2105 | + |
|
| 2106 | + $propertiesBoolean = ['striptodos', 'stripalarms', 'stripattachments']; |
|
| 2107 | + |
|
| 2108 | + foreach ($this->subscriptionPropertyMap as $xmlName => $dbName) { |
|
| 2109 | + if (array_key_exists($xmlName, $properties)) { |
|
| 2110 | + $values[$dbName] = $properties[$xmlName]; |
|
| 2111 | + if (in_array($dbName, $propertiesBoolean)) { |
|
| 2112 | + $values[$dbName] = true; |
|
| 2113 | + } |
|
| 2114 | + } |
|
| 2115 | + } |
|
| 2116 | + |
|
| 2117 | + $valuesToInsert = []; |
|
| 2118 | + |
|
| 2119 | + $query = $this->db->getQueryBuilder(); |
|
| 2120 | + |
|
| 2121 | + foreach (array_keys($values) as $name) { |
|
| 2122 | + $valuesToInsert[$name] = $query->createNamedParameter($values[$name]); |
|
| 2123 | + } |
|
| 2124 | + |
|
| 2125 | + $query->insert('calendarsubscriptions') |
|
| 2126 | + ->values($valuesToInsert) |
|
| 2127 | + ->executeStatement(); |
|
| 2128 | + |
|
| 2129 | + $subscriptionId = $query->getLastInsertId(); |
|
| 2130 | + |
|
| 2131 | + $subscriptionRow = $this->getSubscriptionById($subscriptionId); |
|
| 2132 | + $this->dispatcher->dispatchTyped(new SubscriptionCreatedEvent($subscriptionId, $subscriptionRow)); |
|
| 2133 | + $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::createSubscription', new GenericEvent( |
|
| 2134 | + '\OCA\DAV\CalDAV\CalDavBackend::createSubscription', |
|
| 2135 | + [ |
|
| 2136 | + 'subscriptionId' => $subscriptionId, |
|
| 2137 | + 'subscriptionData' => $subscriptionRow, |
|
| 2138 | + ])); |
|
| 2139 | + |
|
| 2140 | + return $subscriptionId; |
|
| 2141 | + } |
|
| 2142 | + |
|
| 2143 | + /** |
|
| 2144 | + * Updates a subscription |
|
| 2145 | + * |
|
| 2146 | + * The list of mutations is stored in a Sabre\DAV\PropPatch object. |
|
| 2147 | + * To do the actual updates, you must tell this object which properties |
|
| 2148 | + * you're going to process with the handle() method. |
|
| 2149 | + * |
|
| 2150 | + * Calling the handle method is like telling the PropPatch object "I |
|
| 2151 | + * promise I can handle updating this property". |
|
| 2152 | + * |
|
| 2153 | + * Read the PropPatch documentation for more info and examples. |
|
| 2154 | + * |
|
| 2155 | + * @param mixed $subscriptionId |
|
| 2156 | + * @param PropPatch $propPatch |
|
| 2157 | + * @return void |
|
| 2158 | + */ |
|
| 2159 | + public function updateSubscription($subscriptionId, PropPatch $propPatch) { |
|
| 2160 | + $supportedProperties = array_keys($this->subscriptionPropertyMap); |
|
| 2161 | + $supportedProperties[] = '{http://calendarserver.org/ns/}source'; |
|
| 2162 | + |
|
| 2163 | + $propPatch->handle($supportedProperties, function ($mutations) use ($subscriptionId) { |
|
| 2164 | + $newValues = []; |
|
| 2165 | + |
|
| 2166 | + foreach ($mutations as $propertyName => $propertyValue) { |
|
| 2167 | + if ($propertyName === '{http://calendarserver.org/ns/}source') { |
|
| 2168 | + $newValues['source'] = $propertyValue->getHref(); |
|
| 2169 | + } else { |
|
| 2170 | + $fieldName = $this->subscriptionPropertyMap[$propertyName]; |
|
| 2171 | + $newValues[$fieldName] = $propertyValue; |
|
| 2172 | + } |
|
| 2173 | + } |
|
| 2174 | + |
|
| 2175 | + $query = $this->db->getQueryBuilder(); |
|
| 2176 | + $query->update('calendarsubscriptions') |
|
| 2177 | + ->set('lastmodified', $query->createNamedParameter(time())); |
|
| 2178 | + foreach ($newValues as $fieldName => $value) { |
|
| 2179 | + $query->set($fieldName, $query->createNamedParameter($value)); |
|
| 2180 | + } |
|
| 2181 | + $query->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId))) |
|
| 2182 | + ->executeStatement(); |
|
| 2183 | + |
|
| 2184 | + $subscriptionRow = $this->getSubscriptionById($subscriptionId); |
|
| 2185 | + $this->dispatcher->dispatchTyped(new SubscriptionUpdatedEvent((int)$subscriptionId, $subscriptionRow, [], $mutations)); |
|
| 2186 | + $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateSubscription', new GenericEvent( |
|
| 2187 | + '\OCA\DAV\CalDAV\CalDavBackend::updateSubscription', |
|
| 2188 | + [ |
|
| 2189 | + 'subscriptionId' => $subscriptionId, |
|
| 2190 | + 'subscriptionData' => $subscriptionRow, |
|
| 2191 | + 'propertyMutations' => $mutations, |
|
| 2192 | + ])); |
|
| 2193 | + |
|
| 2194 | + return true; |
|
| 2195 | + }); |
|
| 2196 | + } |
|
| 2197 | + |
|
| 2198 | + /** |
|
| 2199 | + * Deletes a subscription. |
|
| 2200 | + * |
|
| 2201 | + * @param mixed $subscriptionId |
|
| 2202 | + * @return void |
|
| 2203 | + */ |
|
| 2204 | + public function deleteSubscription($subscriptionId) { |
|
| 2205 | + $subscriptionRow = $this->getSubscriptionById($subscriptionId); |
|
| 2206 | + |
|
| 2207 | + $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::deleteSubscription', new GenericEvent( |
|
| 2208 | + '\OCA\DAV\CalDAV\CalDavBackend::deleteSubscription', |
|
| 2209 | + [ |
|
| 2210 | + 'subscriptionId' => $subscriptionId, |
|
| 2211 | + 'subscriptionData' => $this->getSubscriptionById($subscriptionId), |
|
| 2212 | + ])); |
|
| 2213 | + |
|
| 2214 | + $query = $this->db->getQueryBuilder(); |
|
| 2215 | + $query->delete('calendarsubscriptions') |
|
| 2216 | + ->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId))) |
|
| 2217 | + ->executeStatement(); |
|
| 2218 | + |
|
| 2219 | + $query = $this->db->getQueryBuilder(); |
|
| 2220 | + $query->delete('calendarobjects') |
|
| 2221 | + ->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId))) |
|
| 2222 | + ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION))) |
|
| 2223 | + ->executeStatement(); |
|
| 2224 | + |
|
| 2225 | + $query->delete('calendarchanges') |
|
| 2226 | + ->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId))) |
|
| 2227 | + ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION))) |
|
| 2228 | + ->executeStatement(); |
|
| 2229 | + |
|
| 2230 | + $query->delete($this->dbObjectPropertiesTable) |
|
| 2231 | + ->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId))) |
|
| 2232 | + ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION))) |
|
| 2233 | + ->executeStatement(); |
|
| 2234 | + |
|
| 2235 | + if ($subscriptionRow) { |
|
| 2236 | + $this->dispatcher->dispatchTyped(new SubscriptionDeletedEvent((int)$subscriptionId, $subscriptionRow, [])); |
|
| 2237 | + } |
|
| 2238 | + } |
|
| 2239 | + |
|
| 2240 | + /** |
|
| 2241 | + * Returns a single scheduling object for the inbox collection. |
|
| 2242 | + * |
|
| 2243 | + * The returned array should contain the following elements: |
|
| 2244 | + * * uri - A unique basename for the object. This will be used to |
|
| 2245 | + * construct a full uri. |
|
| 2246 | + * * calendardata - The iCalendar object |
|
| 2247 | + * * lastmodified - The last modification date. Can be an int for a unix |
|
| 2248 | + * timestamp, or a PHP DateTime object. |
|
| 2249 | + * * etag - A unique token that must change if the object changed. |
|
| 2250 | + * * size - The size of the object, in bytes. |
|
| 2251 | + * |
|
| 2252 | + * @param string $principalUri |
|
| 2253 | + * @param string $objectUri |
|
| 2254 | + * @return array |
|
| 2255 | + */ |
|
| 2256 | + public function getSchedulingObject($principalUri, $objectUri) { |
|
| 2257 | + $query = $this->db->getQueryBuilder(); |
|
| 2258 | + $stmt = $query->select(['uri', 'calendardata', 'lastmodified', 'etag', 'size']) |
|
| 2259 | + ->from('schedulingobjects') |
|
| 2260 | + ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))) |
|
| 2261 | + ->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri))) |
|
| 2262 | + ->executeQuery(); |
|
| 2263 | + |
|
| 2264 | + $row = $stmt->fetch(); |
|
| 2265 | + |
|
| 2266 | + if (!$row) { |
|
| 2267 | + return null; |
|
| 2268 | + } |
|
| 2269 | + |
|
| 2270 | + return [ |
|
| 2271 | + 'uri' => $row['uri'], |
|
| 2272 | + 'calendardata' => $row['calendardata'], |
|
| 2273 | + 'lastmodified' => $row['lastmodified'], |
|
| 2274 | + 'etag' => '"' . $row['etag'] . '"', |
|
| 2275 | + 'size' => (int)$row['size'], |
|
| 2276 | + ]; |
|
| 2277 | + } |
|
| 2278 | + |
|
| 2279 | + /** |
|
| 2280 | + * Returns all scheduling objects for the inbox collection. |
|
| 2281 | + * |
|
| 2282 | + * These objects should be returned as an array. Every item in the array |
|
| 2283 | + * should follow the same structure as returned from getSchedulingObject. |
|
| 2284 | + * |
|
| 2285 | + * The main difference is that 'calendardata' is optional. |
|
| 2286 | + * |
|
| 2287 | + * @param string $principalUri |
|
| 2288 | + * @return array |
|
| 2289 | + */ |
|
| 2290 | + public function getSchedulingObjects($principalUri) { |
|
| 2291 | + $query = $this->db->getQueryBuilder(); |
|
| 2292 | + $stmt = $query->select(['uri', 'calendardata', 'lastmodified', 'etag', 'size']) |
|
| 2293 | + ->from('schedulingobjects') |
|
| 2294 | + ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))) |
|
| 2295 | + ->executeQuery(); |
|
| 2296 | + |
|
| 2297 | + $result = []; |
|
| 2298 | + foreach ($stmt->fetchAll() as $row) { |
|
| 2299 | + $result[] = [ |
|
| 2300 | + 'calendardata' => $row['calendardata'], |
|
| 2301 | + 'uri' => $row['uri'], |
|
| 2302 | + 'lastmodified' => $row['lastmodified'], |
|
| 2303 | + 'etag' => '"' . $row['etag'] . '"', |
|
| 2304 | + 'size' => (int)$row['size'], |
|
| 2305 | + ]; |
|
| 2306 | + } |
|
| 2307 | + |
|
| 2308 | + return $result; |
|
| 2309 | + } |
|
| 2310 | + |
|
| 2311 | + /** |
|
| 2312 | + * Deletes a scheduling object from the inbox collection. |
|
| 2313 | + * |
|
| 2314 | + * @param string $principalUri |
|
| 2315 | + * @param string $objectUri |
|
| 2316 | + * @return void |
|
| 2317 | + */ |
|
| 2318 | + public function deleteSchedulingObject($principalUri, $objectUri) { |
|
| 2319 | + $query = $this->db->getQueryBuilder(); |
|
| 2320 | + $query->delete('schedulingobjects') |
|
| 2321 | + ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))) |
|
| 2322 | + ->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri))) |
|
| 2323 | + ->executeStatement(); |
|
| 2324 | + } |
|
| 2325 | + |
|
| 2326 | + /** |
|
| 2327 | + * Creates a new scheduling object. This should land in a users' inbox. |
|
| 2328 | + * |
|
| 2329 | + * @param string $principalUri |
|
| 2330 | + * @param string $objectUri |
|
| 2331 | + * @param string $objectData |
|
| 2332 | + * @return void |
|
| 2333 | + */ |
|
| 2334 | + public function createSchedulingObject($principalUri, $objectUri, $objectData) { |
|
| 2335 | + $query = $this->db->getQueryBuilder(); |
|
| 2336 | + $query->insert('schedulingobjects') |
|
| 2337 | + ->values([ |
|
| 2338 | + 'principaluri' => $query->createNamedParameter($principalUri), |
|
| 2339 | + 'calendardata' => $query->createNamedParameter($objectData, IQueryBuilder::PARAM_LOB), |
|
| 2340 | + 'uri' => $query->createNamedParameter($objectUri), |
|
| 2341 | + 'lastmodified' => $query->createNamedParameter(time()), |
|
| 2342 | + 'etag' => $query->createNamedParameter(md5($objectData)), |
|
| 2343 | + 'size' => $query->createNamedParameter(strlen($objectData)) |
|
| 2344 | + ]) |
|
| 2345 | + ->executeStatement(); |
|
| 2346 | + } |
|
| 2347 | + |
|
| 2348 | + /** |
|
| 2349 | + * Adds a change record to the calendarchanges table. |
|
| 2350 | + * |
|
| 2351 | + * @param mixed $calendarId |
|
| 2352 | + * @param string $objectUri |
|
| 2353 | + * @param int $operation 1 = add, 2 = modify, 3 = delete. |
|
| 2354 | + * @param int $calendarType |
|
| 2355 | + * @return void |
|
| 2356 | + */ |
|
| 2357 | + protected function addChange($calendarId, $objectUri, $operation, $calendarType = self::CALENDAR_TYPE_CALENDAR) { |
|
| 2358 | + $table = $calendarType === self::CALENDAR_TYPE_CALENDAR ? 'calendars': 'calendarsubscriptions'; |
|
| 2359 | + |
|
| 2360 | + $query = $this->db->getQueryBuilder(); |
|
| 2361 | + $query->select('synctoken') |
|
| 2362 | + ->from($table) |
|
| 2363 | + ->where($query->expr()->eq('id', $query->createNamedParameter($calendarId))); |
|
| 2364 | + $result = $query->executeQuery(); |
|
| 2365 | + $syncToken = (int)$result->fetchOne(); |
|
| 2366 | + $result->closeCursor(); |
|
| 2367 | + |
|
| 2368 | + $query = $this->db->getQueryBuilder(); |
|
| 2369 | + $query->insert('calendarchanges') |
|
| 2370 | + ->values([ |
|
| 2371 | + 'uri' => $query->createNamedParameter($objectUri), |
|
| 2372 | + 'synctoken' => $query->createNamedParameter($syncToken), |
|
| 2373 | + 'calendarid' => $query->createNamedParameter($calendarId), |
|
| 2374 | + 'operation' => $query->createNamedParameter($operation), |
|
| 2375 | + 'calendartype' => $query->createNamedParameter($calendarType), |
|
| 2376 | + ]) |
|
| 2377 | + ->executeStatement(); |
|
| 2378 | + |
|
| 2379 | + $stmt = $this->db->prepare("UPDATE `*PREFIX*$table` SET `synctoken` = `synctoken` + 1 WHERE `id` = ?"); |
|
| 2380 | + $stmt->execute([ |
|
| 2381 | + $calendarId |
|
| 2382 | + ]); |
|
| 2383 | + } |
|
| 2384 | + |
|
| 2385 | + /** |
|
| 2386 | + * Parses some information from calendar objects, used for optimized |
|
| 2387 | + * calendar-queries. |
|
| 2388 | + * |
|
| 2389 | + * Returns an array with the following keys: |
|
| 2390 | + * * etag - An md5 checksum of the object without the quotes. |
|
| 2391 | + * * size - Size of the object in bytes |
|
| 2392 | + * * componentType - VEVENT, VTODO or VJOURNAL |
|
| 2393 | + * * firstOccurence |
|
| 2394 | + * * lastOccurence |
|
| 2395 | + * * uid - value of the UID property |
|
| 2396 | + * |
|
| 2397 | + * @param string $calendarData |
|
| 2398 | + * @return array |
|
| 2399 | + */ |
|
| 2400 | + public function getDenormalizedData($calendarData) { |
|
| 2401 | + $vObject = Reader::read($calendarData); |
|
| 2402 | + $vEvents = []; |
|
| 2403 | + $componentType = null; |
|
| 2404 | + $component = null; |
|
| 2405 | + $firstOccurrence = null; |
|
| 2406 | + $lastOccurrence = null; |
|
| 2407 | + $uid = null; |
|
| 2408 | + $classification = self::CLASSIFICATION_PUBLIC; |
|
| 2409 | + $hasDTSTART = false; |
|
| 2410 | + foreach ($vObject->getComponents() as $component) { |
|
| 2411 | + if ($component->name !== 'VTIMEZONE') { |
|
| 2412 | + // Finding all VEVENTs, and track them |
|
| 2413 | + if ($component->name === 'VEVENT') { |
|
| 2414 | + array_push($vEvents, $component); |
|
| 2415 | + if ($component->DTSTART) { |
|
| 2416 | + $hasDTSTART = true; |
|
| 2417 | + } |
|
| 2418 | + } |
|
| 2419 | + // Track first component type and uid |
|
| 2420 | + if ($uid === null) { |
|
| 2421 | + $componentType = $component->name; |
|
| 2422 | + $uid = (string)$component->UID; |
|
| 2423 | + } |
|
| 2424 | + } |
|
| 2425 | + } |
|
| 2426 | + if (!$componentType) { |
|
| 2427 | + throw new \Sabre\DAV\Exception\BadRequest('Calendar objects must have a VJOURNAL, VEVENT or VTODO component'); |
|
| 2428 | + } |
|
| 2429 | + |
|
| 2430 | + if ($hasDTSTART) { |
|
| 2431 | + $component = $vEvents[0]; |
|
| 2432 | + |
|
| 2433 | + // Finding the last occurrence is a bit harder |
|
| 2434 | + if (!isset($component->RRULE) && count($vEvents) === 1) { |
|
| 2435 | + $firstOccurrence = $component->DTSTART->getDateTime()->getTimeStamp(); |
|
| 2436 | + if (isset($component->DTEND)) { |
|
| 2437 | + $lastOccurrence = $component->DTEND->getDateTime()->getTimeStamp(); |
|
| 2438 | + } elseif (isset($component->DURATION)) { |
|
| 2439 | + $endDate = clone $component->DTSTART->getDateTime(); |
|
| 2440 | + $endDate->add(DateTimeParser::parse($component->DURATION->getValue())); |
|
| 2441 | + $lastOccurrence = $endDate->getTimeStamp(); |
|
| 2442 | + } elseif (!$component->DTSTART->hasTime()) { |
|
| 2443 | + $endDate = clone $component->DTSTART->getDateTime(); |
|
| 2444 | + $endDate->modify('+1 day'); |
|
| 2445 | + $lastOccurrence = $endDate->getTimeStamp(); |
|
| 2446 | + } else { |
|
| 2447 | + $lastOccurrence = $firstOccurrence; |
|
| 2448 | + } |
|
| 2449 | + } else { |
|
| 2450 | + $it = new EventIterator($vEvents); |
|
| 2451 | + $maxDate = new DateTime(self::MAX_DATE); |
|
| 2452 | + $firstOccurrence = $it->getDtStart()->getTimestamp(); |
|
| 2453 | + if ($it->isInfinite()) { |
|
| 2454 | + $lastOccurrence = $maxDate->getTimestamp(); |
|
| 2455 | + } else { |
|
| 2456 | + $end = $it->getDtEnd(); |
|
| 2457 | + while ($it->valid() && $end < $maxDate) { |
|
| 2458 | + $end = $it->getDtEnd(); |
|
| 2459 | + $it->next(); |
|
| 2460 | + } |
|
| 2461 | + $lastOccurrence = $end->getTimestamp(); |
|
| 2462 | + } |
|
| 2463 | + } |
|
| 2464 | + } |
|
| 2465 | + |
|
| 2466 | + if ($component->CLASS) { |
|
| 2467 | + $classification = CalDavBackend::CLASSIFICATION_PRIVATE; |
|
| 2468 | + switch ($component->CLASS->getValue()) { |
|
| 2469 | + case 'PUBLIC': |
|
| 2470 | + $classification = CalDavBackend::CLASSIFICATION_PUBLIC; |
|
| 2471 | + break; |
|
| 2472 | + case 'CONFIDENTIAL': |
|
| 2473 | + $classification = CalDavBackend::CLASSIFICATION_CONFIDENTIAL; |
|
| 2474 | + break; |
|
| 2475 | + } |
|
| 2476 | + } |
|
| 2477 | + return [ |
|
| 2478 | + 'etag' => md5($calendarData), |
|
| 2479 | + 'size' => strlen($calendarData), |
|
| 2480 | + 'componentType' => $componentType, |
|
| 2481 | + 'firstOccurence' => is_null($firstOccurrence) ? null : max(0, $firstOccurrence), |
|
| 2482 | + 'lastOccurence' => $lastOccurrence, |
|
| 2483 | + 'uid' => $uid, |
|
| 2484 | + 'classification' => $classification |
|
| 2485 | + ]; |
|
| 2486 | + } |
|
| 2487 | + |
|
| 2488 | + /** |
|
| 2489 | + * @param $cardData |
|
| 2490 | + * @return bool|string |
|
| 2491 | + */ |
|
| 2492 | + private function readBlob($cardData) { |
|
| 2493 | + if (is_resource($cardData)) { |
|
| 2494 | + return stream_get_contents($cardData); |
|
| 2495 | + } |
|
| 2496 | + |
|
| 2497 | + return $cardData; |
|
| 2498 | + } |
|
| 2499 | + |
|
| 2500 | + /** |
|
| 2501 | + * @param IShareable $shareable |
|
| 2502 | + * @param array $add |
|
| 2503 | + * @param array $remove |
|
| 2504 | + */ |
|
| 2505 | + public function updateShares($shareable, $add, $remove) { |
|
| 2506 | + $calendarId = $shareable->getResourceId(); |
|
| 2507 | + $calendarRow = $this->getCalendarById($calendarId); |
|
| 2508 | + $oldShares = $this->getShares($calendarId); |
|
| 2509 | + |
|
| 2510 | + $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateShares', new GenericEvent( |
|
| 2511 | + '\OCA\DAV\CalDAV\CalDavBackend::updateShares', |
|
| 2512 | + [ |
|
| 2513 | + 'calendarId' => $calendarId, |
|
| 2514 | + 'calendarData' => $calendarRow, |
|
| 2515 | + 'shares' => $oldShares, |
|
| 2516 | + 'add' => $add, |
|
| 2517 | + 'remove' => $remove, |
|
| 2518 | + ])); |
|
| 2519 | + $this->calendarSharingBackend->updateShares($shareable, $add, $remove); |
|
| 2520 | + |
|
| 2521 | + $this->dispatcher->dispatchTyped(new CalendarShareUpdatedEvent((int)$calendarId, $calendarRow, $oldShares, $add, $remove)); |
|
| 2522 | + } |
|
| 2523 | + |
|
| 2524 | + /** |
|
| 2525 | + * @param int $resourceId |
|
| 2526 | + * @return array |
|
| 2527 | + */ |
|
| 2528 | + public function getShares($resourceId) { |
|
| 2529 | + return $this->calendarSharingBackend->getShares($resourceId); |
|
| 2530 | + } |
|
| 2531 | + |
|
| 2532 | + /** |
|
| 2533 | + * @param boolean $value |
|
| 2534 | + * @param \OCA\DAV\CalDAV\Calendar $calendar |
|
| 2535 | + * @return string|null |
|
| 2536 | + */ |
|
| 2537 | + public function setPublishStatus($value, $calendar) { |
|
| 2538 | + $calendarId = $calendar->getResourceId(); |
|
| 2539 | + $calendarData = $this->getCalendarById($calendarId); |
|
| 2540 | + $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::publishCalendar', new GenericEvent( |
|
| 2541 | + '\OCA\DAV\CalDAV\CalDavBackend::updateShares', |
|
| 2542 | + [ |
|
| 2543 | + 'calendarId' => $calendarId, |
|
| 2544 | + 'calendarData' => $calendarData, |
|
| 2545 | + 'public' => $value, |
|
| 2546 | + ])); |
|
| 2547 | + |
|
| 2548 | + $query = $this->db->getQueryBuilder(); |
|
| 2549 | + if ($value) { |
|
| 2550 | + $publicUri = $this->random->generate(16, ISecureRandom::CHAR_HUMAN_READABLE); |
|
| 2551 | + $query->insert('dav_shares') |
|
| 2552 | + ->values([ |
|
| 2553 | + 'principaluri' => $query->createNamedParameter($calendar->getPrincipalURI()), |
|
| 2554 | + 'type' => $query->createNamedParameter('calendar'), |
|
| 2555 | + 'access' => $query->createNamedParameter(self::ACCESS_PUBLIC), |
|
| 2556 | + 'resourceid' => $query->createNamedParameter($calendar->getResourceId()), |
|
| 2557 | + 'publicuri' => $query->createNamedParameter($publicUri) |
|
| 2558 | + ]); |
|
| 2559 | + $query->executeStatement(); |
|
| 2560 | + |
|
| 2561 | + $this->dispatcher->dispatchTyped(new CalendarPublishedEvent((int)$calendarId, $calendarData, $publicUri)); |
|
| 2562 | + return $publicUri; |
|
| 2563 | + } |
|
| 2564 | + $query->delete('dav_shares') |
|
| 2565 | + ->where($query->expr()->eq('resourceid', $query->createNamedParameter($calendar->getResourceId()))) |
|
| 2566 | + ->andWhere($query->expr()->eq('access', $query->createNamedParameter(self::ACCESS_PUBLIC))); |
|
| 2567 | + $query->executeStatement(); |
|
| 2568 | + |
|
| 2569 | + $this->dispatcher->dispatchTyped(new CalendarUnpublishedEvent((int)$calendarId, $calendarData)); |
|
| 2570 | + return null; |
|
| 2571 | + } |
|
| 2572 | + |
|
| 2573 | + /** |
|
| 2574 | + * @param \OCA\DAV\CalDAV\Calendar $calendar |
|
| 2575 | + * @return mixed |
|
| 2576 | + */ |
|
| 2577 | + public function getPublishStatus($calendar) { |
|
| 2578 | + $query = $this->db->getQueryBuilder(); |
|
| 2579 | + $result = $query->select('publicuri') |
|
| 2580 | + ->from('dav_shares') |
|
| 2581 | + ->where($query->expr()->eq('resourceid', $query->createNamedParameter($calendar->getResourceId()))) |
|
| 2582 | + ->andWhere($query->expr()->eq('access', $query->createNamedParameter(self::ACCESS_PUBLIC))) |
|
| 2583 | + ->executeQuery(); |
|
| 2584 | + |
|
| 2585 | + $row = $result->fetch(); |
|
| 2586 | + $result->closeCursor(); |
|
| 2587 | + return $row ? reset($row) : false; |
|
| 2588 | + } |
|
| 2589 | + |
|
| 2590 | + /** |
|
| 2591 | + * @param int $resourceId |
|
| 2592 | + * @param array $acl |
|
| 2593 | + * @return array |
|
| 2594 | + */ |
|
| 2595 | + public function applyShareAcl($resourceId, $acl) { |
|
| 2596 | + return $this->calendarSharingBackend->applyShareAcl($resourceId, $acl); |
|
| 2597 | + } |
|
| 2598 | + |
|
| 2599 | + |
|
| 2600 | + |
|
| 2601 | + /** |
|
| 2602 | + * update properties table |
|
| 2603 | + * |
|
| 2604 | + * @param int $calendarId |
|
| 2605 | + * @param string $objectUri |
|
| 2606 | + * @param string $calendarData |
|
| 2607 | + * @param int $calendarType |
|
| 2608 | + */ |
|
| 2609 | + public function updateProperties($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) { |
|
| 2610 | + $objectId = $this->getCalendarObjectId($calendarId, $objectUri, $calendarType); |
|
| 2611 | + |
|
| 2612 | + try { |
|
| 2613 | + $vCalendar = $this->readCalendarData($calendarData); |
|
| 2614 | + } catch (\Exception $ex) { |
|
| 2615 | + return; |
|
| 2616 | + } |
|
| 2617 | + |
|
| 2618 | + $this->purgeProperties($calendarId, $objectId); |
|
| 2619 | + |
|
| 2620 | + $query = $this->db->getQueryBuilder(); |
|
| 2621 | + $query->insert($this->dbObjectPropertiesTable) |
|
| 2622 | + ->values( |
|
| 2623 | + [ |
|
| 2624 | + 'calendarid' => $query->createNamedParameter($calendarId), |
|
| 2625 | + 'calendartype' => $query->createNamedParameter($calendarType), |
|
| 2626 | + 'objectid' => $query->createNamedParameter($objectId), |
|
| 2627 | + 'name' => $query->createParameter('name'), |
|
| 2628 | + 'parameter' => $query->createParameter('parameter'), |
|
| 2629 | + 'value' => $query->createParameter('value'), |
|
| 2630 | + ] |
|
| 2631 | + ); |
|
| 2632 | + |
|
| 2633 | + $indexComponents = ['VEVENT', 'VJOURNAL', 'VTODO']; |
|
| 2634 | + foreach ($vCalendar->getComponents() as $component) { |
|
| 2635 | + if (!in_array($component->name, $indexComponents)) { |
|
| 2636 | + continue; |
|
| 2637 | + } |
|
| 2638 | + |
|
| 2639 | + foreach ($component->children() as $property) { |
|
| 2640 | + if (in_array($property->name, self::$indexProperties)) { |
|
| 2641 | + $value = $property->getValue(); |
|
| 2642 | + // is this a shitty db? |
|
| 2643 | + if (!$this->db->supports4ByteText()) { |
|
| 2644 | + $value = preg_replace('/[\x{10000}-\x{10FFFF}]/u', "\xEF\xBF\xBD", $value); |
|
| 2645 | + } |
|
| 2646 | + $value = mb_strcut($value, 0, 254); |
|
| 2647 | + |
|
| 2648 | + $query->setParameter('name', $property->name); |
|
| 2649 | + $query->setParameter('parameter', null); |
|
| 2650 | + $query->setParameter('value', $value); |
|
| 2651 | + $query->executeStatement(); |
|
| 2652 | + } |
|
| 2653 | + |
|
| 2654 | + if (array_key_exists($property->name, self::$indexParameters)) { |
|
| 2655 | + $parameters = $property->parameters(); |
|
| 2656 | + $indexedParametersForProperty = self::$indexParameters[$property->name]; |
|
| 2657 | + |
|
| 2658 | + foreach ($parameters as $key => $value) { |
|
| 2659 | + if (in_array($key, $indexedParametersForProperty)) { |
|
| 2660 | + // is this a shitty db? |
|
| 2661 | + if ($this->db->supports4ByteText()) { |
|
| 2662 | + $value = preg_replace('/[\x{10000}-\x{10FFFF}]/u', "\xEF\xBF\xBD", $value); |
|
| 2663 | + } |
|
| 2664 | + |
|
| 2665 | + $query->setParameter('name', $property->name); |
|
| 2666 | + $query->setParameter('parameter', mb_strcut($key, 0, 254)); |
|
| 2667 | + $query->setParameter('value', mb_strcut($value, 0, 254)); |
|
| 2668 | + $query->executeStatement(); |
|
| 2669 | + } |
|
| 2670 | + } |
|
| 2671 | + } |
|
| 2672 | + } |
|
| 2673 | + } |
|
| 2674 | + } |
|
| 2675 | + |
|
| 2676 | + /** |
|
| 2677 | + * deletes all birthday calendars |
|
| 2678 | + */ |
|
| 2679 | + public function deleteAllBirthdayCalendars() { |
|
| 2680 | + $query = $this->db->getQueryBuilder(); |
|
| 2681 | + $result = $query->select(['id'])->from('calendars') |
|
| 2682 | + ->where($query->expr()->eq('uri', $query->createNamedParameter(BirthdayService::BIRTHDAY_CALENDAR_URI))) |
|
| 2683 | + ->executeQuery(); |
|
| 2684 | + |
|
| 2685 | + $ids = $result->fetchAll(); |
|
| 2686 | + foreach ($ids as $id) { |
|
| 2687 | + $this->deleteCalendar($id['id']); |
|
| 2688 | + } |
|
| 2689 | + } |
|
| 2690 | + |
|
| 2691 | + /** |
|
| 2692 | + * @param $subscriptionId |
|
| 2693 | + */ |
|
| 2694 | + public function purgeAllCachedEventsForSubscription($subscriptionId) { |
|
| 2695 | + $query = $this->db->getQueryBuilder(); |
|
| 2696 | + $query->select('uri') |
|
| 2697 | + ->from('calendarobjects') |
|
| 2698 | + ->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId))) |
|
| 2699 | + ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION))); |
|
| 2700 | + $stmt = $query->executeQuery(); |
|
| 2701 | + |
|
| 2702 | + $uris = []; |
|
| 2703 | + foreach ($stmt->fetchAll() as $row) { |
|
| 2704 | + $uris[] = $row['uri']; |
|
| 2705 | + } |
|
| 2706 | + $stmt->closeCursor(); |
|
| 2707 | + |
|
| 2708 | + $query = $this->db->getQueryBuilder(); |
|
| 2709 | + $query->delete('calendarobjects') |
|
| 2710 | + ->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId))) |
|
| 2711 | + ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION))) |
|
| 2712 | + ->executeStatement(); |
|
| 2713 | + |
|
| 2714 | + $query->delete('calendarchanges') |
|
| 2715 | + ->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId))) |
|
| 2716 | + ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION))) |
|
| 2717 | + ->executeStatement(); |
|
| 2718 | + |
|
| 2719 | + $query->delete($this->dbObjectPropertiesTable) |
|
| 2720 | + ->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId))) |
|
| 2721 | + ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION))) |
|
| 2722 | + ->executeStatement(); |
|
| 2723 | + |
|
| 2724 | + foreach ($uris as $uri) { |
|
| 2725 | + $this->addChange($subscriptionId, $uri, 3, self::CALENDAR_TYPE_SUBSCRIPTION); |
|
| 2726 | + } |
|
| 2727 | + } |
|
| 2728 | + |
|
| 2729 | + /** |
|
| 2730 | + * Move a calendar from one user to another |
|
| 2731 | + * |
|
| 2732 | + * @param string $uriName |
|
| 2733 | + * @param string $uriOrigin |
|
| 2734 | + * @param string $uriDestination |
|
| 2735 | + * @param string $newUriName (optional) the new uriName |
|
| 2736 | + */ |
|
| 2737 | + public function moveCalendar($uriName, $uriOrigin, $uriDestination, $newUriName = null) { |
|
| 2738 | + $query = $this->db->getQueryBuilder(); |
|
| 2739 | + $query->update('calendars') |
|
| 2740 | + ->set('principaluri', $query->createNamedParameter($uriDestination)) |
|
| 2741 | + ->set('uri', $query->createNamedParameter($newUriName ?: $uriName)) |
|
| 2742 | + ->where($query->expr()->eq('principaluri', $query->createNamedParameter($uriOrigin))) |
|
| 2743 | + ->andWhere($query->expr()->eq('uri', $query->createNamedParameter($uriName))) |
|
| 2744 | + ->executeStatement(); |
|
| 2745 | + } |
|
| 2746 | + |
|
| 2747 | + /** |
|
| 2748 | + * read VCalendar data into a VCalendar object |
|
| 2749 | + * |
|
| 2750 | + * @param string $objectData |
|
| 2751 | + * @return VCalendar |
|
| 2752 | + */ |
|
| 2753 | + protected function readCalendarData($objectData) { |
|
| 2754 | + return Reader::read($objectData); |
|
| 2755 | + } |
|
| 2756 | + |
|
| 2757 | + /** |
|
| 2758 | + * delete all properties from a given calendar object |
|
| 2759 | + * |
|
| 2760 | + * @param int $calendarId |
|
| 2761 | + * @param int $objectId |
|
| 2762 | + */ |
|
| 2763 | + protected function purgeProperties($calendarId, $objectId) { |
|
| 2764 | + $query = $this->db->getQueryBuilder(); |
|
| 2765 | + $query->delete($this->dbObjectPropertiesTable) |
|
| 2766 | + ->where($query->expr()->eq('objectid', $query->createNamedParameter($objectId))) |
|
| 2767 | + ->andWhere($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId))); |
|
| 2768 | + $query->executeStatement(); |
|
| 2769 | + } |
|
| 2770 | + |
|
| 2771 | + /** |
|
| 2772 | + * get ID from a given calendar object |
|
| 2773 | + * |
|
| 2774 | + * @param int $calendarId |
|
| 2775 | + * @param string $uri |
|
| 2776 | + * @param int $calendarType |
|
| 2777 | + * @return int |
|
| 2778 | + */ |
|
| 2779 | + protected function getCalendarObjectId($calendarId, $uri, $calendarType):int { |
|
| 2780 | + $query = $this->db->getQueryBuilder(); |
|
| 2781 | + $query->select('id') |
|
| 2782 | + ->from('calendarobjects') |
|
| 2783 | + ->where($query->expr()->eq('uri', $query->createNamedParameter($uri))) |
|
| 2784 | + ->andWhere($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId))) |
|
| 2785 | + ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType))); |
|
| 2786 | + |
|
| 2787 | + $result = $query->executeQuery(); |
|
| 2788 | + $objectIds = $result->fetch(); |
|
| 2789 | + $result->closeCursor(); |
|
| 2790 | + |
|
| 2791 | + if (!isset($objectIds['id'])) { |
|
| 2792 | + throw new \InvalidArgumentException('Calendarobject does not exists: ' . $uri); |
|
| 2793 | + } |
|
| 2794 | + |
|
| 2795 | + return (int)$objectIds['id']; |
|
| 2796 | + } |
|
| 2797 | + |
|
| 2798 | + /** |
|
| 2799 | + * return legacy endpoint principal name to new principal name |
|
| 2800 | + * |
|
| 2801 | + * @param $principalUri |
|
| 2802 | + * @param $toV2 |
|
| 2803 | + * @return string |
|
| 2804 | + */ |
|
| 2805 | + private function convertPrincipal($principalUri, $toV2) { |
|
| 2806 | + if ($this->principalBackend->getPrincipalPrefix() === 'principals') { |
|
| 2807 | + [, $name] = Uri\split($principalUri); |
|
| 2808 | + if ($toV2 === true) { |
|
| 2809 | + return "principals/users/$name"; |
|
| 2810 | + } |
|
| 2811 | + return "principals/$name"; |
|
| 2812 | + } |
|
| 2813 | + return $principalUri; |
|
| 2814 | + } |
|
| 2815 | + |
|
| 2816 | + /** |
|
| 2817 | + * adds information about an owner to the calendar data |
|
| 2818 | + * |
|
| 2819 | + * @param $calendarInfo |
|
| 2820 | + */ |
|
| 2821 | + private function addOwnerPrincipal(&$calendarInfo) { |
|
| 2822 | + $ownerPrincipalKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal'; |
|
| 2823 | + $displaynameKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}owner-displayname'; |
|
| 2824 | + if (isset($calendarInfo[$ownerPrincipalKey])) { |
|
| 2825 | + $uri = $calendarInfo[$ownerPrincipalKey]; |
|
| 2826 | + } else { |
|
| 2827 | + $uri = $calendarInfo['principaluri']; |
|
| 2828 | + } |
|
| 2829 | + |
|
| 2830 | + $principalInformation = $this->principalBackend->getPrincipalByPath($uri); |
|
| 2831 | + if (isset($principalInformation['{DAV:}displayname'])) { |
|
| 2832 | + $calendarInfo[$displaynameKey] = $principalInformation['{DAV:}displayname']; |
|
| 2833 | + } |
|
| 2834 | + } |
|
| 2835 | 2835 | } |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | $result = $query->executeQuery(); |
| 259 | - $column = (int)$result->fetchOne(); |
|
| 259 | + $column = (int) $result->fetchOne(); |
|
| 260 | 260 | $result->closeCursor(); |
| 261 | 261 | return $column; |
| 262 | 262 | } |
@@ -316,18 +316,18 @@ discard block |
||
| 316 | 316 | $row['principaluri'] = (string) $row['principaluri']; |
| 317 | 317 | $components = []; |
| 318 | 318 | if ($row['components']) { |
| 319 | - $components = explode(',',$row['components']); |
|
| 319 | + $components = explode(',', $row['components']); |
|
| 320 | 320 | } |
| 321 | 321 | |
| 322 | 322 | $calendar = [ |
| 323 | 323 | 'id' => $row['id'], |
| 324 | 324 | 'uri' => $row['uri'], |
| 325 | 325 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
| 326 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 327 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 328 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 329 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 330 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint), |
|
| 326 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
| 327 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
| 328 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 329 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
| 330 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint), |
|
| 331 | 331 | ]; |
| 332 | 332 | |
| 333 | 333 | foreach ($this->propertyMap as $xmlName => $dbName) { |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | |
| 368 | 368 | $result = $query->executeQuery(); |
| 369 | 369 | |
| 370 | - $readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only'; |
|
| 370 | + $readOnlyPropertyName = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only'; |
|
| 371 | 371 | while ($row = $result->fetch()) { |
| 372 | 372 | $row['principaluri'] = (string) $row['principaluri']; |
| 373 | 373 | if ($row['principaluri'] === $principalUri) { |
@@ -388,21 +388,21 @@ discard block |
||
| 388 | 388 | } |
| 389 | 389 | |
| 390 | 390 | [, $name] = Uri\split($row['principaluri']); |
| 391 | - $uri = $row['uri'] . '_shared_by_' . $name; |
|
| 392 | - $row['displayname'] = $row['displayname'] . ' (' . $this->getUserDisplayName($name) . ')'; |
|
| 391 | + $uri = $row['uri'].'_shared_by_'.$name; |
|
| 392 | + $row['displayname'] = $row['displayname'].' ('.$this->getUserDisplayName($name).')'; |
|
| 393 | 393 | $components = []; |
| 394 | 394 | if ($row['components']) { |
| 395 | - $components = explode(',',$row['components']); |
|
| 395 | + $components = explode(',', $row['components']); |
|
| 396 | 396 | } |
| 397 | 397 | $calendar = [ |
| 398 | 398 | 'id' => $row['id'], |
| 399 | 399 | 'uri' => $uri, |
| 400 | 400 | 'principaluri' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint), |
| 401 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 402 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 403 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 404 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp('transparent'), |
|
| 405 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 401 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
| 402 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
| 403 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 404 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp('transparent'), |
|
| 405 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 406 | 406 | $readOnlyPropertyName => $readOnly, |
| 407 | 407 | ]; |
| 408 | 408 | |
@@ -443,16 +443,16 @@ discard block |
||
| 443 | 443 | $row['principaluri'] = (string) $row['principaluri']; |
| 444 | 444 | $components = []; |
| 445 | 445 | if ($row['components']) { |
| 446 | - $components = explode(',',$row['components']); |
|
| 446 | + $components = explode(',', $row['components']); |
|
| 447 | 447 | } |
| 448 | 448 | $calendar = [ |
| 449 | 449 | 'id' => $row['id'], |
| 450 | 450 | 'uri' => $row['uri'], |
| 451 | 451 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
| 452 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 453 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 454 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 455 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 452 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
| 453 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
| 454 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 455 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
| 456 | 456 | ]; |
| 457 | 457 | foreach ($this->propertyMap as $xmlName => $dbName) { |
| 458 | 458 | $calendar[$xmlName] = $row[$dbName]; |
@@ -512,22 +512,22 @@ discard block |
||
| 512 | 512 | while ($row = $result->fetch()) { |
| 513 | 513 | $row['principaluri'] = (string) $row['principaluri']; |
| 514 | 514 | [, $name] = Uri\split($row['principaluri']); |
| 515 | - $row['displayname'] = $row['displayname'] . "($name)"; |
|
| 515 | + $row['displayname'] = $row['displayname']."($name)"; |
|
| 516 | 516 | $components = []; |
| 517 | 517 | if ($row['components']) { |
| 518 | - $components = explode(',',$row['components']); |
|
| 518 | + $components = explode(',', $row['components']); |
|
| 519 | 519 | } |
| 520 | 520 | $calendar = [ |
| 521 | 521 | 'id' => $row['id'], |
| 522 | 522 | 'uri' => $row['publicuri'], |
| 523 | 523 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
| 524 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 525 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 526 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 527 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 528 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], $this->legacyEndpoint), |
|
| 529 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ, |
|
| 530 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC, |
|
| 524 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
| 525 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
| 526 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 527 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
| 528 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], $this->legacyEndpoint), |
|
| 529 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only' => (int) $row['access'] === Backend::ACCESS_READ, |
|
| 530 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}public' => (int) $row['access'] === self::ACCESS_PUBLIC, |
|
| 531 | 531 | ]; |
| 532 | 532 | |
| 533 | 533 | foreach ($this->propertyMap as $xmlName => $dbName) { |
@@ -574,27 +574,27 @@ discard block |
||
| 574 | 574 | $result->closeCursor(); |
| 575 | 575 | |
| 576 | 576 | if ($row === false) { |
| 577 | - throw new NotFound('Node with name \'' . $uri . '\' could not be found'); |
|
| 577 | + throw new NotFound('Node with name \''.$uri.'\' could not be found'); |
|
| 578 | 578 | } |
| 579 | 579 | |
| 580 | 580 | $row['principaluri'] = (string) $row['principaluri']; |
| 581 | 581 | [, $name] = Uri\split($row['principaluri']); |
| 582 | - $row['displayname'] = $row['displayname'] . ' ' . "($name)"; |
|
| 582 | + $row['displayname'] = $row['displayname'].' '."($name)"; |
|
| 583 | 583 | $components = []; |
| 584 | 584 | if ($row['components']) { |
| 585 | - $components = explode(',',$row['components']); |
|
| 585 | + $components = explode(',', $row['components']); |
|
| 586 | 586 | } |
| 587 | 587 | $calendar = [ |
| 588 | 588 | 'id' => $row['id'], |
| 589 | 589 | 'uri' => $row['publicuri'], |
| 590 | 590 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
| 591 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 592 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 593 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 594 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 595 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 596 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ, |
|
| 597 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC, |
|
| 591 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
| 592 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
| 593 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 594 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
| 595 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 596 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only' => (int) $row['access'] === Backend::ACCESS_READ, |
|
| 597 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}public' => (int) $row['access'] === self::ACCESS_PUBLIC, |
|
| 598 | 598 | ]; |
| 599 | 599 | |
| 600 | 600 | foreach ($this->propertyMap as $xmlName => $dbName) { |
@@ -637,17 +637,17 @@ discard block |
||
| 637 | 637 | $row['principaluri'] = (string) $row['principaluri']; |
| 638 | 638 | $components = []; |
| 639 | 639 | if ($row['components']) { |
| 640 | - $components = explode(',',$row['components']); |
|
| 640 | + $components = explode(',', $row['components']); |
|
| 641 | 641 | } |
| 642 | 642 | |
| 643 | 643 | $calendar = [ |
| 644 | 644 | 'id' => $row['id'], |
| 645 | 645 | 'uri' => $row['uri'], |
| 646 | 646 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
| 647 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 648 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 649 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 650 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 647 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
| 648 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
| 649 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 650 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
| 651 | 651 | ]; |
| 652 | 652 | |
| 653 | 653 | foreach ($this->propertyMap as $xmlName => $dbName) { |
@@ -688,17 +688,17 @@ discard block |
||
| 688 | 688 | $row['principaluri'] = (string) $row['principaluri']; |
| 689 | 689 | $components = []; |
| 690 | 690 | if ($row['components']) { |
| 691 | - $components = explode(',',$row['components']); |
|
| 691 | + $components = explode(',', $row['components']); |
|
| 692 | 692 | } |
| 693 | 693 | |
| 694 | 694 | $calendar = [ |
| 695 | 695 | 'id' => $row['id'], |
| 696 | 696 | 'uri' => $row['uri'], |
| 697 | 697 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
| 698 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 699 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 700 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 701 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 698 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
| 699 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
| 700 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 701 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
| 702 | 702 | ]; |
| 703 | 703 | |
| 704 | 704 | foreach ($this->propertyMap as $xmlName => $dbName) { |
@@ -742,8 +742,8 @@ discard block |
||
| 742 | 742 | 'principaluri' => $row['principaluri'], |
| 743 | 743 | 'source' => $row['source'], |
| 744 | 744 | 'lastmodified' => $row['lastmodified'], |
| 745 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
| 746 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 745 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
| 746 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
| 747 | 747 | ]; |
| 748 | 748 | |
| 749 | 749 | foreach ($this->subscriptionPropertyMap as $xmlName => $dbName) { |
@@ -780,16 +780,16 @@ discard block |
||
| 780 | 780 | $sccs = '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set'; |
| 781 | 781 | if (isset($properties[$sccs])) { |
| 782 | 782 | if (!($properties[$sccs] instanceof SupportedCalendarComponentSet)) { |
| 783 | - throw new DAV\Exception('The ' . $sccs . ' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet'); |
|
| 783 | + throw new DAV\Exception('The '.$sccs.' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet'); |
|
| 784 | 784 | } |
| 785 | - $values['components'] = implode(',',$properties[$sccs]->getValue()); |
|
| 785 | + $values['components'] = implode(',', $properties[$sccs]->getValue()); |
|
| 786 | 786 | } elseif (isset($properties['components'])) { |
| 787 | 787 | // Allow to provide components internally without having |
| 788 | 788 | // to create a SupportedCalendarComponentSet object |
| 789 | 789 | $values['components'] = $properties['components']; |
| 790 | 790 | } |
| 791 | 791 | |
| 792 | - $transp = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp'; |
|
| 792 | + $transp = '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp'; |
|
| 793 | 793 | if (isset($properties[$transp])) { |
| 794 | 794 | $values['transparent'] = (int) ($properties[$transp]->getValue() === 'transparent'); |
| 795 | 795 | } |
@@ -809,7 +809,7 @@ discard block |
||
| 809 | 809 | $calendarId = $query->getLastInsertId(); |
| 810 | 810 | |
| 811 | 811 | $calendarData = $this->getCalendarById($calendarId); |
| 812 | - $this->dispatcher->dispatchTyped(new CalendarCreatedEvent((int)$calendarId, $calendarData)); |
|
| 812 | + $this->dispatcher->dispatchTyped(new CalendarCreatedEvent((int) $calendarId, $calendarData)); |
|
| 813 | 813 | $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::createCalendar', new GenericEvent( |
| 814 | 814 | '\OCA\DAV\CalDAV\CalDavBackend::createCalendar', |
| 815 | 815 | [ |
@@ -838,13 +838,13 @@ discard block |
||
| 838 | 838 | */ |
| 839 | 839 | public function updateCalendar($calendarId, PropPatch $propPatch) { |
| 840 | 840 | $supportedProperties = array_keys($this->propertyMap); |
| 841 | - $supportedProperties[] = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp'; |
|
| 841 | + $supportedProperties[] = '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp'; |
|
| 842 | 842 | |
| 843 | - $propPatch->handle($supportedProperties, function ($mutations) use ($calendarId) { |
|
| 843 | + $propPatch->handle($supportedProperties, function($mutations) use ($calendarId) { |
|
| 844 | 844 | $newValues = []; |
| 845 | 845 | foreach ($mutations as $propertyName => $propertyValue) { |
| 846 | 846 | switch ($propertyName) { |
| 847 | - case '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp': |
|
| 847 | + case '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp': |
|
| 848 | 848 | $fieldName = 'transparent'; |
| 849 | 849 | $newValues[$fieldName] = (int) ($propertyValue->getValue() === 'transparent'); |
| 850 | 850 | break; |
@@ -866,7 +866,7 @@ discard block |
||
| 866 | 866 | |
| 867 | 867 | $calendarData = $this->getCalendarById($calendarId); |
| 868 | 868 | $shares = $this->getShares($calendarId); |
| 869 | - $this->dispatcher->dispatchTyped(new CalendarUpdatedEvent((int)$calendarId, $calendarData, $shares, $mutations)); |
|
| 869 | + $this->dispatcher->dispatchTyped(new CalendarUpdatedEvent((int) $calendarId, $calendarData, $shares, $mutations)); |
|
| 870 | 870 | $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateCalendar', new GenericEvent( |
| 871 | 871 | '\OCA\DAV\CalDAV\CalDavBackend::updateCalendar', |
| 872 | 872 | [ |
@@ -909,7 +909,7 @@ discard block |
||
| 909 | 909 | |
| 910 | 910 | // Only dispatch if we actually deleted anything |
| 911 | 911 | if ($calendarData) { |
| 912 | - $this->dispatcher->dispatchTyped(new CalendarDeletedEvent((int)$calendarId, $calendarData, $shares)); |
|
| 912 | + $this->dispatcher->dispatchTyped(new CalendarDeletedEvent((int) $calendarId, $calendarData, $shares)); |
|
| 913 | 913 | } |
| 914 | 914 | } |
| 915 | 915 | |
@@ -969,11 +969,11 @@ discard block |
||
| 969 | 969 | 'id' => $row['id'], |
| 970 | 970 | 'uri' => $row['uri'], |
| 971 | 971 | 'lastmodified' => $row['lastmodified'], |
| 972 | - 'etag' => '"' . $row['etag'] . '"', |
|
| 972 | + 'etag' => '"'.$row['etag'].'"', |
|
| 973 | 973 | 'calendarid' => $row['calendarid'], |
| 974 | - 'size' => (int)$row['size'], |
|
| 974 | + 'size' => (int) $row['size'], |
|
| 975 | 975 | 'component' => strtolower($row['componenttype']), |
| 976 | - 'classification' => (int)$row['classification'] |
|
| 976 | + 'classification' => (int) $row['classification'] |
|
| 977 | 977 | ]; |
| 978 | 978 | } |
| 979 | 979 | $stmt->closeCursor(); |
@@ -1017,12 +1017,12 @@ discard block |
||
| 1017 | 1017 | 'id' => $row['id'], |
| 1018 | 1018 | 'uri' => $row['uri'], |
| 1019 | 1019 | 'lastmodified' => $row['lastmodified'], |
| 1020 | - 'etag' => '"' . $row['etag'] . '"', |
|
| 1020 | + 'etag' => '"'.$row['etag'].'"', |
|
| 1021 | 1021 | 'calendarid' => $row['calendarid'], |
| 1022 | - 'size' => (int)$row['size'], |
|
| 1022 | + 'size' => (int) $row['size'], |
|
| 1023 | 1023 | 'calendardata' => $this->readBlob($row['calendardata']), |
| 1024 | 1024 | 'component' => strtolower($row['componenttype']), |
| 1025 | - 'classification' => (int)$row['classification'] |
|
| 1025 | + 'classification' => (int) $row['classification'] |
|
| 1026 | 1026 | ]; |
| 1027 | 1027 | } |
| 1028 | 1028 | |
@@ -1063,12 +1063,12 @@ discard block |
||
| 1063 | 1063 | 'id' => $row['id'], |
| 1064 | 1064 | 'uri' => $row['uri'], |
| 1065 | 1065 | 'lastmodified' => $row['lastmodified'], |
| 1066 | - 'etag' => '"' . $row['etag'] . '"', |
|
| 1066 | + 'etag' => '"'.$row['etag'].'"', |
|
| 1067 | 1067 | 'calendarid' => $row['calendarid'], |
| 1068 | - 'size' => (int)$row['size'], |
|
| 1068 | + 'size' => (int) $row['size'], |
|
| 1069 | 1069 | 'calendardata' => $this->readBlob($row['calendardata']), |
| 1070 | 1070 | 'component' => strtolower($row['componenttype']), |
| 1071 | - 'classification' => (int)$row['classification'] |
|
| 1071 | + 'classification' => (int) $row['classification'] |
|
| 1072 | 1072 | ]; |
| 1073 | 1073 | } |
| 1074 | 1074 | $result->closeCursor(); |
@@ -1140,11 +1140,11 @@ discard block |
||
| 1140 | 1140 | $calendarRow = $this->getCalendarById($calendarId); |
| 1141 | 1141 | $shares = $this->getShares($calendarId); |
| 1142 | 1142 | |
| 1143 | - $this->dispatcher->dispatchTyped(new CalendarObjectCreatedEvent((int)$calendarId, $calendarRow, $shares, $objectRow)); |
|
| 1143 | + $this->dispatcher->dispatchTyped(new CalendarObjectCreatedEvent((int) $calendarId, $calendarRow, $shares, $objectRow)); |
|
| 1144 | 1144 | } else { |
| 1145 | 1145 | $subscriptionRow = $this->getSubscriptionById($calendarId); |
| 1146 | 1146 | |
| 1147 | - $this->dispatcher->dispatchTyped(new CachedCalendarObjectCreatedEvent((int)$calendarId, $subscriptionRow, [], $objectRow)); |
|
| 1147 | + $this->dispatcher->dispatchTyped(new CachedCalendarObjectCreatedEvent((int) $calendarId, $subscriptionRow, [], $objectRow)); |
|
| 1148 | 1148 | $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::createCachedCalendarObject', new GenericEvent( |
| 1149 | 1149 | '\OCA\DAV\CalDAV\CalDavBackend::createCachedCalendarObject', |
| 1150 | 1150 | [ |
@@ -1156,7 +1156,7 @@ discard block |
||
| 1156 | 1156 | )); |
| 1157 | 1157 | } |
| 1158 | 1158 | |
| 1159 | - return '"' . $extraData['etag'] . '"'; |
|
| 1159 | + return '"'.$extraData['etag'].'"'; |
|
| 1160 | 1160 | } |
| 1161 | 1161 | |
| 1162 | 1162 | /** |
@@ -1205,11 +1205,11 @@ discard block |
||
| 1205 | 1205 | $calendarRow = $this->getCalendarById($calendarId); |
| 1206 | 1206 | $shares = $this->getShares($calendarId); |
| 1207 | 1207 | |
| 1208 | - $this->dispatcher->dispatchTyped(new CalendarObjectUpdatedEvent((int)$calendarId, $calendarRow, $shares, $objectRow)); |
|
| 1208 | + $this->dispatcher->dispatchTyped(new CalendarObjectUpdatedEvent((int) $calendarId, $calendarRow, $shares, $objectRow)); |
|
| 1209 | 1209 | } else { |
| 1210 | 1210 | $subscriptionRow = $this->getSubscriptionById($calendarId); |
| 1211 | 1211 | |
| 1212 | - $this->dispatcher->dispatchTyped(new CachedCalendarObjectUpdatedEvent((int)$calendarId, $subscriptionRow, [], $objectRow)); |
|
| 1212 | + $this->dispatcher->dispatchTyped(new CachedCalendarObjectUpdatedEvent((int) $calendarId, $subscriptionRow, [], $objectRow)); |
|
| 1213 | 1213 | $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateCachedCalendarObject', new GenericEvent( |
| 1214 | 1214 | '\OCA\DAV\CalDAV\CalDavBackend::updateCachedCalendarObject', |
| 1215 | 1215 | [ |
@@ -1222,7 +1222,7 @@ discard block |
||
| 1222 | 1222 | } |
| 1223 | 1223 | } |
| 1224 | 1224 | |
| 1225 | - return '"' . $extraData['etag'] . '"'; |
|
| 1225 | + return '"'.$extraData['etag'].'"'; |
|
| 1226 | 1226 | } |
| 1227 | 1227 | |
| 1228 | 1228 | /** |
@@ -1259,11 +1259,11 @@ discard block |
||
| 1259 | 1259 | $calendarRow = $this->getCalendarById($calendarId); |
| 1260 | 1260 | $shares = $this->getShares($calendarId); |
| 1261 | 1261 | |
| 1262 | - $this->dispatcher->dispatchTyped(new CalendarObjectDeletedEvent((int)$calendarId, $calendarRow, $shares, $data)); |
|
| 1262 | + $this->dispatcher->dispatchTyped(new CalendarObjectDeletedEvent((int) $calendarId, $calendarRow, $shares, $data)); |
|
| 1263 | 1263 | } else { |
| 1264 | 1264 | $subscriptionRow = $this->getSubscriptionById($calendarId); |
| 1265 | 1265 | |
| 1266 | - $this->dispatcher->dispatchTyped(new CachedCalendarObjectDeletedEvent((int)$calendarId, $subscriptionRow, [], $data)); |
|
| 1266 | + $this->dispatcher->dispatchTyped(new CachedCalendarObjectDeletedEvent((int) $calendarId, $subscriptionRow, [], $data)); |
|
| 1267 | 1267 | $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::deleteCachedCalendarObject', new GenericEvent( |
| 1268 | 1268 | '\OCA\DAV\CalDAV\CalDavBackend::deleteCachedCalendarObject', |
| 1269 | 1269 | [ |
@@ -1535,7 +1535,7 @@ discard block |
||
| 1535 | 1535 | |
| 1536 | 1536 | $result = []; |
| 1537 | 1537 | while ($row = $stmt->fetch()) { |
| 1538 | - $path = $uriMapper[$row['calendarid']] . '/' . $row['uri']; |
|
| 1538 | + $path = $uriMapper[$row['calendarid']].'/'.$row['uri']; |
|
| 1539 | 1539 | if (!in_array($path, $result)) { |
| 1540 | 1540 | $result[] = $path; |
| 1541 | 1541 | } |
@@ -1583,8 +1583,8 @@ discard block |
||
| 1583 | 1583 | |
| 1584 | 1584 | if ($pattern !== '') { |
| 1585 | 1585 | $innerQuery->andWhere($innerQuery->expr()->iLike('op.value', |
| 1586 | - $outerQuery->createNamedParameter('%' . |
|
| 1587 | - $this->db->escapeLikeParameter($pattern) . '%'))); |
|
| 1586 | + $outerQuery->createNamedParameter('%'. |
|
| 1587 | + $this->db->escapeLikeParameter($pattern).'%'))); |
|
| 1588 | 1588 | } |
| 1589 | 1589 | |
| 1590 | 1590 | $outerQuery->select('c.id', 'c.calendardata', 'c.componenttype', 'c.uid', 'c.uri') |
@@ -1623,7 +1623,7 @@ discard block |
||
| 1623 | 1623 | $result = $outerQuery->executeQuery(); |
| 1624 | 1624 | $calendarObjects = $result->fetchAll(); |
| 1625 | 1625 | |
| 1626 | - return array_map(function ($o) { |
|
| 1626 | + return array_map(function($o) { |
|
| 1627 | 1627 | $calendarData = Reader::read($o['calendardata']); |
| 1628 | 1628 | $comps = $calendarData->getComponents(); |
| 1629 | 1629 | $objects = []; |
@@ -1641,10 +1641,10 @@ discard block |
||
| 1641 | 1641 | 'type' => $o['componenttype'], |
| 1642 | 1642 | 'uid' => $o['uid'], |
| 1643 | 1643 | 'uri' => $o['uri'], |
| 1644 | - 'objects' => array_map(function ($c) { |
|
| 1644 | + 'objects' => array_map(function($c) { |
|
| 1645 | 1645 | return $this->transformSearchData($c); |
| 1646 | 1646 | }, $objects), |
| 1647 | - 'timezones' => array_map(function ($c) { |
|
| 1647 | + 'timezones' => array_map(function($c) { |
|
| 1648 | 1648 | return $this->transformSearchData($c); |
| 1649 | 1649 | }, $timezones), |
| 1650 | 1650 | ]; |
@@ -1660,7 +1660,7 @@ discard block |
||
| 1660 | 1660 | /** @var Component[] $subComponents */ |
| 1661 | 1661 | $subComponents = $comp->getComponents(); |
| 1662 | 1662 | /** @var Property[] $properties */ |
| 1663 | - $properties = array_filter($comp->children(), function ($c) { |
|
| 1663 | + $properties = array_filter($comp->children(), function($c) { |
|
| 1664 | 1664 | return $c instanceof Property; |
| 1665 | 1665 | }); |
| 1666 | 1666 | $validationRules = $comp->getValidationRules(); |
@@ -1738,7 +1738,7 @@ discard block |
||
| 1738 | 1738 | $subscriptions = $this->getSubscriptionsForUser($principalUri); |
| 1739 | 1739 | foreach ($calendars as $calendar) { |
| 1740 | 1740 | $calendarAnd = $calendarObjectIdQuery->expr()->andX(); |
| 1741 | - $calendarAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int)$calendar['id']))); |
|
| 1741 | + $calendarAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int) $calendar['id']))); |
|
| 1742 | 1742 | $calendarAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendartype', $calendarObjectIdQuery->createNamedParameter(self::CALENDAR_TYPE_CALENDAR))); |
| 1743 | 1743 | |
| 1744 | 1744 | // If it's shared, limit search to public events |
@@ -1751,7 +1751,7 @@ discard block |
||
| 1751 | 1751 | } |
| 1752 | 1752 | foreach ($subscriptions as $subscription) { |
| 1753 | 1753 | $subscriptionAnd = $calendarObjectIdQuery->expr()->andX(); |
| 1754 | - $subscriptionAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int)$subscription['id']))); |
|
| 1754 | + $subscriptionAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int) $subscription['id']))); |
|
| 1755 | 1755 | $subscriptionAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendartype', $calendarObjectIdQuery->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION))); |
| 1756 | 1756 | |
| 1757 | 1757 | // If it's shared, limit search to public events |
@@ -1796,7 +1796,7 @@ discard block |
||
| 1796 | 1796 | if (!$escapePattern) { |
| 1797 | 1797 | $calendarObjectIdQuery->andWhere($calendarObjectIdQuery->expr()->ilike('cob.value', $calendarObjectIdQuery->createNamedParameter($pattern))); |
| 1798 | 1798 | } else { |
| 1799 | - $calendarObjectIdQuery->andWhere($calendarObjectIdQuery->expr()->ilike('cob.value', $calendarObjectIdQuery->createNamedParameter('%' . $this->db->escapeLikeParameter($pattern) . '%'))); |
|
| 1799 | + $calendarObjectIdQuery->andWhere($calendarObjectIdQuery->expr()->ilike('cob.value', $calendarObjectIdQuery->createNamedParameter('%'.$this->db->escapeLikeParameter($pattern).'%'))); |
|
| 1800 | 1800 | } |
| 1801 | 1801 | } |
| 1802 | 1802 | |
@@ -1810,7 +1810,7 @@ discard block |
||
| 1810 | 1810 | $result = $calendarObjectIdQuery->executeQuery(); |
| 1811 | 1811 | $matches = $result->fetchAll(); |
| 1812 | 1812 | $result->closeCursor(); |
| 1813 | - $matches = array_map(static function (array $match):int { |
|
| 1813 | + $matches = array_map(static function(array $match):int { |
|
| 1814 | 1814 | return (int) $match['objectid']; |
| 1815 | 1815 | }, $matches); |
| 1816 | 1816 | |
@@ -1823,9 +1823,9 @@ discard block |
||
| 1823 | 1823 | $calendarObjects = $result->fetchAll(); |
| 1824 | 1824 | $result->closeCursor(); |
| 1825 | 1825 | |
| 1826 | - return array_map(function (array $array): array { |
|
| 1827 | - $array['calendarid'] = (int)$array['calendarid']; |
|
| 1828 | - $array['calendartype'] = (int)$array['calendartype']; |
|
| 1826 | + return array_map(function(array $array): array { |
|
| 1827 | + $array['calendarid'] = (int) $array['calendarid']; |
|
| 1828 | + $array['calendartype'] = (int) $array['calendartype']; |
|
| 1829 | 1829 | $array['calendardata'] = $this->readBlob($array['calendardata']); |
| 1830 | 1830 | |
| 1831 | 1831 | return $array; |
@@ -1863,7 +1863,7 @@ discard block |
||
| 1863 | 1863 | $row = $stmt->fetch(); |
| 1864 | 1864 | $stmt->closeCursor(); |
| 1865 | 1865 | if ($row) { |
| 1866 | - return $row['calendaruri'] . '/' . $row['objecturi']; |
|
| 1866 | + return $row['calendaruri'].'/'.$row['objecturi']; |
|
| 1867 | 1867 | } |
| 1868 | 1868 | |
| 1869 | 1869 | return null; |
@@ -2064,8 +2064,8 @@ discard block |
||
| 2064 | 2064 | 'source' => $row['source'], |
| 2065 | 2065 | 'lastmodified' => $row['lastmodified'], |
| 2066 | 2066 | |
| 2067 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
| 2068 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 2067 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
| 2068 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
| 2069 | 2069 | ]; |
| 2070 | 2070 | |
| 2071 | 2071 | foreach ($this->subscriptionPropertyMap as $xmlName => $dbName) { |
@@ -2160,7 +2160,7 @@ discard block |
||
| 2160 | 2160 | $supportedProperties = array_keys($this->subscriptionPropertyMap); |
| 2161 | 2161 | $supportedProperties[] = '{http://calendarserver.org/ns/}source'; |
| 2162 | 2162 | |
| 2163 | - $propPatch->handle($supportedProperties, function ($mutations) use ($subscriptionId) { |
|
| 2163 | + $propPatch->handle($supportedProperties, function($mutations) use ($subscriptionId) { |
|
| 2164 | 2164 | $newValues = []; |
| 2165 | 2165 | |
| 2166 | 2166 | foreach ($mutations as $propertyName => $propertyValue) { |
@@ -2182,7 +2182,7 @@ discard block |
||
| 2182 | 2182 | ->executeStatement(); |
| 2183 | 2183 | |
| 2184 | 2184 | $subscriptionRow = $this->getSubscriptionById($subscriptionId); |
| 2185 | - $this->dispatcher->dispatchTyped(new SubscriptionUpdatedEvent((int)$subscriptionId, $subscriptionRow, [], $mutations)); |
|
| 2185 | + $this->dispatcher->dispatchTyped(new SubscriptionUpdatedEvent((int) $subscriptionId, $subscriptionRow, [], $mutations)); |
|
| 2186 | 2186 | $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateSubscription', new GenericEvent( |
| 2187 | 2187 | '\OCA\DAV\CalDAV\CalDavBackend::updateSubscription', |
| 2188 | 2188 | [ |
@@ -2233,7 +2233,7 @@ discard block |
||
| 2233 | 2233 | ->executeStatement(); |
| 2234 | 2234 | |
| 2235 | 2235 | if ($subscriptionRow) { |
| 2236 | - $this->dispatcher->dispatchTyped(new SubscriptionDeletedEvent((int)$subscriptionId, $subscriptionRow, [])); |
|
| 2236 | + $this->dispatcher->dispatchTyped(new SubscriptionDeletedEvent((int) $subscriptionId, $subscriptionRow, [])); |
|
| 2237 | 2237 | } |
| 2238 | 2238 | } |
| 2239 | 2239 | |
@@ -2271,8 +2271,8 @@ discard block |
||
| 2271 | 2271 | 'uri' => $row['uri'], |
| 2272 | 2272 | 'calendardata' => $row['calendardata'], |
| 2273 | 2273 | 'lastmodified' => $row['lastmodified'], |
| 2274 | - 'etag' => '"' . $row['etag'] . '"', |
|
| 2275 | - 'size' => (int)$row['size'], |
|
| 2274 | + 'etag' => '"'.$row['etag'].'"', |
|
| 2275 | + 'size' => (int) $row['size'], |
|
| 2276 | 2276 | ]; |
| 2277 | 2277 | } |
| 2278 | 2278 | |
@@ -2300,8 +2300,8 @@ discard block |
||
| 2300 | 2300 | 'calendardata' => $row['calendardata'], |
| 2301 | 2301 | 'uri' => $row['uri'], |
| 2302 | 2302 | 'lastmodified' => $row['lastmodified'], |
| 2303 | - 'etag' => '"' . $row['etag'] . '"', |
|
| 2304 | - 'size' => (int)$row['size'], |
|
| 2303 | + 'etag' => '"'.$row['etag'].'"', |
|
| 2304 | + 'size' => (int) $row['size'], |
|
| 2305 | 2305 | ]; |
| 2306 | 2306 | } |
| 2307 | 2307 | |
@@ -2355,14 +2355,14 @@ discard block |
||
| 2355 | 2355 | * @return void |
| 2356 | 2356 | */ |
| 2357 | 2357 | protected function addChange($calendarId, $objectUri, $operation, $calendarType = self::CALENDAR_TYPE_CALENDAR) { |
| 2358 | - $table = $calendarType === self::CALENDAR_TYPE_CALENDAR ? 'calendars': 'calendarsubscriptions'; |
|
| 2358 | + $table = $calendarType === self::CALENDAR_TYPE_CALENDAR ? 'calendars' : 'calendarsubscriptions'; |
|
| 2359 | 2359 | |
| 2360 | 2360 | $query = $this->db->getQueryBuilder(); |
| 2361 | 2361 | $query->select('synctoken') |
| 2362 | 2362 | ->from($table) |
| 2363 | 2363 | ->where($query->expr()->eq('id', $query->createNamedParameter($calendarId))); |
| 2364 | 2364 | $result = $query->executeQuery(); |
| 2365 | - $syncToken = (int)$result->fetchOne(); |
|
| 2365 | + $syncToken = (int) $result->fetchOne(); |
|
| 2366 | 2366 | $result->closeCursor(); |
| 2367 | 2367 | |
| 2368 | 2368 | $query = $this->db->getQueryBuilder(); |
@@ -2419,7 +2419,7 @@ discard block |
||
| 2419 | 2419 | // Track first component type and uid |
| 2420 | 2420 | if ($uid === null) { |
| 2421 | 2421 | $componentType = $component->name; |
| 2422 | - $uid = (string)$component->UID; |
|
| 2422 | + $uid = (string) $component->UID; |
|
| 2423 | 2423 | } |
| 2424 | 2424 | } |
| 2425 | 2425 | } |
@@ -2518,7 +2518,7 @@ discard block |
||
| 2518 | 2518 | ])); |
| 2519 | 2519 | $this->calendarSharingBackend->updateShares($shareable, $add, $remove); |
| 2520 | 2520 | |
| 2521 | - $this->dispatcher->dispatchTyped(new CalendarShareUpdatedEvent((int)$calendarId, $calendarRow, $oldShares, $add, $remove)); |
|
| 2521 | + $this->dispatcher->dispatchTyped(new CalendarShareUpdatedEvent((int) $calendarId, $calendarRow, $oldShares, $add, $remove)); |
|
| 2522 | 2522 | } |
| 2523 | 2523 | |
| 2524 | 2524 | /** |
@@ -2558,7 +2558,7 @@ discard block |
||
| 2558 | 2558 | ]); |
| 2559 | 2559 | $query->executeStatement(); |
| 2560 | 2560 | |
| 2561 | - $this->dispatcher->dispatchTyped(new CalendarPublishedEvent((int)$calendarId, $calendarData, $publicUri)); |
|
| 2561 | + $this->dispatcher->dispatchTyped(new CalendarPublishedEvent((int) $calendarId, $calendarData, $publicUri)); |
|
| 2562 | 2562 | return $publicUri; |
| 2563 | 2563 | } |
| 2564 | 2564 | $query->delete('dav_shares') |
@@ -2566,7 +2566,7 @@ discard block |
||
| 2566 | 2566 | ->andWhere($query->expr()->eq('access', $query->createNamedParameter(self::ACCESS_PUBLIC))); |
| 2567 | 2567 | $query->executeStatement(); |
| 2568 | 2568 | |
| 2569 | - $this->dispatcher->dispatchTyped(new CalendarUnpublishedEvent((int)$calendarId, $calendarData)); |
|
| 2569 | + $this->dispatcher->dispatchTyped(new CalendarUnpublishedEvent((int) $calendarId, $calendarData)); |
|
| 2570 | 2570 | return null; |
| 2571 | 2571 | } |
| 2572 | 2572 | |
@@ -2789,10 +2789,10 @@ discard block |
||
| 2789 | 2789 | $result->closeCursor(); |
| 2790 | 2790 | |
| 2791 | 2791 | if (!isset($objectIds['id'])) { |
| 2792 | - throw new \InvalidArgumentException('Calendarobject does not exists: ' . $uri); |
|
| 2792 | + throw new \InvalidArgumentException('Calendarobject does not exists: '.$uri); |
|
| 2793 | 2793 | } |
| 2794 | 2794 | |
| 2795 | - return (int)$objectIds['id']; |
|
| 2795 | + return (int) $objectIds['id']; |
|
| 2796 | 2796 | } |
| 2797 | 2797 | |
| 2798 | 2798 | /** |
@@ -2819,8 +2819,8 @@ discard block |
||
| 2819 | 2819 | * @param $calendarInfo |
| 2820 | 2820 | */ |
| 2821 | 2821 | private function addOwnerPrincipal(&$calendarInfo) { |
| 2822 | - $ownerPrincipalKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal'; |
|
| 2823 | - $displaynameKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}owner-displayname'; |
|
| 2822 | + $ownerPrincipalKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal'; |
|
| 2823 | + $displaynameKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD.'}owner-displayname'; |
|
| 2824 | 2824 | if (isset($calendarInfo[$ownerPrincipalKey])) { |
| 2825 | 2825 | $uri = $calendarInfo[$ownerPrincipalKey]; |
| 2826 | 2826 | } else { |
@@ -48,724 +48,724 @@ |
||
| 48 | 48 | |
| 49 | 49 | class ReminderService { |
| 50 | 50 | |
| 51 | - /** @var Backend */ |
|
| 52 | - private $backend; |
|
| 53 | - |
|
| 54 | - /** @var NotificationProviderManager */ |
|
| 55 | - private $notificationProviderManager; |
|
| 56 | - |
|
| 57 | - /** @var IUserManager */ |
|
| 58 | - private $userManager; |
|
| 59 | - |
|
| 60 | - /** @var IGroupManager */ |
|
| 61 | - private $groupManager; |
|
| 62 | - |
|
| 63 | - /** @var CalDavBackend */ |
|
| 64 | - private $caldavBackend; |
|
| 65 | - |
|
| 66 | - /** @var ITimeFactory */ |
|
| 67 | - private $timeFactory; |
|
| 68 | - |
|
| 69 | - public const REMINDER_TYPE_EMAIL = 'EMAIL'; |
|
| 70 | - public const REMINDER_TYPE_DISPLAY = 'DISPLAY'; |
|
| 71 | - public const REMINDER_TYPE_AUDIO = 'AUDIO'; |
|
| 72 | - |
|
| 73 | - /** |
|
| 74 | - * @var String[] |
|
| 75 | - * |
|
| 76 | - * Official RFC5545 reminder types |
|
| 77 | - */ |
|
| 78 | - public const REMINDER_TYPES = [ |
|
| 79 | - self::REMINDER_TYPE_EMAIL, |
|
| 80 | - self::REMINDER_TYPE_DISPLAY, |
|
| 81 | - self::REMINDER_TYPE_AUDIO |
|
| 82 | - ]; |
|
| 83 | - |
|
| 84 | - /** |
|
| 85 | - * ReminderService constructor. |
|
| 86 | - * |
|
| 87 | - * @param Backend $backend |
|
| 88 | - * @param NotificationProviderManager $notificationProviderManager |
|
| 89 | - * @param IUserManager $userManager |
|
| 90 | - * @param IGroupManager $groupManager |
|
| 91 | - * @param CalDavBackend $caldavBackend |
|
| 92 | - * @param ITimeFactory $timeFactory |
|
| 93 | - */ |
|
| 94 | - public function __construct(Backend $backend, |
|
| 95 | - NotificationProviderManager $notificationProviderManager, |
|
| 96 | - IUserManager $userManager, |
|
| 97 | - IGroupManager $groupManager, |
|
| 98 | - CalDavBackend $caldavBackend, |
|
| 99 | - ITimeFactory $timeFactory) { |
|
| 100 | - $this->backend = $backend; |
|
| 101 | - $this->notificationProviderManager = $notificationProviderManager; |
|
| 102 | - $this->userManager = $userManager; |
|
| 103 | - $this->groupManager = $groupManager; |
|
| 104 | - $this->caldavBackend = $caldavBackend; |
|
| 105 | - $this->timeFactory = $timeFactory; |
|
| 106 | - } |
|
| 107 | - |
|
| 108 | - /** |
|
| 109 | - * Process reminders to activate |
|
| 110 | - * |
|
| 111 | - * @throws NotificationProvider\ProviderNotAvailableException |
|
| 112 | - * @throws NotificationTypeDoesNotExistException |
|
| 113 | - */ |
|
| 114 | - public function processReminders():void { |
|
| 115 | - $reminders = $this->backend->getRemindersToProcess(); |
|
| 116 | - |
|
| 117 | - foreach ($reminders as $reminder) { |
|
| 118 | - $calendarData = is_resource($reminder['calendardata']) |
|
| 119 | - ? stream_get_contents($reminder['calendardata']) |
|
| 120 | - : $reminder['calendardata']; |
|
| 121 | - |
|
| 122 | - $vcalendar = $this->parseCalendarData($calendarData); |
|
| 123 | - if (!$vcalendar) { |
|
| 124 | - $this->backend->removeReminder($reminder['id']); |
|
| 125 | - continue; |
|
| 126 | - } |
|
| 127 | - |
|
| 128 | - $vevent = $this->getVEventByRecurrenceId($vcalendar, $reminder['recurrence_id'], $reminder['is_recurrence_exception']); |
|
| 129 | - if (!$vevent) { |
|
| 130 | - $this->backend->removeReminder($reminder['id']); |
|
| 131 | - continue; |
|
| 132 | - } |
|
| 133 | - |
|
| 134 | - if ($this->wasEventCancelled($vevent)) { |
|
| 135 | - $this->deleteOrProcessNext($reminder, $vevent); |
|
| 136 | - continue; |
|
| 137 | - } |
|
| 138 | - |
|
| 139 | - if (!$this->notificationProviderManager->hasProvider($reminder['type'])) { |
|
| 140 | - $this->deleteOrProcessNext($reminder, $vevent); |
|
| 141 | - continue; |
|
| 142 | - } |
|
| 143 | - |
|
| 144 | - $users = $this->getAllUsersWithWriteAccessToCalendar($reminder['calendar_id']); |
|
| 145 | - $user = $this->getUserFromPrincipalURI($reminder['principaluri']); |
|
| 146 | - if ($user) { |
|
| 147 | - $users[] = $user; |
|
| 148 | - } |
|
| 149 | - |
|
| 150 | - $notificationProvider = $this->notificationProviderManager->getProvider($reminder['type']); |
|
| 151 | - $notificationProvider->send($vevent, $reminder['displayname'], $users); |
|
| 152 | - |
|
| 153 | - $this->deleteOrProcessNext($reminder, $vevent); |
|
| 154 | - } |
|
| 155 | - } |
|
| 156 | - |
|
| 157 | - /** |
|
| 158 | - * @param array $objectData |
|
| 159 | - * @throws VObject\InvalidDataException |
|
| 160 | - */ |
|
| 161 | - public function onCalendarObjectCreate(array $objectData):void { |
|
| 162 | - // We only support VEvents for now |
|
| 163 | - if (strcasecmp($objectData['component'], 'vevent') !== 0) { |
|
| 164 | - return; |
|
| 165 | - } |
|
| 166 | - |
|
| 167 | - $calendarData = is_resource($objectData['calendardata']) |
|
| 168 | - ? stream_get_contents($objectData['calendardata']) |
|
| 169 | - : $objectData['calendardata']; |
|
| 170 | - |
|
| 171 | - /** @var VObject\Component\VCalendar $vcalendar */ |
|
| 172 | - $vcalendar = $this->parseCalendarData($calendarData); |
|
| 173 | - if (!$vcalendar) { |
|
| 174 | - return; |
|
| 175 | - } |
|
| 176 | - |
|
| 177 | - $vevents = $this->getAllVEventsFromVCalendar($vcalendar); |
|
| 178 | - if (count($vevents) === 0) { |
|
| 179 | - return; |
|
| 180 | - } |
|
| 181 | - |
|
| 182 | - $uid = (string) $vevents[0]->UID; |
|
| 183 | - $recurrenceExceptions = $this->getRecurrenceExceptionFromListOfVEvents($vevents); |
|
| 184 | - $masterItem = $this->getMasterItemFromListOfVEvents($vevents); |
|
| 185 | - $now = $this->timeFactory->getDateTime(); |
|
| 186 | - $isRecurring = $masterItem ? $this->isRecurring($masterItem) : false; |
|
| 187 | - |
|
| 188 | - foreach ($recurrenceExceptions as $recurrenceException) { |
|
| 189 | - $eventHash = $this->getEventHash($recurrenceException); |
|
| 190 | - |
|
| 191 | - if (!isset($recurrenceException->VALARM)) { |
|
| 192 | - continue; |
|
| 193 | - } |
|
| 194 | - |
|
| 195 | - foreach ($recurrenceException->VALARM as $valarm) { |
|
| 196 | - /** @var VAlarm $valarm */ |
|
| 197 | - $alarmHash = $this->getAlarmHash($valarm); |
|
| 198 | - $triggerTime = $valarm->getEffectiveTriggerTime(); |
|
| 199 | - $diff = $now->diff($triggerTime); |
|
| 200 | - if ($diff->invert === 1) { |
|
| 201 | - continue; |
|
| 202 | - } |
|
| 203 | - |
|
| 204 | - $alarms = $this->getRemindersForVAlarm($valarm, $objectData, |
|
| 205 | - $eventHash, $alarmHash, true, true); |
|
| 206 | - $this->writeRemindersToDatabase($alarms); |
|
| 207 | - } |
|
| 208 | - } |
|
| 209 | - |
|
| 210 | - if ($masterItem) { |
|
| 211 | - $processedAlarms = []; |
|
| 212 | - $masterAlarms = []; |
|
| 213 | - $masterHash = $this->getEventHash($masterItem); |
|
| 214 | - |
|
| 215 | - if (!isset($masterItem->VALARM)) { |
|
| 216 | - return; |
|
| 217 | - } |
|
| 218 | - |
|
| 219 | - foreach ($masterItem->VALARM as $valarm) { |
|
| 220 | - $masterAlarms[] = $this->getAlarmHash($valarm); |
|
| 221 | - } |
|
| 222 | - |
|
| 223 | - try { |
|
| 224 | - $iterator = new EventIterator($vevents, $uid); |
|
| 225 | - } catch (NoInstancesException $e) { |
|
| 226 | - // This event is recurring, but it doesn't have a single |
|
| 227 | - // instance. We are skipping this event from the output |
|
| 228 | - // entirely. |
|
| 229 | - return; |
|
| 230 | - } |
|
| 231 | - |
|
| 232 | - while ($iterator->valid() && count($processedAlarms) < count($masterAlarms)) { |
|
| 233 | - $event = $iterator->getEventObject(); |
|
| 234 | - |
|
| 235 | - // Recurrence-exceptions are handled separately, so just ignore them here |
|
| 236 | - if (\in_array($event, $recurrenceExceptions, true)) { |
|
| 237 | - $iterator->next(); |
|
| 238 | - continue; |
|
| 239 | - } |
|
| 240 | - |
|
| 241 | - foreach ($event->VALARM as $valarm) { |
|
| 242 | - /** @var VAlarm $valarm */ |
|
| 243 | - $alarmHash = $this->getAlarmHash($valarm); |
|
| 244 | - if (\in_array($alarmHash, $processedAlarms, true)) { |
|
| 245 | - continue; |
|
| 246 | - } |
|
| 247 | - |
|
| 248 | - if (!\in_array((string) $valarm->ACTION, self::REMINDER_TYPES, true)) { |
|
| 249 | - // Action allows x-name, we don't insert reminders |
|
| 250 | - // into the database if they are not standard |
|
| 251 | - $processedAlarms[] = $alarmHash; |
|
| 252 | - continue; |
|
| 253 | - } |
|
| 254 | - |
|
| 255 | - try { |
|
| 256 | - $triggerTime = $valarm->getEffectiveTriggerTime(); |
|
| 257 | - } catch (InvalidDataException $e) { |
|
| 258 | - continue; |
|
| 259 | - } |
|
| 260 | - |
|
| 261 | - // If effective trigger time is in the past |
|
| 262 | - // just skip and generate for next event |
|
| 263 | - $diff = $now->diff($triggerTime); |
|
| 264 | - if ($diff->invert === 1) { |
|
| 265 | - // If an absolute alarm is in the past, |
|
| 266 | - // just add it to processedAlarms, so |
|
| 267 | - // we don't extend till eternity |
|
| 268 | - if (!$this->isAlarmRelative($valarm)) { |
|
| 269 | - $processedAlarms[] = $alarmHash; |
|
| 270 | - } |
|
| 271 | - |
|
| 272 | - continue; |
|
| 273 | - } |
|
| 274 | - |
|
| 275 | - $alarms = $this->getRemindersForVAlarm($valarm, $objectData, $masterHash, $alarmHash, $isRecurring, false); |
|
| 276 | - $this->writeRemindersToDatabase($alarms); |
|
| 277 | - $processedAlarms[] = $alarmHash; |
|
| 278 | - } |
|
| 279 | - |
|
| 280 | - $iterator->next(); |
|
| 281 | - } |
|
| 282 | - } |
|
| 283 | - } |
|
| 284 | - |
|
| 285 | - /** |
|
| 286 | - * @param array $objectData |
|
| 287 | - * @throws VObject\InvalidDataException |
|
| 288 | - */ |
|
| 289 | - public function onCalendarObjectEdit(array $objectData):void { |
|
| 290 | - // TODO - this can be vastly improved |
|
| 291 | - // - get cached reminders |
|
| 292 | - // - ... |
|
| 293 | - |
|
| 294 | - $this->onCalendarObjectDelete($objectData); |
|
| 295 | - $this->onCalendarObjectCreate($objectData); |
|
| 296 | - } |
|
| 297 | - |
|
| 298 | - /** |
|
| 299 | - * @param array $objectData |
|
| 300 | - * @throws VObject\InvalidDataException |
|
| 301 | - */ |
|
| 302 | - public function onCalendarObjectDelete(array $objectData):void { |
|
| 303 | - // We only support VEvents for now |
|
| 304 | - if (strcasecmp($objectData['component'], 'vevent') !== 0) { |
|
| 305 | - return; |
|
| 306 | - } |
|
| 307 | - |
|
| 308 | - $this->backend->cleanRemindersForEvent((int) $objectData['id']); |
|
| 309 | - } |
|
| 310 | - |
|
| 311 | - /** |
|
| 312 | - * @param VAlarm $valarm |
|
| 313 | - * @param array $objectData |
|
| 314 | - * @param string|null $eventHash |
|
| 315 | - * @param string|null $alarmHash |
|
| 316 | - * @param bool $isRecurring |
|
| 317 | - * @param bool $isRecurrenceException |
|
| 318 | - * @return array |
|
| 319 | - */ |
|
| 320 | - private function getRemindersForVAlarm(VAlarm $valarm, |
|
| 321 | - array $objectData, |
|
| 322 | - string $eventHash = null, |
|
| 323 | - string $alarmHash = null, |
|
| 324 | - bool $isRecurring = false, |
|
| 325 | - bool $isRecurrenceException = false):array { |
|
| 326 | - if ($eventHash === null) { |
|
| 327 | - $eventHash = $this->getEventHash($valarm->parent); |
|
| 328 | - } |
|
| 329 | - if ($alarmHash === null) { |
|
| 330 | - $alarmHash = $this->getAlarmHash($valarm); |
|
| 331 | - } |
|
| 332 | - |
|
| 333 | - $recurrenceId = $this->getEffectiveRecurrenceIdOfVEvent($valarm->parent); |
|
| 334 | - $isRelative = $this->isAlarmRelative($valarm); |
|
| 335 | - /** @var DateTimeImmutable $notificationDate */ |
|
| 336 | - $notificationDate = $valarm->getEffectiveTriggerTime(); |
|
| 337 | - $clonedNotificationDate = new \DateTime('now', $notificationDate->getTimezone()); |
|
| 338 | - $clonedNotificationDate->setTimestamp($notificationDate->getTimestamp()); |
|
| 339 | - |
|
| 340 | - $alarms = []; |
|
| 341 | - |
|
| 342 | - $alarms[] = [ |
|
| 343 | - 'calendar_id' => $objectData['calendarid'], |
|
| 344 | - 'object_id' => $objectData['id'], |
|
| 345 | - 'uid' => (string) $valarm->parent->UID, |
|
| 346 | - 'is_recurring' => $isRecurring, |
|
| 347 | - 'recurrence_id' => $recurrenceId, |
|
| 348 | - 'is_recurrence_exception' => $isRecurrenceException, |
|
| 349 | - 'event_hash' => $eventHash, |
|
| 350 | - 'alarm_hash' => $alarmHash, |
|
| 351 | - 'type' => (string) $valarm->ACTION, |
|
| 352 | - 'is_relative' => $isRelative, |
|
| 353 | - 'notification_date' => $notificationDate->getTimestamp(), |
|
| 354 | - 'is_repeat_based' => false, |
|
| 355 | - ]; |
|
| 356 | - |
|
| 357 | - $repeat = isset($valarm->REPEAT) ? (int) $valarm->REPEAT->getValue() : 0; |
|
| 358 | - for ($i = 0; $i < $repeat; $i++) { |
|
| 359 | - if ($valarm->DURATION === null) { |
|
| 360 | - continue; |
|
| 361 | - } |
|
| 362 | - |
|
| 363 | - $clonedNotificationDate->add($valarm->DURATION->getDateInterval()); |
|
| 364 | - $alarms[] = [ |
|
| 365 | - 'calendar_id' => $objectData['calendarid'], |
|
| 366 | - 'object_id' => $objectData['id'], |
|
| 367 | - 'uid' => (string) $valarm->parent->UID, |
|
| 368 | - 'is_recurring' => $isRecurring, |
|
| 369 | - 'recurrence_id' => $recurrenceId, |
|
| 370 | - 'is_recurrence_exception' => $isRecurrenceException, |
|
| 371 | - 'event_hash' => $eventHash, |
|
| 372 | - 'alarm_hash' => $alarmHash, |
|
| 373 | - 'type' => (string) $valarm->ACTION, |
|
| 374 | - 'is_relative' => $isRelative, |
|
| 375 | - 'notification_date' => $clonedNotificationDate->getTimestamp(), |
|
| 376 | - 'is_repeat_based' => true, |
|
| 377 | - ]; |
|
| 378 | - } |
|
| 379 | - |
|
| 380 | - return $alarms; |
|
| 381 | - } |
|
| 382 | - |
|
| 383 | - /** |
|
| 384 | - * @param array $reminders |
|
| 385 | - */ |
|
| 386 | - private function writeRemindersToDatabase(array $reminders): void { |
|
| 387 | - foreach ($reminders as $reminder) { |
|
| 388 | - $this->backend->insertReminder( |
|
| 389 | - (int) $reminder['calendar_id'], |
|
| 390 | - (int) $reminder['object_id'], |
|
| 391 | - $reminder['uid'], |
|
| 392 | - $reminder['is_recurring'], |
|
| 393 | - (int) $reminder['recurrence_id'], |
|
| 394 | - $reminder['is_recurrence_exception'], |
|
| 395 | - $reminder['event_hash'], |
|
| 396 | - $reminder['alarm_hash'], |
|
| 397 | - $reminder['type'], |
|
| 398 | - $reminder['is_relative'], |
|
| 399 | - (int) $reminder['notification_date'], |
|
| 400 | - $reminder['is_repeat_based'] |
|
| 401 | - ); |
|
| 402 | - } |
|
| 403 | - } |
|
| 404 | - |
|
| 405 | - /** |
|
| 406 | - * @param array $reminder |
|
| 407 | - * @param VEvent $vevent |
|
| 408 | - */ |
|
| 409 | - private function deleteOrProcessNext(array $reminder, |
|
| 410 | - VObject\Component\VEvent $vevent):void { |
|
| 411 | - if ($reminder['is_repeat_based'] || |
|
| 412 | - !$reminder['is_recurring'] || |
|
| 413 | - !$reminder['is_relative'] || |
|
| 414 | - $reminder['is_recurrence_exception']) { |
|
| 415 | - $this->backend->removeReminder($reminder['id']); |
|
| 416 | - return; |
|
| 417 | - } |
|
| 418 | - |
|
| 419 | - $vevents = $this->getAllVEventsFromVCalendar($vevent->parent); |
|
| 420 | - $recurrenceExceptions = $this->getRecurrenceExceptionFromListOfVEvents($vevents); |
|
| 421 | - $now = $this->timeFactory->getDateTime(); |
|
| 422 | - |
|
| 423 | - try { |
|
| 424 | - $iterator = new EventIterator($vevents, $reminder['uid']); |
|
| 425 | - } catch (NoInstancesException $e) { |
|
| 426 | - // This event is recurring, but it doesn't have a single |
|
| 427 | - // instance. We are skipping this event from the output |
|
| 428 | - // entirely. |
|
| 429 | - return; |
|
| 430 | - } |
|
| 431 | - |
|
| 432 | - while ($iterator->valid()) { |
|
| 433 | - $event = $iterator->getEventObject(); |
|
| 434 | - |
|
| 435 | - // Recurrence-exceptions are handled separately, so just ignore them here |
|
| 436 | - if (\in_array($event, $recurrenceExceptions, true)) { |
|
| 437 | - $iterator->next(); |
|
| 438 | - continue; |
|
| 439 | - } |
|
| 440 | - |
|
| 441 | - $recurrenceId = $this->getEffectiveRecurrenceIdOfVEvent($event); |
|
| 442 | - if ($reminder['recurrence_id'] >= $recurrenceId) { |
|
| 443 | - $iterator->next(); |
|
| 444 | - continue; |
|
| 445 | - } |
|
| 446 | - |
|
| 447 | - foreach ($event->VALARM as $valarm) { |
|
| 448 | - /** @var VAlarm $valarm */ |
|
| 449 | - $alarmHash = $this->getAlarmHash($valarm); |
|
| 450 | - if ($alarmHash !== $reminder['alarm_hash']) { |
|
| 451 | - continue; |
|
| 452 | - } |
|
| 453 | - |
|
| 454 | - $triggerTime = $valarm->getEffectiveTriggerTime(); |
|
| 455 | - |
|
| 456 | - // If effective trigger time is in the past |
|
| 457 | - // just skip and generate for next event |
|
| 458 | - $diff = $now->diff($triggerTime); |
|
| 459 | - if ($diff->invert === 1) { |
|
| 460 | - continue; |
|
| 461 | - } |
|
| 462 | - |
|
| 463 | - $this->backend->removeReminder($reminder['id']); |
|
| 464 | - $alarms = $this->getRemindersForVAlarm($valarm, [ |
|
| 465 | - 'calendarid' => $reminder['calendar_id'], |
|
| 466 | - 'id' => $reminder['object_id'], |
|
| 467 | - ], $reminder['event_hash'], $alarmHash, true, false); |
|
| 468 | - $this->writeRemindersToDatabase($alarms); |
|
| 469 | - |
|
| 470 | - // Abort generating reminders after creating one successfully |
|
| 471 | - return; |
|
| 472 | - } |
|
| 473 | - |
|
| 474 | - $iterator->next(); |
|
| 475 | - } |
|
| 476 | - |
|
| 477 | - $this->backend->removeReminder($reminder['id']); |
|
| 478 | - } |
|
| 479 | - |
|
| 480 | - /** |
|
| 481 | - * @param int $calendarId |
|
| 482 | - * @return IUser[] |
|
| 483 | - */ |
|
| 484 | - private function getAllUsersWithWriteAccessToCalendar(int $calendarId):array { |
|
| 485 | - $shares = $this->caldavBackend->getShares($calendarId); |
|
| 486 | - |
|
| 487 | - $users = []; |
|
| 488 | - $userIds = []; |
|
| 489 | - $groups = []; |
|
| 490 | - foreach ($shares as $share) { |
|
| 491 | - // Only consider writable shares |
|
| 492 | - if ($share['readOnly']) { |
|
| 493 | - continue; |
|
| 494 | - } |
|
| 495 | - |
|
| 496 | - $principal = explode('/', $share['{http://owncloud.org/ns}principal']); |
|
| 497 | - if ($principal[1] === 'users') { |
|
| 498 | - $user = $this->userManager->get($principal[2]); |
|
| 499 | - if ($user) { |
|
| 500 | - $users[] = $user; |
|
| 501 | - $userIds[] = $principal[2]; |
|
| 502 | - } |
|
| 503 | - } elseif ($principal[1] === 'groups') { |
|
| 504 | - $groups[] = $principal[2]; |
|
| 505 | - } |
|
| 506 | - } |
|
| 507 | - |
|
| 508 | - foreach ($groups as $gid) { |
|
| 509 | - $group = $this->groupManager->get($gid); |
|
| 510 | - if ($group instanceof IGroup) { |
|
| 511 | - foreach ($group->getUsers() as $user) { |
|
| 512 | - if (!\in_array($user->getUID(), $userIds, true)) { |
|
| 513 | - $users[] = $user; |
|
| 514 | - $userIds[] = $user->getUID(); |
|
| 515 | - } |
|
| 516 | - } |
|
| 517 | - } |
|
| 518 | - } |
|
| 519 | - |
|
| 520 | - return $users; |
|
| 521 | - } |
|
| 522 | - |
|
| 523 | - /** |
|
| 524 | - * Gets a hash of the event. |
|
| 525 | - * If the hash changes, we have to update all relative alarms. |
|
| 526 | - * |
|
| 527 | - * @param VEvent $vevent |
|
| 528 | - * @return string |
|
| 529 | - */ |
|
| 530 | - private function getEventHash(VEvent $vevent):string { |
|
| 531 | - $properties = [ |
|
| 532 | - (string) $vevent->DTSTART->serialize(), |
|
| 533 | - ]; |
|
| 534 | - |
|
| 535 | - if ($vevent->DTEND) { |
|
| 536 | - $properties[] = (string) $vevent->DTEND->serialize(); |
|
| 537 | - } |
|
| 538 | - if ($vevent->DURATION) { |
|
| 539 | - $properties[] = (string) $vevent->DURATION->serialize(); |
|
| 540 | - } |
|
| 541 | - if ($vevent->{'RECURRENCE-ID'}) { |
|
| 542 | - $properties[] = (string) $vevent->{'RECURRENCE-ID'}->serialize(); |
|
| 543 | - } |
|
| 544 | - if ($vevent->RRULE) { |
|
| 545 | - $properties[] = (string) $vevent->RRULE->serialize(); |
|
| 546 | - } |
|
| 547 | - if ($vevent->EXDATE) { |
|
| 548 | - $properties[] = (string) $vevent->EXDATE->serialize(); |
|
| 549 | - } |
|
| 550 | - if ($vevent->RDATE) { |
|
| 551 | - $properties[] = (string) $vevent->RDATE->serialize(); |
|
| 552 | - } |
|
| 553 | - |
|
| 554 | - return md5(implode('::', $properties)); |
|
| 555 | - } |
|
| 556 | - |
|
| 557 | - /** |
|
| 558 | - * Gets a hash of the alarm. |
|
| 559 | - * If the hash changes, we have to update oc_dav_reminders. |
|
| 560 | - * |
|
| 561 | - * @param VAlarm $valarm |
|
| 562 | - * @return string |
|
| 563 | - */ |
|
| 564 | - private function getAlarmHash(VAlarm $valarm):string { |
|
| 565 | - $properties = [ |
|
| 566 | - (string) $valarm->ACTION->serialize(), |
|
| 567 | - (string) $valarm->TRIGGER->serialize(), |
|
| 568 | - ]; |
|
| 569 | - |
|
| 570 | - if ($valarm->DURATION) { |
|
| 571 | - $properties[] = (string) $valarm->DURATION->serialize(); |
|
| 572 | - } |
|
| 573 | - if ($valarm->REPEAT) { |
|
| 574 | - $properties[] = (string) $valarm->REPEAT->serialize(); |
|
| 575 | - } |
|
| 576 | - |
|
| 577 | - return md5(implode('::', $properties)); |
|
| 578 | - } |
|
| 579 | - |
|
| 580 | - /** |
|
| 581 | - * @param VObject\Component\VCalendar $vcalendar |
|
| 582 | - * @param int $recurrenceId |
|
| 583 | - * @param bool $isRecurrenceException |
|
| 584 | - * @return VEvent|null |
|
| 585 | - */ |
|
| 586 | - private function getVEventByRecurrenceId(VObject\Component\VCalendar $vcalendar, |
|
| 587 | - int $recurrenceId, |
|
| 588 | - bool $isRecurrenceException):?VEvent { |
|
| 589 | - $vevents = $this->getAllVEventsFromVCalendar($vcalendar); |
|
| 590 | - if (count($vevents) === 0) { |
|
| 591 | - return null; |
|
| 592 | - } |
|
| 593 | - |
|
| 594 | - $uid = (string) $vevents[0]->UID; |
|
| 595 | - $recurrenceExceptions = $this->getRecurrenceExceptionFromListOfVEvents($vevents); |
|
| 596 | - $masterItem = $this->getMasterItemFromListOfVEvents($vevents); |
|
| 597 | - |
|
| 598 | - // Handle recurrence-exceptions first, because recurrence-expansion is expensive |
|
| 599 | - if ($isRecurrenceException) { |
|
| 600 | - foreach ($recurrenceExceptions as $recurrenceException) { |
|
| 601 | - if ($this->getEffectiveRecurrenceIdOfVEvent($recurrenceException) === $recurrenceId) { |
|
| 602 | - return $recurrenceException; |
|
| 603 | - } |
|
| 604 | - } |
|
| 605 | - |
|
| 606 | - return null; |
|
| 607 | - } |
|
| 608 | - |
|
| 609 | - if ($masterItem) { |
|
| 610 | - try { |
|
| 611 | - $iterator = new EventIterator($vevents, $uid); |
|
| 612 | - } catch (NoInstancesException $e) { |
|
| 613 | - // This event is recurring, but it doesn't have a single |
|
| 614 | - // instance. We are skipping this event from the output |
|
| 615 | - // entirely. |
|
| 616 | - return null; |
|
| 617 | - } |
|
| 618 | - |
|
| 619 | - while ($iterator->valid()) { |
|
| 620 | - $event = $iterator->getEventObject(); |
|
| 621 | - |
|
| 622 | - // Recurrence-exceptions are handled separately, so just ignore them here |
|
| 623 | - if (\in_array($event, $recurrenceExceptions, true)) { |
|
| 624 | - $iterator->next(); |
|
| 625 | - continue; |
|
| 626 | - } |
|
| 627 | - |
|
| 628 | - if ($this->getEffectiveRecurrenceIdOfVEvent($event) === $recurrenceId) { |
|
| 629 | - return $event; |
|
| 630 | - } |
|
| 631 | - |
|
| 632 | - $iterator->next(); |
|
| 633 | - } |
|
| 634 | - } |
|
| 635 | - |
|
| 636 | - return null; |
|
| 637 | - } |
|
| 638 | - |
|
| 639 | - /** |
|
| 640 | - * @param VEvent $vevent |
|
| 641 | - * @return string |
|
| 642 | - */ |
|
| 643 | - private function getStatusOfEvent(VEvent $vevent):string { |
|
| 644 | - if ($vevent->STATUS) { |
|
| 645 | - return (string) $vevent->STATUS; |
|
| 646 | - } |
|
| 647 | - |
|
| 648 | - // Doesn't say so in the standard, |
|
| 649 | - // but we consider events without a status |
|
| 650 | - // to be confirmed |
|
| 651 | - return 'CONFIRMED'; |
|
| 652 | - } |
|
| 653 | - |
|
| 654 | - /** |
|
| 655 | - * @param VObject\Component\VEvent $vevent |
|
| 656 | - * @return bool |
|
| 657 | - */ |
|
| 658 | - private function wasEventCancelled(VObject\Component\VEvent $vevent):bool { |
|
| 659 | - return $this->getStatusOfEvent($vevent) === 'CANCELLED'; |
|
| 660 | - } |
|
| 661 | - |
|
| 662 | - /** |
|
| 663 | - * @param string $calendarData |
|
| 664 | - * @return VObject\Component\VCalendar|null |
|
| 665 | - */ |
|
| 666 | - private function parseCalendarData(string $calendarData):?VObject\Component\VCalendar { |
|
| 667 | - try { |
|
| 668 | - return VObject\Reader::read($calendarData, |
|
| 669 | - VObject\Reader::OPTION_FORGIVING); |
|
| 670 | - } catch (ParseException $ex) { |
|
| 671 | - return null; |
|
| 672 | - } |
|
| 673 | - } |
|
| 674 | - |
|
| 675 | - /** |
|
| 676 | - * @param string $principalUri |
|
| 677 | - * @return IUser|null |
|
| 678 | - */ |
|
| 679 | - private function getUserFromPrincipalURI(string $principalUri):?IUser { |
|
| 680 | - if (!$principalUri) { |
|
| 681 | - return null; |
|
| 682 | - } |
|
| 683 | - |
|
| 684 | - if (stripos($principalUri, 'principals/users/') !== 0) { |
|
| 685 | - return null; |
|
| 686 | - } |
|
| 687 | - |
|
| 688 | - $userId = substr($principalUri, 17); |
|
| 689 | - return $this->userManager->get($userId); |
|
| 690 | - } |
|
| 691 | - |
|
| 692 | - /** |
|
| 693 | - * @param VObject\Component\VCalendar $vcalendar |
|
| 694 | - * @return VObject\Component\VEvent[] |
|
| 695 | - */ |
|
| 696 | - private function getAllVEventsFromVCalendar(VObject\Component\VCalendar $vcalendar):array { |
|
| 697 | - $vevents = []; |
|
| 698 | - |
|
| 699 | - foreach ($vcalendar->children() as $child) { |
|
| 700 | - if (!($child instanceof VObject\Component)) { |
|
| 701 | - continue; |
|
| 702 | - } |
|
| 703 | - |
|
| 704 | - if ($child->name !== 'VEVENT') { |
|
| 705 | - continue; |
|
| 706 | - } |
|
| 707 | - |
|
| 708 | - $vevents[] = $child; |
|
| 709 | - } |
|
| 710 | - |
|
| 711 | - return $vevents; |
|
| 712 | - } |
|
| 713 | - |
|
| 714 | - /** |
|
| 715 | - * @param array $vevents |
|
| 716 | - * @return VObject\Component\VEvent[] |
|
| 717 | - */ |
|
| 718 | - private function getRecurrenceExceptionFromListOfVEvents(array $vevents):array { |
|
| 719 | - return array_values(array_filter($vevents, function (VEvent $vevent) { |
|
| 720 | - return $vevent->{'RECURRENCE-ID'} !== null; |
|
| 721 | - })); |
|
| 722 | - } |
|
| 723 | - |
|
| 724 | - /** |
|
| 725 | - * @param array $vevents |
|
| 726 | - * @return VEvent|null |
|
| 727 | - */ |
|
| 728 | - private function getMasterItemFromListOfVEvents(array $vevents):?VEvent { |
|
| 729 | - $elements = array_values(array_filter($vevents, function (VEvent $vevent) { |
|
| 730 | - return $vevent->{'RECURRENCE-ID'} === null; |
|
| 731 | - })); |
|
| 732 | - |
|
| 733 | - if (count($elements) === 0) { |
|
| 734 | - return null; |
|
| 735 | - } |
|
| 736 | - if (count($elements) > 1) { |
|
| 737 | - throw new \TypeError('Multiple master objects'); |
|
| 738 | - } |
|
| 739 | - |
|
| 740 | - return $elements[0]; |
|
| 741 | - } |
|
| 742 | - |
|
| 743 | - /** |
|
| 744 | - * @param VAlarm $valarm |
|
| 745 | - * @return bool |
|
| 746 | - */ |
|
| 747 | - private function isAlarmRelative(VAlarm $valarm):bool { |
|
| 748 | - $trigger = $valarm->TRIGGER; |
|
| 749 | - return $trigger instanceof VObject\Property\ICalendar\Duration; |
|
| 750 | - } |
|
| 751 | - |
|
| 752 | - /** |
|
| 753 | - * @param VEvent $vevent |
|
| 754 | - * @return int |
|
| 755 | - */ |
|
| 756 | - private function getEffectiveRecurrenceIdOfVEvent(VEvent $vevent):int { |
|
| 757 | - if (isset($vevent->{'RECURRENCE-ID'})) { |
|
| 758 | - return $vevent->{'RECURRENCE-ID'}->getDateTime()->getTimestamp(); |
|
| 759 | - } |
|
| 760 | - |
|
| 761 | - return $vevent->DTSTART->getDateTime()->getTimestamp(); |
|
| 762 | - } |
|
| 763 | - |
|
| 764 | - /** |
|
| 765 | - * @param VEvent $vevent |
|
| 766 | - * @return bool |
|
| 767 | - */ |
|
| 768 | - private function isRecurring(VEvent $vevent):bool { |
|
| 769 | - return isset($vevent->RRULE) || isset($vevent->RDATE); |
|
| 770 | - } |
|
| 51 | + /** @var Backend */ |
|
| 52 | + private $backend; |
|
| 53 | + |
|
| 54 | + /** @var NotificationProviderManager */ |
|
| 55 | + private $notificationProviderManager; |
|
| 56 | + |
|
| 57 | + /** @var IUserManager */ |
|
| 58 | + private $userManager; |
|
| 59 | + |
|
| 60 | + /** @var IGroupManager */ |
|
| 61 | + private $groupManager; |
|
| 62 | + |
|
| 63 | + /** @var CalDavBackend */ |
|
| 64 | + private $caldavBackend; |
|
| 65 | + |
|
| 66 | + /** @var ITimeFactory */ |
|
| 67 | + private $timeFactory; |
|
| 68 | + |
|
| 69 | + public const REMINDER_TYPE_EMAIL = 'EMAIL'; |
|
| 70 | + public const REMINDER_TYPE_DISPLAY = 'DISPLAY'; |
|
| 71 | + public const REMINDER_TYPE_AUDIO = 'AUDIO'; |
|
| 72 | + |
|
| 73 | + /** |
|
| 74 | + * @var String[] |
|
| 75 | + * |
|
| 76 | + * Official RFC5545 reminder types |
|
| 77 | + */ |
|
| 78 | + public const REMINDER_TYPES = [ |
|
| 79 | + self::REMINDER_TYPE_EMAIL, |
|
| 80 | + self::REMINDER_TYPE_DISPLAY, |
|
| 81 | + self::REMINDER_TYPE_AUDIO |
|
| 82 | + ]; |
|
| 83 | + |
|
| 84 | + /** |
|
| 85 | + * ReminderService constructor. |
|
| 86 | + * |
|
| 87 | + * @param Backend $backend |
|
| 88 | + * @param NotificationProviderManager $notificationProviderManager |
|
| 89 | + * @param IUserManager $userManager |
|
| 90 | + * @param IGroupManager $groupManager |
|
| 91 | + * @param CalDavBackend $caldavBackend |
|
| 92 | + * @param ITimeFactory $timeFactory |
|
| 93 | + */ |
|
| 94 | + public function __construct(Backend $backend, |
|
| 95 | + NotificationProviderManager $notificationProviderManager, |
|
| 96 | + IUserManager $userManager, |
|
| 97 | + IGroupManager $groupManager, |
|
| 98 | + CalDavBackend $caldavBackend, |
|
| 99 | + ITimeFactory $timeFactory) { |
|
| 100 | + $this->backend = $backend; |
|
| 101 | + $this->notificationProviderManager = $notificationProviderManager; |
|
| 102 | + $this->userManager = $userManager; |
|
| 103 | + $this->groupManager = $groupManager; |
|
| 104 | + $this->caldavBackend = $caldavBackend; |
|
| 105 | + $this->timeFactory = $timeFactory; |
|
| 106 | + } |
|
| 107 | + |
|
| 108 | + /** |
|
| 109 | + * Process reminders to activate |
|
| 110 | + * |
|
| 111 | + * @throws NotificationProvider\ProviderNotAvailableException |
|
| 112 | + * @throws NotificationTypeDoesNotExistException |
|
| 113 | + */ |
|
| 114 | + public function processReminders():void { |
|
| 115 | + $reminders = $this->backend->getRemindersToProcess(); |
|
| 116 | + |
|
| 117 | + foreach ($reminders as $reminder) { |
|
| 118 | + $calendarData = is_resource($reminder['calendardata']) |
|
| 119 | + ? stream_get_contents($reminder['calendardata']) |
|
| 120 | + : $reminder['calendardata']; |
|
| 121 | + |
|
| 122 | + $vcalendar = $this->parseCalendarData($calendarData); |
|
| 123 | + if (!$vcalendar) { |
|
| 124 | + $this->backend->removeReminder($reminder['id']); |
|
| 125 | + continue; |
|
| 126 | + } |
|
| 127 | + |
|
| 128 | + $vevent = $this->getVEventByRecurrenceId($vcalendar, $reminder['recurrence_id'], $reminder['is_recurrence_exception']); |
|
| 129 | + if (!$vevent) { |
|
| 130 | + $this->backend->removeReminder($reminder['id']); |
|
| 131 | + continue; |
|
| 132 | + } |
|
| 133 | + |
|
| 134 | + if ($this->wasEventCancelled($vevent)) { |
|
| 135 | + $this->deleteOrProcessNext($reminder, $vevent); |
|
| 136 | + continue; |
|
| 137 | + } |
|
| 138 | + |
|
| 139 | + if (!$this->notificationProviderManager->hasProvider($reminder['type'])) { |
|
| 140 | + $this->deleteOrProcessNext($reminder, $vevent); |
|
| 141 | + continue; |
|
| 142 | + } |
|
| 143 | + |
|
| 144 | + $users = $this->getAllUsersWithWriteAccessToCalendar($reminder['calendar_id']); |
|
| 145 | + $user = $this->getUserFromPrincipalURI($reminder['principaluri']); |
|
| 146 | + if ($user) { |
|
| 147 | + $users[] = $user; |
|
| 148 | + } |
|
| 149 | + |
|
| 150 | + $notificationProvider = $this->notificationProviderManager->getProvider($reminder['type']); |
|
| 151 | + $notificationProvider->send($vevent, $reminder['displayname'], $users); |
|
| 152 | + |
|
| 153 | + $this->deleteOrProcessNext($reminder, $vevent); |
|
| 154 | + } |
|
| 155 | + } |
|
| 156 | + |
|
| 157 | + /** |
|
| 158 | + * @param array $objectData |
|
| 159 | + * @throws VObject\InvalidDataException |
|
| 160 | + */ |
|
| 161 | + public function onCalendarObjectCreate(array $objectData):void { |
|
| 162 | + // We only support VEvents for now |
|
| 163 | + if (strcasecmp($objectData['component'], 'vevent') !== 0) { |
|
| 164 | + return; |
|
| 165 | + } |
|
| 166 | + |
|
| 167 | + $calendarData = is_resource($objectData['calendardata']) |
|
| 168 | + ? stream_get_contents($objectData['calendardata']) |
|
| 169 | + : $objectData['calendardata']; |
|
| 170 | + |
|
| 171 | + /** @var VObject\Component\VCalendar $vcalendar */ |
|
| 172 | + $vcalendar = $this->parseCalendarData($calendarData); |
|
| 173 | + if (!$vcalendar) { |
|
| 174 | + return; |
|
| 175 | + } |
|
| 176 | + |
|
| 177 | + $vevents = $this->getAllVEventsFromVCalendar($vcalendar); |
|
| 178 | + if (count($vevents) === 0) { |
|
| 179 | + return; |
|
| 180 | + } |
|
| 181 | + |
|
| 182 | + $uid = (string) $vevents[0]->UID; |
|
| 183 | + $recurrenceExceptions = $this->getRecurrenceExceptionFromListOfVEvents($vevents); |
|
| 184 | + $masterItem = $this->getMasterItemFromListOfVEvents($vevents); |
|
| 185 | + $now = $this->timeFactory->getDateTime(); |
|
| 186 | + $isRecurring = $masterItem ? $this->isRecurring($masterItem) : false; |
|
| 187 | + |
|
| 188 | + foreach ($recurrenceExceptions as $recurrenceException) { |
|
| 189 | + $eventHash = $this->getEventHash($recurrenceException); |
|
| 190 | + |
|
| 191 | + if (!isset($recurrenceException->VALARM)) { |
|
| 192 | + continue; |
|
| 193 | + } |
|
| 194 | + |
|
| 195 | + foreach ($recurrenceException->VALARM as $valarm) { |
|
| 196 | + /** @var VAlarm $valarm */ |
|
| 197 | + $alarmHash = $this->getAlarmHash($valarm); |
|
| 198 | + $triggerTime = $valarm->getEffectiveTriggerTime(); |
|
| 199 | + $diff = $now->diff($triggerTime); |
|
| 200 | + if ($diff->invert === 1) { |
|
| 201 | + continue; |
|
| 202 | + } |
|
| 203 | + |
|
| 204 | + $alarms = $this->getRemindersForVAlarm($valarm, $objectData, |
|
| 205 | + $eventHash, $alarmHash, true, true); |
|
| 206 | + $this->writeRemindersToDatabase($alarms); |
|
| 207 | + } |
|
| 208 | + } |
|
| 209 | + |
|
| 210 | + if ($masterItem) { |
|
| 211 | + $processedAlarms = []; |
|
| 212 | + $masterAlarms = []; |
|
| 213 | + $masterHash = $this->getEventHash($masterItem); |
|
| 214 | + |
|
| 215 | + if (!isset($masterItem->VALARM)) { |
|
| 216 | + return; |
|
| 217 | + } |
|
| 218 | + |
|
| 219 | + foreach ($masterItem->VALARM as $valarm) { |
|
| 220 | + $masterAlarms[] = $this->getAlarmHash($valarm); |
|
| 221 | + } |
|
| 222 | + |
|
| 223 | + try { |
|
| 224 | + $iterator = new EventIterator($vevents, $uid); |
|
| 225 | + } catch (NoInstancesException $e) { |
|
| 226 | + // This event is recurring, but it doesn't have a single |
|
| 227 | + // instance. We are skipping this event from the output |
|
| 228 | + // entirely. |
|
| 229 | + return; |
|
| 230 | + } |
|
| 231 | + |
|
| 232 | + while ($iterator->valid() && count($processedAlarms) < count($masterAlarms)) { |
|
| 233 | + $event = $iterator->getEventObject(); |
|
| 234 | + |
|
| 235 | + // Recurrence-exceptions are handled separately, so just ignore them here |
|
| 236 | + if (\in_array($event, $recurrenceExceptions, true)) { |
|
| 237 | + $iterator->next(); |
|
| 238 | + continue; |
|
| 239 | + } |
|
| 240 | + |
|
| 241 | + foreach ($event->VALARM as $valarm) { |
|
| 242 | + /** @var VAlarm $valarm */ |
|
| 243 | + $alarmHash = $this->getAlarmHash($valarm); |
|
| 244 | + if (\in_array($alarmHash, $processedAlarms, true)) { |
|
| 245 | + continue; |
|
| 246 | + } |
|
| 247 | + |
|
| 248 | + if (!\in_array((string) $valarm->ACTION, self::REMINDER_TYPES, true)) { |
|
| 249 | + // Action allows x-name, we don't insert reminders |
|
| 250 | + // into the database if they are not standard |
|
| 251 | + $processedAlarms[] = $alarmHash; |
|
| 252 | + continue; |
|
| 253 | + } |
|
| 254 | + |
|
| 255 | + try { |
|
| 256 | + $triggerTime = $valarm->getEffectiveTriggerTime(); |
|
| 257 | + } catch (InvalidDataException $e) { |
|
| 258 | + continue; |
|
| 259 | + } |
|
| 260 | + |
|
| 261 | + // If effective trigger time is in the past |
|
| 262 | + // just skip and generate for next event |
|
| 263 | + $diff = $now->diff($triggerTime); |
|
| 264 | + if ($diff->invert === 1) { |
|
| 265 | + // If an absolute alarm is in the past, |
|
| 266 | + // just add it to processedAlarms, so |
|
| 267 | + // we don't extend till eternity |
|
| 268 | + if (!$this->isAlarmRelative($valarm)) { |
|
| 269 | + $processedAlarms[] = $alarmHash; |
|
| 270 | + } |
|
| 271 | + |
|
| 272 | + continue; |
|
| 273 | + } |
|
| 274 | + |
|
| 275 | + $alarms = $this->getRemindersForVAlarm($valarm, $objectData, $masterHash, $alarmHash, $isRecurring, false); |
|
| 276 | + $this->writeRemindersToDatabase($alarms); |
|
| 277 | + $processedAlarms[] = $alarmHash; |
|
| 278 | + } |
|
| 279 | + |
|
| 280 | + $iterator->next(); |
|
| 281 | + } |
|
| 282 | + } |
|
| 283 | + } |
|
| 284 | + |
|
| 285 | + /** |
|
| 286 | + * @param array $objectData |
|
| 287 | + * @throws VObject\InvalidDataException |
|
| 288 | + */ |
|
| 289 | + public function onCalendarObjectEdit(array $objectData):void { |
|
| 290 | + // TODO - this can be vastly improved |
|
| 291 | + // - get cached reminders |
|
| 292 | + // - ... |
|
| 293 | + |
|
| 294 | + $this->onCalendarObjectDelete($objectData); |
|
| 295 | + $this->onCalendarObjectCreate($objectData); |
|
| 296 | + } |
|
| 297 | + |
|
| 298 | + /** |
|
| 299 | + * @param array $objectData |
|
| 300 | + * @throws VObject\InvalidDataException |
|
| 301 | + */ |
|
| 302 | + public function onCalendarObjectDelete(array $objectData):void { |
|
| 303 | + // We only support VEvents for now |
|
| 304 | + if (strcasecmp($objectData['component'], 'vevent') !== 0) { |
|
| 305 | + return; |
|
| 306 | + } |
|
| 307 | + |
|
| 308 | + $this->backend->cleanRemindersForEvent((int) $objectData['id']); |
|
| 309 | + } |
|
| 310 | + |
|
| 311 | + /** |
|
| 312 | + * @param VAlarm $valarm |
|
| 313 | + * @param array $objectData |
|
| 314 | + * @param string|null $eventHash |
|
| 315 | + * @param string|null $alarmHash |
|
| 316 | + * @param bool $isRecurring |
|
| 317 | + * @param bool $isRecurrenceException |
|
| 318 | + * @return array |
|
| 319 | + */ |
|
| 320 | + private function getRemindersForVAlarm(VAlarm $valarm, |
|
| 321 | + array $objectData, |
|
| 322 | + string $eventHash = null, |
|
| 323 | + string $alarmHash = null, |
|
| 324 | + bool $isRecurring = false, |
|
| 325 | + bool $isRecurrenceException = false):array { |
|
| 326 | + if ($eventHash === null) { |
|
| 327 | + $eventHash = $this->getEventHash($valarm->parent); |
|
| 328 | + } |
|
| 329 | + if ($alarmHash === null) { |
|
| 330 | + $alarmHash = $this->getAlarmHash($valarm); |
|
| 331 | + } |
|
| 332 | + |
|
| 333 | + $recurrenceId = $this->getEffectiveRecurrenceIdOfVEvent($valarm->parent); |
|
| 334 | + $isRelative = $this->isAlarmRelative($valarm); |
|
| 335 | + /** @var DateTimeImmutable $notificationDate */ |
|
| 336 | + $notificationDate = $valarm->getEffectiveTriggerTime(); |
|
| 337 | + $clonedNotificationDate = new \DateTime('now', $notificationDate->getTimezone()); |
|
| 338 | + $clonedNotificationDate->setTimestamp($notificationDate->getTimestamp()); |
|
| 339 | + |
|
| 340 | + $alarms = []; |
|
| 341 | + |
|
| 342 | + $alarms[] = [ |
|
| 343 | + 'calendar_id' => $objectData['calendarid'], |
|
| 344 | + 'object_id' => $objectData['id'], |
|
| 345 | + 'uid' => (string) $valarm->parent->UID, |
|
| 346 | + 'is_recurring' => $isRecurring, |
|
| 347 | + 'recurrence_id' => $recurrenceId, |
|
| 348 | + 'is_recurrence_exception' => $isRecurrenceException, |
|
| 349 | + 'event_hash' => $eventHash, |
|
| 350 | + 'alarm_hash' => $alarmHash, |
|
| 351 | + 'type' => (string) $valarm->ACTION, |
|
| 352 | + 'is_relative' => $isRelative, |
|
| 353 | + 'notification_date' => $notificationDate->getTimestamp(), |
|
| 354 | + 'is_repeat_based' => false, |
|
| 355 | + ]; |
|
| 356 | + |
|
| 357 | + $repeat = isset($valarm->REPEAT) ? (int) $valarm->REPEAT->getValue() : 0; |
|
| 358 | + for ($i = 0; $i < $repeat; $i++) { |
|
| 359 | + if ($valarm->DURATION === null) { |
|
| 360 | + continue; |
|
| 361 | + } |
|
| 362 | + |
|
| 363 | + $clonedNotificationDate->add($valarm->DURATION->getDateInterval()); |
|
| 364 | + $alarms[] = [ |
|
| 365 | + 'calendar_id' => $objectData['calendarid'], |
|
| 366 | + 'object_id' => $objectData['id'], |
|
| 367 | + 'uid' => (string) $valarm->parent->UID, |
|
| 368 | + 'is_recurring' => $isRecurring, |
|
| 369 | + 'recurrence_id' => $recurrenceId, |
|
| 370 | + 'is_recurrence_exception' => $isRecurrenceException, |
|
| 371 | + 'event_hash' => $eventHash, |
|
| 372 | + 'alarm_hash' => $alarmHash, |
|
| 373 | + 'type' => (string) $valarm->ACTION, |
|
| 374 | + 'is_relative' => $isRelative, |
|
| 375 | + 'notification_date' => $clonedNotificationDate->getTimestamp(), |
|
| 376 | + 'is_repeat_based' => true, |
|
| 377 | + ]; |
|
| 378 | + } |
|
| 379 | + |
|
| 380 | + return $alarms; |
|
| 381 | + } |
|
| 382 | + |
|
| 383 | + /** |
|
| 384 | + * @param array $reminders |
|
| 385 | + */ |
|
| 386 | + private function writeRemindersToDatabase(array $reminders): void { |
|
| 387 | + foreach ($reminders as $reminder) { |
|
| 388 | + $this->backend->insertReminder( |
|
| 389 | + (int) $reminder['calendar_id'], |
|
| 390 | + (int) $reminder['object_id'], |
|
| 391 | + $reminder['uid'], |
|
| 392 | + $reminder['is_recurring'], |
|
| 393 | + (int) $reminder['recurrence_id'], |
|
| 394 | + $reminder['is_recurrence_exception'], |
|
| 395 | + $reminder['event_hash'], |
|
| 396 | + $reminder['alarm_hash'], |
|
| 397 | + $reminder['type'], |
|
| 398 | + $reminder['is_relative'], |
|
| 399 | + (int) $reminder['notification_date'], |
|
| 400 | + $reminder['is_repeat_based'] |
|
| 401 | + ); |
|
| 402 | + } |
|
| 403 | + } |
|
| 404 | + |
|
| 405 | + /** |
|
| 406 | + * @param array $reminder |
|
| 407 | + * @param VEvent $vevent |
|
| 408 | + */ |
|
| 409 | + private function deleteOrProcessNext(array $reminder, |
|
| 410 | + VObject\Component\VEvent $vevent):void { |
|
| 411 | + if ($reminder['is_repeat_based'] || |
|
| 412 | + !$reminder['is_recurring'] || |
|
| 413 | + !$reminder['is_relative'] || |
|
| 414 | + $reminder['is_recurrence_exception']) { |
|
| 415 | + $this->backend->removeReminder($reminder['id']); |
|
| 416 | + return; |
|
| 417 | + } |
|
| 418 | + |
|
| 419 | + $vevents = $this->getAllVEventsFromVCalendar($vevent->parent); |
|
| 420 | + $recurrenceExceptions = $this->getRecurrenceExceptionFromListOfVEvents($vevents); |
|
| 421 | + $now = $this->timeFactory->getDateTime(); |
|
| 422 | + |
|
| 423 | + try { |
|
| 424 | + $iterator = new EventIterator($vevents, $reminder['uid']); |
|
| 425 | + } catch (NoInstancesException $e) { |
|
| 426 | + // This event is recurring, but it doesn't have a single |
|
| 427 | + // instance. We are skipping this event from the output |
|
| 428 | + // entirely. |
|
| 429 | + return; |
|
| 430 | + } |
|
| 431 | + |
|
| 432 | + while ($iterator->valid()) { |
|
| 433 | + $event = $iterator->getEventObject(); |
|
| 434 | + |
|
| 435 | + // Recurrence-exceptions are handled separately, so just ignore them here |
|
| 436 | + if (\in_array($event, $recurrenceExceptions, true)) { |
|
| 437 | + $iterator->next(); |
|
| 438 | + continue; |
|
| 439 | + } |
|
| 440 | + |
|
| 441 | + $recurrenceId = $this->getEffectiveRecurrenceIdOfVEvent($event); |
|
| 442 | + if ($reminder['recurrence_id'] >= $recurrenceId) { |
|
| 443 | + $iterator->next(); |
|
| 444 | + continue; |
|
| 445 | + } |
|
| 446 | + |
|
| 447 | + foreach ($event->VALARM as $valarm) { |
|
| 448 | + /** @var VAlarm $valarm */ |
|
| 449 | + $alarmHash = $this->getAlarmHash($valarm); |
|
| 450 | + if ($alarmHash !== $reminder['alarm_hash']) { |
|
| 451 | + continue; |
|
| 452 | + } |
|
| 453 | + |
|
| 454 | + $triggerTime = $valarm->getEffectiveTriggerTime(); |
|
| 455 | + |
|
| 456 | + // If effective trigger time is in the past |
|
| 457 | + // just skip and generate for next event |
|
| 458 | + $diff = $now->diff($triggerTime); |
|
| 459 | + if ($diff->invert === 1) { |
|
| 460 | + continue; |
|
| 461 | + } |
|
| 462 | + |
|
| 463 | + $this->backend->removeReminder($reminder['id']); |
|
| 464 | + $alarms = $this->getRemindersForVAlarm($valarm, [ |
|
| 465 | + 'calendarid' => $reminder['calendar_id'], |
|
| 466 | + 'id' => $reminder['object_id'], |
|
| 467 | + ], $reminder['event_hash'], $alarmHash, true, false); |
|
| 468 | + $this->writeRemindersToDatabase($alarms); |
|
| 469 | + |
|
| 470 | + // Abort generating reminders after creating one successfully |
|
| 471 | + return; |
|
| 472 | + } |
|
| 473 | + |
|
| 474 | + $iterator->next(); |
|
| 475 | + } |
|
| 476 | + |
|
| 477 | + $this->backend->removeReminder($reminder['id']); |
|
| 478 | + } |
|
| 479 | + |
|
| 480 | + /** |
|
| 481 | + * @param int $calendarId |
|
| 482 | + * @return IUser[] |
|
| 483 | + */ |
|
| 484 | + private function getAllUsersWithWriteAccessToCalendar(int $calendarId):array { |
|
| 485 | + $shares = $this->caldavBackend->getShares($calendarId); |
|
| 486 | + |
|
| 487 | + $users = []; |
|
| 488 | + $userIds = []; |
|
| 489 | + $groups = []; |
|
| 490 | + foreach ($shares as $share) { |
|
| 491 | + // Only consider writable shares |
|
| 492 | + if ($share['readOnly']) { |
|
| 493 | + continue; |
|
| 494 | + } |
|
| 495 | + |
|
| 496 | + $principal = explode('/', $share['{http://owncloud.org/ns}principal']); |
|
| 497 | + if ($principal[1] === 'users') { |
|
| 498 | + $user = $this->userManager->get($principal[2]); |
|
| 499 | + if ($user) { |
|
| 500 | + $users[] = $user; |
|
| 501 | + $userIds[] = $principal[2]; |
|
| 502 | + } |
|
| 503 | + } elseif ($principal[1] === 'groups') { |
|
| 504 | + $groups[] = $principal[2]; |
|
| 505 | + } |
|
| 506 | + } |
|
| 507 | + |
|
| 508 | + foreach ($groups as $gid) { |
|
| 509 | + $group = $this->groupManager->get($gid); |
|
| 510 | + if ($group instanceof IGroup) { |
|
| 511 | + foreach ($group->getUsers() as $user) { |
|
| 512 | + if (!\in_array($user->getUID(), $userIds, true)) { |
|
| 513 | + $users[] = $user; |
|
| 514 | + $userIds[] = $user->getUID(); |
|
| 515 | + } |
|
| 516 | + } |
|
| 517 | + } |
|
| 518 | + } |
|
| 519 | + |
|
| 520 | + return $users; |
|
| 521 | + } |
|
| 522 | + |
|
| 523 | + /** |
|
| 524 | + * Gets a hash of the event. |
|
| 525 | + * If the hash changes, we have to update all relative alarms. |
|
| 526 | + * |
|
| 527 | + * @param VEvent $vevent |
|
| 528 | + * @return string |
|
| 529 | + */ |
|
| 530 | + private function getEventHash(VEvent $vevent):string { |
|
| 531 | + $properties = [ |
|
| 532 | + (string) $vevent->DTSTART->serialize(), |
|
| 533 | + ]; |
|
| 534 | + |
|
| 535 | + if ($vevent->DTEND) { |
|
| 536 | + $properties[] = (string) $vevent->DTEND->serialize(); |
|
| 537 | + } |
|
| 538 | + if ($vevent->DURATION) { |
|
| 539 | + $properties[] = (string) $vevent->DURATION->serialize(); |
|
| 540 | + } |
|
| 541 | + if ($vevent->{'RECURRENCE-ID'}) { |
|
| 542 | + $properties[] = (string) $vevent->{'RECURRENCE-ID'}->serialize(); |
|
| 543 | + } |
|
| 544 | + if ($vevent->RRULE) { |
|
| 545 | + $properties[] = (string) $vevent->RRULE->serialize(); |
|
| 546 | + } |
|
| 547 | + if ($vevent->EXDATE) { |
|
| 548 | + $properties[] = (string) $vevent->EXDATE->serialize(); |
|
| 549 | + } |
|
| 550 | + if ($vevent->RDATE) { |
|
| 551 | + $properties[] = (string) $vevent->RDATE->serialize(); |
|
| 552 | + } |
|
| 553 | + |
|
| 554 | + return md5(implode('::', $properties)); |
|
| 555 | + } |
|
| 556 | + |
|
| 557 | + /** |
|
| 558 | + * Gets a hash of the alarm. |
|
| 559 | + * If the hash changes, we have to update oc_dav_reminders. |
|
| 560 | + * |
|
| 561 | + * @param VAlarm $valarm |
|
| 562 | + * @return string |
|
| 563 | + */ |
|
| 564 | + private function getAlarmHash(VAlarm $valarm):string { |
|
| 565 | + $properties = [ |
|
| 566 | + (string) $valarm->ACTION->serialize(), |
|
| 567 | + (string) $valarm->TRIGGER->serialize(), |
|
| 568 | + ]; |
|
| 569 | + |
|
| 570 | + if ($valarm->DURATION) { |
|
| 571 | + $properties[] = (string) $valarm->DURATION->serialize(); |
|
| 572 | + } |
|
| 573 | + if ($valarm->REPEAT) { |
|
| 574 | + $properties[] = (string) $valarm->REPEAT->serialize(); |
|
| 575 | + } |
|
| 576 | + |
|
| 577 | + return md5(implode('::', $properties)); |
|
| 578 | + } |
|
| 579 | + |
|
| 580 | + /** |
|
| 581 | + * @param VObject\Component\VCalendar $vcalendar |
|
| 582 | + * @param int $recurrenceId |
|
| 583 | + * @param bool $isRecurrenceException |
|
| 584 | + * @return VEvent|null |
|
| 585 | + */ |
|
| 586 | + private function getVEventByRecurrenceId(VObject\Component\VCalendar $vcalendar, |
|
| 587 | + int $recurrenceId, |
|
| 588 | + bool $isRecurrenceException):?VEvent { |
|
| 589 | + $vevents = $this->getAllVEventsFromVCalendar($vcalendar); |
|
| 590 | + if (count($vevents) === 0) { |
|
| 591 | + return null; |
|
| 592 | + } |
|
| 593 | + |
|
| 594 | + $uid = (string) $vevents[0]->UID; |
|
| 595 | + $recurrenceExceptions = $this->getRecurrenceExceptionFromListOfVEvents($vevents); |
|
| 596 | + $masterItem = $this->getMasterItemFromListOfVEvents($vevents); |
|
| 597 | + |
|
| 598 | + // Handle recurrence-exceptions first, because recurrence-expansion is expensive |
|
| 599 | + if ($isRecurrenceException) { |
|
| 600 | + foreach ($recurrenceExceptions as $recurrenceException) { |
|
| 601 | + if ($this->getEffectiveRecurrenceIdOfVEvent($recurrenceException) === $recurrenceId) { |
|
| 602 | + return $recurrenceException; |
|
| 603 | + } |
|
| 604 | + } |
|
| 605 | + |
|
| 606 | + return null; |
|
| 607 | + } |
|
| 608 | + |
|
| 609 | + if ($masterItem) { |
|
| 610 | + try { |
|
| 611 | + $iterator = new EventIterator($vevents, $uid); |
|
| 612 | + } catch (NoInstancesException $e) { |
|
| 613 | + // This event is recurring, but it doesn't have a single |
|
| 614 | + // instance. We are skipping this event from the output |
|
| 615 | + // entirely. |
|
| 616 | + return null; |
|
| 617 | + } |
|
| 618 | + |
|
| 619 | + while ($iterator->valid()) { |
|
| 620 | + $event = $iterator->getEventObject(); |
|
| 621 | + |
|
| 622 | + // Recurrence-exceptions are handled separately, so just ignore them here |
|
| 623 | + if (\in_array($event, $recurrenceExceptions, true)) { |
|
| 624 | + $iterator->next(); |
|
| 625 | + continue; |
|
| 626 | + } |
|
| 627 | + |
|
| 628 | + if ($this->getEffectiveRecurrenceIdOfVEvent($event) === $recurrenceId) { |
|
| 629 | + return $event; |
|
| 630 | + } |
|
| 631 | + |
|
| 632 | + $iterator->next(); |
|
| 633 | + } |
|
| 634 | + } |
|
| 635 | + |
|
| 636 | + return null; |
|
| 637 | + } |
|
| 638 | + |
|
| 639 | + /** |
|
| 640 | + * @param VEvent $vevent |
|
| 641 | + * @return string |
|
| 642 | + */ |
|
| 643 | + private function getStatusOfEvent(VEvent $vevent):string { |
|
| 644 | + if ($vevent->STATUS) { |
|
| 645 | + return (string) $vevent->STATUS; |
|
| 646 | + } |
|
| 647 | + |
|
| 648 | + // Doesn't say so in the standard, |
|
| 649 | + // but we consider events without a status |
|
| 650 | + // to be confirmed |
|
| 651 | + return 'CONFIRMED'; |
|
| 652 | + } |
|
| 653 | + |
|
| 654 | + /** |
|
| 655 | + * @param VObject\Component\VEvent $vevent |
|
| 656 | + * @return bool |
|
| 657 | + */ |
|
| 658 | + private function wasEventCancelled(VObject\Component\VEvent $vevent):bool { |
|
| 659 | + return $this->getStatusOfEvent($vevent) === 'CANCELLED'; |
|
| 660 | + } |
|
| 661 | + |
|
| 662 | + /** |
|
| 663 | + * @param string $calendarData |
|
| 664 | + * @return VObject\Component\VCalendar|null |
|
| 665 | + */ |
|
| 666 | + private function parseCalendarData(string $calendarData):?VObject\Component\VCalendar { |
|
| 667 | + try { |
|
| 668 | + return VObject\Reader::read($calendarData, |
|
| 669 | + VObject\Reader::OPTION_FORGIVING); |
|
| 670 | + } catch (ParseException $ex) { |
|
| 671 | + return null; |
|
| 672 | + } |
|
| 673 | + } |
|
| 674 | + |
|
| 675 | + /** |
|
| 676 | + * @param string $principalUri |
|
| 677 | + * @return IUser|null |
|
| 678 | + */ |
|
| 679 | + private function getUserFromPrincipalURI(string $principalUri):?IUser { |
|
| 680 | + if (!$principalUri) { |
|
| 681 | + return null; |
|
| 682 | + } |
|
| 683 | + |
|
| 684 | + if (stripos($principalUri, 'principals/users/') !== 0) { |
|
| 685 | + return null; |
|
| 686 | + } |
|
| 687 | + |
|
| 688 | + $userId = substr($principalUri, 17); |
|
| 689 | + return $this->userManager->get($userId); |
|
| 690 | + } |
|
| 691 | + |
|
| 692 | + /** |
|
| 693 | + * @param VObject\Component\VCalendar $vcalendar |
|
| 694 | + * @return VObject\Component\VEvent[] |
|
| 695 | + */ |
|
| 696 | + private function getAllVEventsFromVCalendar(VObject\Component\VCalendar $vcalendar):array { |
|
| 697 | + $vevents = []; |
|
| 698 | + |
|
| 699 | + foreach ($vcalendar->children() as $child) { |
|
| 700 | + if (!($child instanceof VObject\Component)) { |
|
| 701 | + continue; |
|
| 702 | + } |
|
| 703 | + |
|
| 704 | + if ($child->name !== 'VEVENT') { |
|
| 705 | + continue; |
|
| 706 | + } |
|
| 707 | + |
|
| 708 | + $vevents[] = $child; |
|
| 709 | + } |
|
| 710 | + |
|
| 711 | + return $vevents; |
|
| 712 | + } |
|
| 713 | + |
|
| 714 | + /** |
|
| 715 | + * @param array $vevents |
|
| 716 | + * @return VObject\Component\VEvent[] |
|
| 717 | + */ |
|
| 718 | + private function getRecurrenceExceptionFromListOfVEvents(array $vevents):array { |
|
| 719 | + return array_values(array_filter($vevents, function (VEvent $vevent) { |
|
| 720 | + return $vevent->{'RECURRENCE-ID'} !== null; |
|
| 721 | + })); |
|
| 722 | + } |
|
| 723 | + |
|
| 724 | + /** |
|
| 725 | + * @param array $vevents |
|
| 726 | + * @return VEvent|null |
|
| 727 | + */ |
|
| 728 | + private function getMasterItemFromListOfVEvents(array $vevents):?VEvent { |
|
| 729 | + $elements = array_values(array_filter($vevents, function (VEvent $vevent) { |
|
| 730 | + return $vevent->{'RECURRENCE-ID'} === null; |
|
| 731 | + })); |
|
| 732 | + |
|
| 733 | + if (count($elements) === 0) { |
|
| 734 | + return null; |
|
| 735 | + } |
|
| 736 | + if (count($elements) > 1) { |
|
| 737 | + throw new \TypeError('Multiple master objects'); |
|
| 738 | + } |
|
| 739 | + |
|
| 740 | + return $elements[0]; |
|
| 741 | + } |
|
| 742 | + |
|
| 743 | + /** |
|
| 744 | + * @param VAlarm $valarm |
|
| 745 | + * @return bool |
|
| 746 | + */ |
|
| 747 | + private function isAlarmRelative(VAlarm $valarm):bool { |
|
| 748 | + $trigger = $valarm->TRIGGER; |
|
| 749 | + return $trigger instanceof VObject\Property\ICalendar\Duration; |
|
| 750 | + } |
|
| 751 | + |
|
| 752 | + /** |
|
| 753 | + * @param VEvent $vevent |
|
| 754 | + * @return int |
|
| 755 | + */ |
|
| 756 | + private function getEffectiveRecurrenceIdOfVEvent(VEvent $vevent):int { |
|
| 757 | + if (isset($vevent->{'RECURRENCE-ID'})) { |
|
| 758 | + return $vevent->{'RECURRENCE-ID'}->getDateTime()->getTimestamp(); |
|
| 759 | + } |
|
| 760 | + |
|
| 761 | + return $vevent->DTSTART->getDateTime()->getTimestamp(); |
|
| 762 | + } |
|
| 763 | + |
|
| 764 | + /** |
|
| 765 | + * @param VEvent $vevent |
|
| 766 | + * @return bool |
|
| 767 | + */ |
|
| 768 | + private function isRecurring(VEvent $vevent):bool { |
|
| 769 | + return isset($vevent->RRULE) || isset($vevent->RDATE); |
|
| 770 | + } |
|
| 771 | 771 | } |