Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-17964

UID field of event changes in iCal export

    Details

    • Type: Bug
    • Status: Closed
    • Priority: 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.

        Gliffy Diagrams

          Activity

          Hide
          dougiamas 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
          dougiamas 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
          timhunt Tim Hunt added a comment -

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

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

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

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

          Looks good. Closing now.

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

          That was quick! Thanks Martin and Tim!
          Gustav

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

          Nice to see you around Gustav! Cheers!

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

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                28/Jan/09