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

Quiz duplication fails if questions have file links in their texts

    XMLWordPrintable

    Details

      Description

      When you try to duplicate a quiz which has some questions with images or other files URLs like '<img src="http://moodle.devbox16.local/file.php/6/RspQ-2010%20Carbonyl%20Quiz%201/q6ethbr.gif" alt="Q6EthBr" align="bottom" border="0">' it will fail with  error_question_answers_missing_in_db

      It happens because backup_xml_transformer::process_filephp_links on backup and restore_structure_parser_processor::process_cdata on restore treat $@FILEPHP@$ differently.

      The first function replaces file path without a trailing slash, but the second function adds additional slash on restore.

      Because of that restore_qtype_match_plugin::process_match can't match questiontext as data coming from XML has an extra slash and it fails with 'error_qtype_match_subquestion_missing_in_db' exception. 

       

       Steps to replicate:

      1. Create a course.
      2. Restore attached quiz activity into it
      3. Try to duplicate an activity.
         

      As a side effect every time you backup and restore the activity again it adds more extra slashes to the file paths.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                dmitriim Dmitrii Metelkin
                Reporter:
                dmitriim Dmitrii Metelkin
                Peer reviewer:
                Tim Hunt
                Integrator:
                Jun Pataleta
                Tester:
                Adrian Greeve
                Participants:
                Component watchers:
                Adrian Greeve, Mihail Geshoski, Peter Dias, Adrian Greeve, Mihail Geshoski, Peter Dias, Tim Hunt, Andrew Nicols, Mathew May, Michael Hawkins, Shamim Rezaie, Simey Lameze
              • Votes:
                2 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  10/Jul/17