Moodle

UID field of event changes in iCal export

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.9.3
  • Fix Version/s: 1.9.4
  • Component/s: Calendar
  • Labels:
    None
  • Affected Branches:
    MOODLE_19_STABLE
  • Fixed Branches:
    MOODLE_19_STABLE

Description

The iCal export creates a new UID for each event each time the iCal feed is requested. That means that calendars that consume the iCal feed create a duplicate event each time they update from the feed. The UID should really be an identifier for the calendar event.

Activity

Hide
Martin Dougiamas added a comment -

Yes this looks like a bad oversight.

Seems like $eventid@hostname should be enough.

This should fix it:

Index: export_execute.php
===================================================================
RCS file: /cvsroot/moodle/moodle/calendar/export_execute.php,v
retrieving revision 1.5.2.8
diff -c -r1.5.2.8 export_execute.php

      • export_execute.php 31 Dec 2008 15:54:09 -0000 1.5.2.8
      • export_execute.php 20 Jan 2009 03:04:43 -0000
        ***************
      • 127,132 ****
      • 127,133 ----
        }
        }
        $ev = new iCalendar_event;
        + $ev->add_property('uid', $event->id.'@'.$_SERVER['HTTP_HOST']);
        $ev->add_property('summary', $event->name);
        $ev->add_property('description', $event->description);
        $ev->add_property('class', 'PUBLIC'); // PUBLIC / PRIVATE / CONFIDENTIAL
Show
Martin Dougiamas added a comment - Yes this looks like a bad oversight. Seems like $eventid@hostname should be enough. This should fix it: Index: export_execute.php =================================================================== RCS file: /cvsroot/moodle/moodle/calendar/export_execute.php,v retrieving revision 1.5.2.8 diff -c -r1.5.2.8 export_execute.php
      • export_execute.php 31 Dec 2008 15:54:09 -0000 1.5.2.8
      • export_execute.php 20 Jan 2009 03:04:43 -0000 ***************
      • 127,132 ****
      • 127,133 ---- } } $ev = new iCalendar_event; + $ev->add_property('uid', $event->id.'@'.$_SERVER['HTTP_HOST']); $ev->add_property('summary', $event->name); $ev->add_property('description', $event->description); $ev->add_property('class', 'PUBLIC'); // PUBLIC / PRIVATE / CONFIDENTIAL
Hide
Tim Hunt added a comment -

I'm not convinced. What about two Moodles on the same server. Wouldn't $CFG->wwwroot be safer?

Show
Tim Hunt added a comment - I'm not convinced. What about two Moodles on the same server. Wouldn't $CFG->wwwroot be safer?
Hide
Martin Dougiamas added a comment -

Good catch, fixed to now use wwwroot (with http:// and https:// stripped)

Show
Martin Dougiamas added a comment - Good catch, fixed to now use wwwroot (with http:// and https:// stripped)
Hide
Tim Hunt added a comment -

Looks good. Closing now.

Show
Tim Hunt added a comment - Looks good. Closing now.
Hide
Gustav W Delius added a comment -

That was quick! Thanks Martin and Tim!
Gustav

Show
Gustav W Delius added a comment - That was quick! Thanks Martin and Tim! Gustav
Hide
Martin Dougiamas added a comment -

Nice to see you around Gustav! Cheers!

Show
Martin Dougiamas added a comment - Nice to see you around Gustav! Cheers!

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: