Permalink
Browse files

MDL-36942 xml question import: don't add spaces.

They are not necessary anyway, there is a \n character at the end of
each line.

Thanks to Richard Lobb for fining the problem and how to fix it.
  • Loading branch information...
1 parent 2a0ec98 commit a0a83bd0bf44f851aec25833efacf7412799f9f9 @timhunt timhunt committed Nov 30, 2012
Showing with 4 additions and 3 deletions.
  1. +4 −3 question/format/xml/format.php
@@ -905,17 +905,18 @@ protected function import_category($question) {
*/
protected function readquestions($lines) {
// We just need it as one big string
- $text = implode($lines, ' ');
- unset($lines);
+ $lines = implode('', $lines);
// This converts xml to big nasty data structure
// the 0 means keep white space as it is (important for markdown format)
try {
- $xml = xmlize($text, 0, 'UTF-8', true);
+ $xml = xmlize($lines, 0, 'UTF-8', true);
} catch (xml_format_exception $e) {
$this->error($e->getMessage(), '');
return false;
}
+ unset($lines); // No need to keep this in memory.
+
// Set up array to hold all our questions
$questions = array();

0 comments on commit a0a83bd

Please sign in to comment.