-
Bug
-
Resolution: Fixed
-
Minor
-
2.9.2, 3.1.9, 3.2.1, 3.2.3, 3.2.6, 3.3.3, 3.4, 3.5.10, 3.6.8, 3.7.4, 3.7.5, 3.8.1, 3.8.2, 3.9
-
MOODLE_29_STABLE, MOODLE_31_STABLE, MOODLE_32_STABLE, MOODLE_33_STABLE, MOODLE_34_STABLE, MOODLE_35_STABLE, MOODLE_36_STABLE, MOODLE_37_STABLE, MOODLE_38_STABLE, MOODLE_39_STABLE
-
MOODLE_37_STABLE, MOODLE_38_STABLE
-
-
I cannot delete some users. When I try I get an error page saying "Can not find data record in database table course." Here are the error_log entries:
[Wed Oct 07 14:10:19 2015] [error] [client 143.195.4.8] PHP Notice: Trying to get property of non-object in /srv/www/courses.imsa.edu/moodleC/lib/grade/grade_grade.php on line 1067, referer: http://moodlec.devnet.imsa.edu/admin/user.php?sort=name&dir=ASC&perpage=30&page=0&delete=2973&sesskey=IhIWmH8Y9H
|
[Wed Oct 07 14:10:19 2015] [error] [client 143.195.4.8] PHP Notice: Trying to get property of non-object in /srv/www/courses.imsa.edu/moodleC/lib/classes/event/grade_deleted.php on line 70, referer: http://moodlec.devnet.imsa.edu/admin/user.php?sort=name&dir=ASC&perpage=30&page=0&delete=2973&sesskey=IhIWmH8Y9H
|
[Wed Oct 07 14:10:19 2015] [error] [client 143.195.4.8] Default exception handler: Can not find data record in database table course. Debug: SELECT id,category FROM {course} WHERE id IS NULL\n[array (\n)]\nError code: invalidrecord\n* line 1453 of /lib/dml/moodle_database.php: dml_missing_record_exception thrown\n* line 1429 of /lib/dml/moodle_database.php: call to moodle_database->get_record_select()\n* line 6884 of /lib/accesslib.php: call to moodle_database->get_record()\n* line 70 of /lib/classes/event/grade_deleted.php: call to context_course::instance()\n* line 1026 of /lib/grade/grade_grade.php: call to core\\event\\grade_deleted::create_from_grade()\n* line 1335 of /lib/gradelib.php: call to grade_grade->delete()\n* line 3944 of /lib/moodlelib.php: call to grade_user_delete()\n* line 86 of /admin/user.php: call to delete_user()\n, referer: http://moodlec.devnet.imsa.edu/admin/user.php?sort=name&dir=ASC&perpage=30&page=0&delete=2973&sesskey=IhIWmH8Y9H
|
I find that the problem arises for users that have grade_grades rows for which there is no associated grade_items row. Out of 113021 rows in grade_grades, 5374 of them have itemid column value for which there is no grade_item row with that id column value. I have no idea why that is the case in our data or how to replicate it.