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

Unable to delete users who have invalid course id in their grades

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Deferred
    • 3.6.6
    • None
    • User management
    • None
    • MOODLE_36_STABLE

    Description

      Recently we had issues with deleting users as it systematically throw an 'invalidrecord' error ("Can\'t find data record in database table {$a}.')

      I tracked the issue down to the fact that the user was associated with grades items which are invalid (the course id is missing somewhat). 

      The call stack looks like:

      • the moodlelib.php: delete_user(4169)
      • lib/gradelib.php: grade_user_delete (1529),
      •  lib/grade/grade_grade.php: delete (1113)
      • finally: lib/classes/event/grade_deleted.php (70)

      So basically a exception is thrown when we create the event for the grade_deletion and then it "breaks" the deletion process altogether with a user which is not deleted.

      My first thought was to catch the exception but I supose that's not the right way foward as the event will not be created. 

      Any thought about if it is a problem that needs to be solved in the moodlelib/core moodle or there is a workaround somewhere ?

       

      Seems that we have had a similar issue here #MDL-64895 on course deletion.

       

       

       

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            lmdavid Laurent DAVID
            David Woloszyn, Huong Nguyen, Jake Dallimore, Michael Hawkins, Stevani Andolo
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: