-
Bug
-
Resolution: Deferred
-
Minor
-
None
-
3.6.6
-
None
-
MOODLE_36_STABLE
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.