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;
}
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);
}
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