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

Warnings about "must define the function" get_objectid_mapping() and get_other_mapping()

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 4.1.6, 4.2.3, 4.4.1
    • Backup
    • MOODLE_401_STABLE, MOODLE_402_STABLE, MOODLE_404_STABLE

      Context

      Have recycle bin activated. Have a course in the recycle bin of its category, with logs incorporated into the backup. Moodle 4.1.6+ weekly.

      Problem

      When restoring the course into a new course, with development debugging activated, one can see lots of warnings. See attached file.

      In summary, they are the following ones, restoring a single course:

      $ grep -i "In order" warnings_while_restoring_a_course.log | sort | uniq -c 
            1 In order to restore course logs accurately the event "core\event\course_section_deleted" must define the function get_objectid_mapping().
            1 In order to restore course logs accurately the event "core\event\course_section_deleted" must define the function get_other_mapping().
           18 In order to restore course logs accurately the event "core\event\grade_item_created" must define the function get_objectid_mapping().
           18 In order to restore course logs accurately the event "core\event\grade_item_created" must define the function get_other_mapping().
          138 In order to restore course logs accurately the event "core\event\grade_item_updated" must define the function get_objectid_mapping().
          138 In order to restore course logs accurately the event "core\event\grade_item_updated" must define the function get_other_mapping().
            2 In order to restore course logs accurately the event "mod_folder\event\all_files_downloaded" must define the function get_objectid_mapping().
            3 In order to restore course logs accurately the event "tool_recyclebin\event\course_bin_item_created" must define the function get_objectid_mapping().
      

      referring to these events:

      $ grep -i "In order" warnings_while_restoring_a_course.log | sort | uniq | grep -oP "\".*\"" | uniq
      "core\event\course_section_deleted"
      "core\event\grade_item_created"
      "core\event\grade_item_updated"
      "mod_folder\event\all_files_downloaded"
      "tool_recyclebin\event\course_bin_item_created"
      

      referring in some cases to one method and in other cases to two methods. They are always the same two:

      $ grep -i "In order" warnings_while_restoring_a_course.log | sort | uniq | grep -oP "get\_.*" | sort | uniq
      get_objectid_mapping().
      get_other_mapping().
      

      How to reproduce

      It was a real course, but for the above records, I assume all these actions should be performed in the course, before putting it into the recycle bin:

      Then as admin:

      1. Be sure default settings for course backups include logs.
      2. Be sure category recycle bin and course recycle bin are activated.
      3. Debug has to be on DEBUG_DEVELOPER level.
      1. As admin, create a course
      2. Have enrolled at least one student
      3. Have enrolled at least one teacher
      4. As teacher, have at least one gradable activity, like a mod_assign
      5. As teacher, delete at least one course section (to trigger "core\event\course_section_deleted" event)
      6. As teacher, grade for the first time a student (to trigger "core\event\grade_item_created" event)
      7. As teacher, regrade a second time the same student (to trigger "core\event\grade_item_updated" event)
      8. As teacher, create a folder with some files on it (mod_folder).
      9. As student, dowload all files (to trigger "mod_folder\event\all_files_downloaded" event)
      10. As teacher, create an activity on the course and delete it (to trigger "tool_recyclebin\event\course_bin_item_created" event)

      As admin:

      1. Delete the above course. This will put the course's backup into the category's recycle bin.
      2. Go to the category's recycle bin.
      3. Click to restore the course.
      4. You should see a similar stack trace, one stack trace for each different event.

      Expected behaviour

      With development debugging activated, no warning should be seen.

            Unassigned Unassigned
            jpahullo Jordi Pujol-Ahulló
            Votes:
            5 Vote for this issue
            Watchers:
            14 Start watching this issue

              Created:
              Updated:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.