Skip to content

Commit

Permalink
Revert "MDL-31914 Ensure that completion criteria are deleted when re…
Browse files Browse the repository at this point in the history
…moving a course module"

This reverts commit a8a0767.
  • Loading branch information
danpoltawski committed Mar 29, 2012
1 parent a16f0a3 commit 5703599
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 21 deletions.
1 change: 0 additions & 1 deletion course/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -2836,7 +2836,6 @@ function delete_course_module($id) {
// very quick on an empty table)
$DB->delete_records('course_modules_completion', array('coursemoduleid' => $cm->id));
$DB->delete_records('course_modules_availability', array('coursemoduleid'=> $cm->id));
$DB->delete_records('course_completion_criteria', array('moduleinstance'=> $cm->id));

delete_context(CONTEXT_MODULE, $cm->id);
return $DB->delete_records('course_modules', array('id'=>$cm->id));
Expand Down
19 changes: 0 additions & 19 deletions lib/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -6762,25 +6762,6 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2011070104.12);
}

if ($oldversion < 2011070105.03) {
// Delete orphaned criteria which were left when modules were removed
if ($DB->get_dbfamily() === 'mysql') {
$sql = "DELETE cc FROM {course_completion_criteria} cc
LEFT JOIN {course_modules} cm ON cm.id = cc.moduleinstance
WHERE cm.id IS NULL";
} else {
$sql = "DELETE FROM {course_completion_criteria}
WHERE NOT EXISTS (
SELECT 'x' FROM {course_modules}
WHERE {course_modules}.id = {course_completion_criteria}.moduleinstance)";
}
$DB->execute($sql);

// Main savepoint reached
upgrade_main_savepoint(true, 2011070105.03);
}


return true;
}

2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
defined('MOODLE_INTERNAL') || die();


$version = 2011070105.03; // 20110701 = branching date YYYYMMDD - do not modify!
$version = 2011070105.02; // 20110701 = branching date YYYYMMDD - do not modify!
// RR = release increments - 00 in DEV branches
// .XX = incremental changes

Expand Down

0 comments on commit 5703599

Please sign in to comment.