Import calendar or feed from CLI

Tutorials on ownCloud administration
Forum rules
The forums were migrated over to https://central.owncloud.org which is based on the forum software Discourse. The forums here is put into read-only mode starting from today.

More background information about this move and the reasoning behind it is available in this blogpost:

https://daniel.molkentin.net/2016/07/20 ... d-central/
phurg
Newbie
Posts: 2
Joined: Thu May 16, 2013 3:57 pm
ownCloud version: 5.0.5
Webserver: Apache
Database: MySQL
OS: Linux
PHP version: 5.3.15

Import calendar or feed from CLI

Postby phurg » Thu May 16, 2013 5:03 pm

I've seen a few posts from people wanting to import an iCalendar file from the command-line. I put together the attached standalone PHP (CLI) script to do this, based on owncloud-5.0.5. When combined with PHP's ability to open URLs as well as files, this allows you to import an iCalendar feed. It can be run from cron to `sync' an owncloud calendar with an iCalendar feed.

I say `sync' in quotes because the script simply replaces the contents of the specified calendar with the events from the file or feed. Someone could try setting $import->setOverwrite(false) and see if the import code's duplication checker works. That might have some benefit in terms of minimizing what caldav clients need to sync later through owncloud.

It seems to me that this might be the basis for supporting iCalendar subscriptions in owncloud itself. The underlying functionality is clearly there (modulo comments above). It seems like primarily a UI issue with some database support needed to save the URL. Owncloud already has cron functionality that could be used to do the updates.

Anyway, I offer this in the spirit of open source. Thanks owncloud developers for a great package!

George
Attachments
owncloud-import-calendar.php
(2.31 KiB) Downloaded 403 times

phurg
Newbie
Posts: 2
Joined: Thu May 16, 2013 3:57 pm
ownCloud version: 5.0.5
Webserver: Apache
Database: MySQL
OS: Linux
PHP version: 5.3.15

Re: Import calendar or feed from CLI

Postby phurg » Fri Sep 06, 2013 8:35 pm

Table names for the calendar app were recently changed in response to what seems to me to be an arcane Oracle-specific issue:
https://github.com/owncloud/calendar/issues/61
A quick search turns up the a table of identifier length limits in various SQL implementations:
http://doc.ispirer.com/sqlways/Output/S ... 1-033.html
So many standards to choose from!

I updated the owncloud import script to use the new calendar name. Also added a try/catch block to avoid db errors like this being silently consumed by the onException method.

I would conditionalize this except (a) I can't tell from the github traces which released version first had the change, and (b) the version released as 5.0.10 has 5.0.17 in lib/util.php:getVersion (and in config.php).

George
Attachments
owncloud-import-calendar.php
(2.59 KiB) Downloaded 414 times


  • Similar Topics
    Replies
    Views
    Last post

Return to “Tutorials”

Who is online

Users browsing this forum: No registered users and 2 guests