-
Notifications
You must be signed in to change notification settings - Fork 243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: OCC and OCS Calendar Import/Export #6596
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6596 +/- ##
=========================================
Coverage 23.00% 23.00%
Complexity 475 475
=========================================
Files 252 252
Lines 12110 12110
Branches 2299 2311 +12
=========================================
Hits 2786 2786
Misses 8997 8997
Partials 327 327
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
I think it feels odd to have this in the calendar as other calendar commands are into the |
lib/Service/Export/ExportService.php
Outdated
'jcal' => '["vcalendar",[["version",{},"text","2.0"],["prodid",{},"text","-\/\/IDN nextcloud.com\/\/Calendar App\/\/EN"]],[', | ||
'xcal' => '<?xml version="1.0" encoding="UTF-8"?><icalendar xmlns="urn:ietf:params:xml:ns:icalendar-2.0"><vcalendar><properties><version><text>2.0</text></version><prodid><text>-//IDN nextcloud.com//Calendar App//EN</text></prodid></properties><components>', | ||
default => "BEGIN:VCALENDAR\nVERSION:2.0\nPRODID:-//IDN nextcloud.com//Calendar App//EN\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like hardcoding things here. Would it be possible to serialize an empty calendar to get the start string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, I don't like hard coding this either. But I could not think of a better way to do this.
Yes, I could serialize a empty object but then I would still have to do fancy string manipulations to separate the beginning form the closing. Then output the beginning, then the objects, then the closing, as the output is a generated stream directly to the http buffer.
The only way to do this without hard coding would be to generate the calendar in memory and serialize it all as one. So it was a trade of hard coding or php memory exhaustion when exporting large calendars.
I wasn't sure where we wanted to put this, as the code can export any calendar, from any calendar provider, so its not just for DAV, it can easily be moved to server code. I will ask about it once CW is back. |
c8dc1be
to
320079f
Compare
Signed-off-by: SebastianKrupinski <[email protected]>
03ef58c
to
7ab487b
Compare
All code moved to server |
Summary
This adds the ability to export calendars via the OCS and OCC.
OCC Export
Command: calendar:export
Arguments: userId calendarId format filepath
OCC Import
Command: calendar:import
Arguments: userId calendarId format filepath
Options: errors, validation, supersede, show-created, show-updated, show-skipped, show-errors
OCS Export
Endpoint: /ocs/v2.php/calendar/export
Request: GET/POST
{
"id": "personal",
"fmt": "xcal", (optional "ical, jcal, xcal", defaults to "ical")
"user": "user1" (optional admin permissions required)
}
Performance
TODO