MDL-34841 error importing questions with long names.
The problem was with the non-UTF-8-safe way that a question name was being constructed from the question text. I have done a proper fix with methods in the base class to carefully construct a question name that is reasonable, and which will fit in the database column. Then I have changed all importers to use the new methods. I also remembered not to break the lesson in the process.
This commit is contained in:
@@ -166,9 +166,9 @@ class qformat_xml extends qformat_default {
|
||||
$qo = $this->defaultquestion();
|
||||
|
||||
// Question name
|
||||
$qo->name = $this->getpath($question,
|
||||
$qo->name = $this->clean_question_name($this->getpath($question,
|
||||
array('#', 'name', 0, '#', 'text', 0, '#'), '', true,
|
||||
get_string('xmlimportnoname', 'qformat_xml'));
|
||||
get_string('xmlimportnoname', 'qformat_xml')));
|
||||
$qo->questiontext = $this->getpath($question,
|
||||
array('#', 'questiontext', 0, '#', 'text', 0, '#'), '', true);
|
||||
$qo->questiontextformat = $this->trans_format($this->getpath(
|
||||
@@ -437,7 +437,7 @@ class qformat_xml extends qformat_default {
|
||||
$qo->course = $this->course;
|
||||
$qo->generalfeedback = '';
|
||||
|
||||
$qo->name = $this->import_text($question['#']['name'][0]['#']['text']);
|
||||
$qo->name = $this->clean_question_name($this->import_text($question['#']['name'][0]['#']['text']));
|
||||
$qo->questiontextformat = $questiontext['format'];
|
||||
$qo->questiontext = $qo->questiontext['text'];
|
||||
$qo->questiontextfiles = array();
|
||||
|
||||
Reference in New Issue
Block a user