}
if ($oldversion < 2020101300.01) {
- upgrade_main_savepoint(true, 2020101300.01);
+ // Define fields tutorial and example to be added to h5p_libraries.
+ $table = new xmldb_table('h5p_libraries');
+
+ // Add tutorial field.
+ $field = new xmldb_field('tutorial', XMLDB_TYPE_TEXT, null, null, null, null, null, 'metadatasettings');
+ if (!$dbman->field_exists($table, $field)) {
+ $dbman->add_field($table, $field);
+ }
+
+ // Add example field.
+ $field = new xmldb_field('example', XMLDB_TYPE_TEXT, null, null, null, null, null, 'tutorial');
+ if (!$dbman->field_exists($table, $field)) {
+ $dbman->add_field($table, $field);
+ }
+
+ // Main savepoint reached.
+ upgrade_main_savepoint(true, 2020101300.01);
+ }
+
+ if ($oldversion < 2020101600.01) {
+ // 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, 2020101600.01);
+ }
+
++ if ($oldversion < 2020101600.02) {
+ // Script to fix incorrect records of "hidden" field in existing grade items.
+ $sql = "SELECT cm.instance, cm.course
+ FROM {course_modules} cm
+ JOIN {modules} m ON m.id = cm.module
+ WHERE m.name = :module AND cm.visible = :visible";
+ $hidequizlist = $DB->get_recordset_sql($sql, ['module' => 'quiz', 'visible' => 0]);
+
+ foreach ($hidequizlist as $hidequiz) {
+ $params = [
+ 'itemmodule' => 'quiz',
+ 'courseid' => $hidequiz->course,
+ 'iteminstance' => $hidequiz->instance,
+ ];
+
+ $DB->set_field('grade_items', 'hidden', 1, $params);
+ }
+ $hidequizlist->close();
+
++ upgrade_main_savepoint(true, 2020101600.02);
+ }
+
return true;
}
defined('MOODLE_INTERNAL') || die();
- $version = 2020101600.01; // YYYYMMDD = weekly release date of this DEV branch.
-$version = 2020101300.01; // YYYYMMDD = weekly release date of this DEV branch.
++$version = 2020101600.02; // YYYYMMDD = weekly release date of this DEV branch.
// RR = release increments - 00 in DEV branches.
// .XX = incremental changes.
-$release = '3.10dev+ (Build: 20201013)';// Human-friendly version name
+$release = '3.10dev+ (Build: 20201016)';// Human-friendly version name
$branch = '310'; // This version's branch.
$maturity = MATURITY_ALPHA; // This version's maturity level.