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

Cannot delete a course with busted grade items

    XMLWordPrintable

Details

    Description

      We have seen a few sites with databases in a weird state that prevents users from deleting their courses. All of them have a grade item that stops deletion. While we are not yet sure how the databases get in this weird state, it seems to me that busted grade_items preventing a course from being deleted in of itself might be considered a bug.

      To reproduce on a fresh install:

      1. Create a course and add a scorm activity
      2. Delete the record that shows up in the mdl_scorm table
      3. Browse to "Site administration" > "Courses" > "Manage courses and categories"
      4. Attempt to delete the course you just made
      5. You should see an invalid module id error

      This happens because the get_context method in grade_item.php makes a call to get_fast_modinfo without doing any checks to see if the instances array contains the key it is searching for:

      $cm = get_fast_modinfo($this->courseid)->instances[$this->itemmodule][$this->iteminstance];
      

      Attachments

        Issue Links

          Activity

            People

              vmdef Victor Déniz Falcón
              cameron1729 cameron1729
              Adrian Greeve, Ilya Tregubov, Kevin Percy, Mathew May, Mihail Geshoski, Shamim Rezaie, Dan Marsden, Matteo Scaramuccia, Ilya Tregubov, Kevin Percy, Mathew May, Mihail Geshoski, Shamim Rezaie
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 3 hours
                  3h