Merge branch 'MDL-69687-m38' of https://github.com/sammarshallou/moodle into MOODLE_38_STABLE

This commit is contained in:
Andrew Nicols
2020-10-20 08:03:02 +08:00
4 changed files with 14 additions and 2 deletions
+11
View File
@@ -3948,5 +3948,16 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2019111804.08);
}
if ($oldversion < 2019111805.09) {
// 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, 2019111805.09);
}
return true;
}
+1 -1
View File
@@ -1970,7 +1970,7 @@ abstract class moodle_database {
* @param string $subquery Subquery that will return values of the field to delete
* @param array $params Parameters for subquery
* @throws dml_exception If there is any error
* @since Moodle 3.10
* @since Moodle 3.8.6
*/
public function delete_records_subquery(string $table, string $field, string $alias,
string $subquery, array $params = []): void {
+1
View File
@@ -5256,6 +5256,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);
}
+1 -1
View File
@@ -29,7 +29,7 @@
defined('MOODLE_INTERNAL') || die();
$version = 2019111805.08; // 20191118 = branching date YYYYMMDD - do not modify!
$version = 2019111805.09; // 20191118 = branching date YYYYMMDD - do not modify!
// RR = release increments - 00 in DEV branches.
// .XX = incremental changes.
$release = '3.8.5+ (Build: 20201016)'; // Human-friendly version name