mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 12:40:01 +01:00
Merge branch 'MDL-70285' of https://github.com/timhunt/moodle
This commit is contained in:
commit
7430e7c074
@ -2786,11 +2786,12 @@ function xmldb_main_upgrade($oldversion) {
|
||||
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");
|
||||
$DB->delete_records_select('course_modules_completion', "
|
||||
NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM {course_modules} cm
|
||||
WHERE cm.id = {course_modules_completion}.coursemoduleid
|
||||
)");
|
||||
upgrade_main_savepoint(true, 2021052500.26);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user