Skip to content
Snippets Groups Projects
Commit 2e2a91a5 authored by Tim Hunt's avatar Tim Hunt
Browse files

Restore: convert mal-formed PRTs from a fatal error to a warning.

parent e8ee3ab6
No related branches found
No related tags found
No related merge requests found
......@@ -295,20 +295,16 @@ class restore_qtype_stack_plugin extends restore_qtype_plugin {
$graph->layout();
$roots = $graph->get_roots();
if (count($roots) != 1 || $graph->get_broken_cycles()) {
$questions = $DB->get_records('question', array('id' => $prt->questionid), '', 'name');
$qnames = array();
foreach ($questions as $q) {
$qnames[] = $q->name;
}
$question = $DB->get_record('question', array('id' => $prt->questionid));
if (count($roots) != 1) {
$err = 'abnormal root count: '.count($roots).'(<>1)';
} else {
$err = 'broken cycles: '.implode('.', $graph->get_broken_cycles());
}
throw new coding_exception('The PRT named "' . $prt->name .
$this->step->log('The PRT named "' . $prt->name .
'" is malformed in question id ' . $prt->questionid .
', question named "' . implode(', ', $qnames) .
'". Error reported: ' . $err);
', question named "' . $question->name .
'". Error reported: ' . $err, backup::LOG_WARNING);
}
reset($roots);
$firstnode = key($roots) - 1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment