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

Code to delete a course module should be fully self-contained

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.1.4
    • Fix Version/s: DEV backlog
    • Component/s: Course
    • Labels:
    • Affected Branches:
      MOODLE_21_STABLE

      Description

      I'm looking into MDL-31914 and have noticed that the code to delete a module is quite separated and there's room for error.

      • Some of the code is in course/mod.php (e.g. calling the $cm->modname . "_delete_instance" function, deleting area files, trigger the mod_deleted event, log the event, delete_mod_from_section, rebuild_course_cache.
      • Some of this is duplicated in the AJAX delete handler (course/rest.php)
      • The remainder (deleting course modules, course completion, events, etc) is handled in course/lib.php::delete_course_module.

      IMHO this should all be moved to the delete_course_module() function which already takes a course_module ID

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  • Created:
                    Updated: