Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-37967

Improve XML question import format handling of duplicated files

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3.4, 2.4.1, 2.5
    • Fix Version/s: 2.3.5, 2.4.2
    • Component/s: Questions
    • Labels:
      None
    • Testing Instructions:
      Hide

      Verify that without this patch trying to import the attached sample XML file produce the error message "Can not create file" followed by the name of a draftfile ending in moodle_logo_small.png and import fails.

      With this patch applied file is imported but a developper debugging message is displayed :
      Duplicate file in XML: moodle_logo_small.png

      line 177 of \question\format\xml\format.php: call to debugging()
      line 159 of \question\format\xml\format.php: call to qformat_xml->import_files_as_draft()
      line 214 of \question\format\xml\format.php: call to qformat_xml->import_text_with_files()
      line 513 of \question\format\xml\format.php: call to qformat_xml->import_headers()
      line 915 of \question\format\xml\format.php: call to qformat_xml->import_truefalse()
      line 303 of \question\format.php: call to qformat_xml->readquestions()
      line 119 of \question\import.php: call to qformat_default->importprocess()

      After the import verify that a working true/false question has been correctly imported with twice the same small Moodle logo included in question text.

      Show
      Verify that without this patch trying to import the attached sample XML file produce the error message "Can not create file" followed by the name of a draftfile ending in moodle_logo_small.png and import fails. With this patch applied file is imported but a developper debugging message is displayed : Duplicate file in XML: moodle_logo_small.png line 177 of \question\format\xml\format.php: call to debugging() line 159 of \question\format\xml\format.php: call to qformat_xml->import_files_as_draft() line 214 of \question\format\xml\format.php: call to qformat_xml->import_text_with_files() line 513 of \question\format\xml\format.php: call to qformat_xml->import_headers() line 915 of \question\format\xml\format.php: call to qformat_xml->import_truefalse() line 303 of \question\format.php: call to qformat_xml->readquestions() line 119 of \question\import.php: call to qformat_default->importprocess() After the import verify that a working true/false question has been correctly imported with twice the same small Moodle logo included in question text.
    • Affected Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE
    • Pull Master Branch:

      Description

      During working on MDL-37934 it was discovered that if an XML contains the same file several times for the same field of the same question an error message not very explicit is displayed and the import abort for the whole file.
      This issue is about a better handling of this issue that can only happen with XML files generated by external system like MoodleXMLBuilder not with files generated by Moodle question XML export.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  11/Mar/13