Moodle
  1. Moodle
  2. MDL-32431

backup & restore: calendar events (backport of MDL-22895)

    Details

    • Rank:
      39300

      Description

      As per the discussion in MDL-22895 and dev chat. Any "loss of functionality" is a stable bug and thus needs to be ported to all stable branches

      We should be able to backup course events when course backup is performed. And do that controlled by one setting in backup (defaulting to yes).

      See backup_events_info() under Moodle 1.9.

      Then, restore will allow to restore that information if available and also, optionally controlled by one setting.

        Issue Links

          Activity

          Hide
          Ankit Agarwal added a comment -

          This was a clean cherry-pick and seems to be working fine as well.
          I don't think this needs to be reviewed again.
          Sending for integration
          Thanks

          Show
          Ankit Agarwal added a comment - This was a clean cherry-pick and seems to be working fine as well. I don't think this needs to be reviewed again. Sending for integration Thanks
          Hide
          Dan Poltawski added a comment -

          The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week.

          TIA and ciao

          Show
          Dan Poltawski added a comment - The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week. TIA and ciao
          Hide
          Ankit Agarwal added a comment -

          rebased!

          Show
          Ankit Agarwal added a comment - rebased!
          Hide
          Dan Poltawski added a comment -

          Updating issue title, please ensure to use the proper issue title in future issues (as agreed in http://moodle.org/local/chatlogs/index.php?conversationid=10002 )

          Show
          Dan Poltawski added a comment - Updating issue title, please ensure to use the proper issue title in future issues (as agreed in http://moodle.org/local/chatlogs/index.php?conversationid=10002 )
          Hide
          Dan Poltawski added a comment -

          Thanks, this has been integrated now

          Show
          Dan Poltawski added a comment - Thanks, this has been integrated now
          Hide
          Michael de Raadt added a comment -

          I've assigned Raj to test this as he tested the original issue. He will be back on Thursday.

          Show
          Michael de Raadt added a comment - I've assigned Raj to test this as he tested the original issue. He will be back on Thursday.
          Hide
          Rajesh Taneja added a comment -

          Thanks for implementing this Ankit
          Course, activity and group events are backed-up and restored successfully on 21 and 22.

          Show
          Rajesh Taneja added a comment - Thanks for implementing this Ankit Course, activity and group events are backed-up and restored successfully on 21 and 22.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          This has been near becoming rejected, because it's not the best code you are able to produce.

          But, luckily, at the end, it has landed and has been spread to all repos out there.

          Many thanks and, don't forget it, keep improving your skills, you can!

          Closing, ciao

          Show
          Eloy Lafuente (stronk7) added a comment - This has been near becoming rejected, because it's not the best code you are able to produce. But, luckily, at the end, it has landed and has been spread to all repos out there. Many thanks and, don't forget it, keep improving your skills, you can! Closing, ciao
          Hide
          Rex Lorenzo added a comment - - edited

          Just wanted to comment that we have applied this patch to our Moodle 2.2.2 codebase and have run into the following issues:

          • If we try to import a M19 backup with calendar events (user/course/site, doesn't matter) we get a red cross next to "Include calendar events"
          • If we try to do an in-place upgrade of a M19 site with a course with calendar events the upgraded course will display calendar events. However, if you try to backup that course and try to restore it the calendar events disappear. It seems that the backup file created do not even include the event information!

          It does work fine for a course that is totally and entirely created in M2 though.

          Show
          Rex Lorenzo added a comment - - edited Just wanted to comment that we have applied this patch to our Moodle 2.2.2 codebase and have run into the following issues: If we try to import a M19 backup with calendar events (user/course/site, doesn't matter) we get a red cross next to "Include calendar events" If we try to do an in-place upgrade of a M19 site with a course with calendar events the upgraded course will display calendar events. However, if you try to backup that course and try to restore it the calendar events disappear. It seems that the backup file created do not even include the event information! It does work fine for a course that is totally and entirely created in M2 though.
          Hide
          Rex Lorenzo added a comment - - edited

          For the in-place upgraded M1.9 course, the problem is because this query fails:

          $calendar_items_sql ="SELECT * FROM {event}
                                WHERE courseid = :courseid
                                AND (eventtype = 'course' OR eventtype = 'group')";
          

          The eventtype is not set. So for now we have a post step to do after doing an in-place upgrade to set the eventtype, but it would be better if this bug was patched.

          Show
          Rex Lorenzo added a comment - - edited For the in-place upgraded M1.9 course, the problem is because this query fails: $calendar_items_sql ="SELECT * FROM {event} WHERE courseid = :courseid AND (eventtype = 'course' OR eventtype = 'group')"; The eventtype is not set. So for now we have a post step to do after doing an in-place upgrade to set the eventtype, but it would be better if this bug was patched.
          Hide
          Ankit Agarwal added a comment - - edited

          Hi Rex,
          Thanks for the report.

          -> I did a little investigation and it seems like the "event type" functionality is broken in 1.9 . No matter what event is selected the "eventtype" field is always empty in the database. It is probably because in event_Select.html the name of the input field is set as "type", which when passed on to the "insert_record()" in event.php doesn't actually make any sense, since the column is named "eventtype".

          -> 1.9 course backups do contain event information. It is just the 'eventtype' is not set which is creating problem.
          -> If you backup a course which has been upgraded from 1.9 it wont have the event information in the backup, since the eventtype is always empty.

          I will try to get Eloy's feedback on this.
          Thanks

          Show
          Ankit Agarwal added a comment - - edited Hi Rex, Thanks for the report. -> I did a little investigation and it seems like the "event type" functionality is broken in 1.9 . No matter what event is selected the "eventtype" field is always empty in the database. It is probably because in event_Select.html the name of the input field is set as "type", which when passed on to the "insert_record()" in event.php doesn't actually make any sense, since the column is named "eventtype". -> 1.9 course backups do contain event information. It is just the 'eventtype' is not set which is creating problem. -> If you backup a course which has been upgraded from 1.9 it wont have the event information in the backup, since the eventtype is always empty. I will try to get Eloy's feedback on this. Thanks
          Hide
          Ankit Agarwal added a comment -

          I had a talk with Eloy on this and as per his feedback I have created two issues that should take care of this problem
          MDL-32826
          MDL-32827

          Thanks

          Show
          Ankit Agarwal added a comment - I had a talk with Eloy on this and as per his feedback I have created two issues that should take care of this problem MDL-32826 MDL-32827 Thanks
          Hide
          Mike Wilday added a comment -

          We are running 2.23 in moodlerooms and the calendar fix does not seem to be working. I restored several courses on Monday and none of them contained the activities in the Calendar. Can anyone confirm that this is indeed fixed or still broken?

          Show
          Mike Wilday added a comment - We are running 2.23 in moodlerooms and the calendar fix does not seem to be working. I restored several courses on Monday and none of them contained the activities in the Calendar. Can anyone confirm that this is indeed fixed or still broken?
          Hide
          Dan Poltawski added a comment -

          Hi Mike,

          This issue should be fixed - perhaps you could get in contact with moodlerooms support to verify this fix is included and they could file a bug with us if discovered not.

          Show
          Dan Poltawski added a comment - Hi Mike, This issue should be fixed - perhaps you could get in contact with moodlerooms support to verify this fix is included and they could file a bug with us if discovered not.
          Hide
          Ankit Agarwal added a comment -

          Also Mike, old course backups before the fix didnt contain the calender events. So if you are restoring a backup from before this fix, no calender events will be restored.

          Thanks

          Show
          Ankit Agarwal added a comment - Also Mike, old course backups before the fix didnt contain the calender events. So if you are restoring a backup from before this fix, no calender events will be restored. Thanks

            People

            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: