Skip to content

Commit

Permalink
MDL-13302 gradebook data deleted now in remove_course_contents() - it…
Browse files Browse the repository at this point in the history
… makes better sense to have it there; merged from MOODLE_19_STABLE
  • Loading branch information
skodak committed Feb 18, 2008
1 parent a0052d8 commit 93964e1
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/moodlelib.php
Original file line number Diff line number Diff line change
Expand Up @@ -3370,26 +3370,20 @@ function set_login_session_preferences() {
*/
function delete_course($courseid, $showfeedback = true) {
global $CFG;
require_once($CFG->libdir.'/gradelib.php');
$result = true;

// frontpage course can not be deleted!!
if ($courseid == SITEID) {
return false;
}

$context = get_context_instance(CONTEXT_COURSE, $courseid);

if (!remove_course_contents($courseid, $showfeedback)) {
if ($showfeedback) {
notify("An error occurred while deleting some of the course contents.");
}
$result = false;
}

remove_course_grades($courseid, $showfeedback);
remove_grade_letters($context, $showfeedback);

if (!delete_records("course", "id", $courseid)) {
if ($showfeedback) {
notify("An error occurred while deleting the main course record.");
Expand Down Expand Up @@ -3429,7 +3423,8 @@ function delete_course($courseid, $showfeedback = true) {
function remove_course_contents($courseid, $showfeedback=true) {

global $CFG;
include_once($CFG->libdir.'/questionlib.php');
require_once($CFG->libdir.'/questionlib.php');
require_once($CFG->libdir.'/gradelib.php');

$result = true;

Expand Down Expand Up @@ -3580,6 +3575,11 @@ function remove_course_contents($courseid, $showfeedback=true) {
/// Delete questions and question categories
question_delete_course($course, $showfeedback);

/// Remove all data from gradebook
$context = get_context_instance(CONTEXT_COURSE, $courseid);
remove_course_grades($courseid, $showfeedback);
remove_grade_letters($context, $showfeedback);

return $result;
}

Expand Down

0 comments on commit 93964e1

Please sign in to comment.