upgrade_main_savepoint($result, 2008050200);
}
+ if ($result && $oldversion < 2008050700) {
+ /// Fix minor problem caused by MDL-5482.
+ require_once($CFG->dirroot . '/question/upgrade.php');
+ $result = $result && question_fix_random_question_parents();
+ upgrade_main_savepoint($result, 2008050700);
+ }
+
return $result;
}
return $result;
}
+
+/**
+ * In Moodle, all random questions should have question.parent set to be the same
+ * as question.id. One effect of MDL-5482 is that this will not be true for questions that
+ * were backed up then restored. The probably does not cause many problems, except occasionally,
+ * if the bogus question.parent happens to point to a multianswer question type, or when you
+ * try to do a subsequent backup. Anyway, these question.parent values should be fixed, and
+ * that is what this update does.
+ */
+function question_fix_random_question_parents() {
+ global $CFG;
+ return execute_sql('UPDATE ' . $CFG->prefix . 'question SET parent = id ' .
+ "WHERE qtype = 'random' AND parent <> id");
+}
+
?>
// This is compared against the values stored in the database to determine
// whether upgrades should be performed (see lib/db/*.php)
- $version = 2008050200; // YYYYMMDD = date of the last version bump
+ $version = 2008050700; // YYYYMMDD = date of the last version bump
// XX = daily increments
$release = '2.0 dev (Build: 20080507)'; // Human-friendly version name