mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDL-14750 - followup - make the code robust in the case their are broken questions in the DB.
This commit is contained in:
parent
994c8c3509
commit
ed5ba2df55
@ -52,9 +52,11 @@ function question_multianswer_fix_subquestion_parents_and_categories() {
|
||||
'question q JOIN ' . $CFG->prefix . 'question_multianswer qma ON q.id = qma.question');
|
||||
if ($rs) {
|
||||
while ($q = rs_fetch_next_record($rs)) {
|
||||
$result = $result && execute_sql('UPDATE ' . $CFG->prefix . 'question' .
|
||||
' SET parent = ' . $q->id . ', category = ' . $q->category .
|
||||
' WHERE id IN (' . $q->sequence . ') AND parent <> 0');
|
||||
if (!empty($q->sequence)) {
|
||||
$result = $result && execute_sql('UPDATE ' . $CFG->prefix . 'question' .
|
||||
' SET parent = ' . $q->id . ', category = ' . $q->category .
|
||||
' WHERE id IN (' . $q->sequence . ') AND parent <> 0');
|
||||
}
|
||||
}
|
||||
rs_close($rs);
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user