Browse files

course MDL-23701: Fixed order of deleting entire course to delete gra…

…des before course-modules, avoiding dependency problem
  • Loading branch information...
1 parent a26246e commit fce37b254eae572f8732f8def743bf3dd0959c14 @sammarshallou sammarshallou committed Aug 9, 2010
Showing with 6 additions and 4 deletions.
  1. +6 −4 lib/moodlelib.php
View
10 lib/moodlelib.php
@@ -4015,6 +4015,12 @@ function remove_course_contents($courseid, $showfeedback=true) {
}
}
+/// Remove all data from gradebook - this needs to be done before course modules
+/// because while deleting this information, the system may need to reference
+/// the course modules that own the grades.
+ remove_course_grades($courseid, $showfeedback);
+ remove_grade_letters($context, $showfeedback);
+
/// Delete every instance of every module
if ($allmods = $DB->get_records('modules') ) {
@@ -4088,10 +4094,6 @@ function remove_course_contents($courseid, $showfeedback=true) {
/// Delete questions and question categories
question_delete_course($course, $showfeedback);
-/// Remove all data from gradebook
- remove_course_grades($courseid, $showfeedback);
- remove_grade_letters($context, $showfeedback);
-
/// Delete course tags
require_once($CFG->dirroot.'/tag/coursetagslib.php');
coursetag_delete_course_tags($course->id, $showfeedback);

0 comments on commit fce37b2

Please sign in to comment.