Commit 178e343a authored by Andrew Nicols's avatar Andrew Nicols
Browse files

Merge branch 'MDL-69687-master' of https://github.com/sammarshallou/moodle

parents b0c0d612 4dcca1b0
......@@ -2782,5 +2782,16 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2021052500.24);
}
if ($oldversion < 2021052500.26) {
// Delete orphaned course_modules_completion rows; these were not deleted properly
// by remove_course_contents function.
$DB->delete_records_subquery('course_modules_completion', 'id', 'id',
"SELECT cmc.id
FROM {course_modules_completion} cmc
LEFT JOIN {course_modules} cm ON cm.id = cmc.coursemoduleid
WHERE cm.id IS NULL");
upgrade_main_savepoint(true, 2021052500.26);
}
return true;
}
......@@ -5306,6 +5306,7 @@ function remove_course_contents($courseid, $showfeedback = true, array $options
if ($cm->id) {
// Delete cm and its context - orphaned contexts are purged in cron in case of any race condition.
context_helper::delete_instance(CONTEXT_MODULE, $cm->id);
$DB->delete_records('course_modules_completion', ['coursemoduleid' => $cm->id]);
$DB->delete_records('course_modules', array('id' => $cm->id));
rebuild_course_cache($cm->course, true);
}
......
......@@ -29,7 +29,7 @@
defined('MOODLE_INTERNAL') || die();
$version = 2021052500.25; // YYYYMMDD = weekly release date of this DEV branch.
$version = 2021052500.26; // YYYYMMDD = weekly release date of this DEV branch.
// RR = release increments - 00 in DEV branches.
// .XX = incremental changes.
$release = '4.0dev (Build: 20201016)'; // Human-friendly version name
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment