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

Error duplicating quiz when there is a course view link in the answer

    XMLWordPrintable

    Details

      Description

      Steps to replicate

      1. Create A course
      2. Create a quiz
      3. Add a multiple choice question
      4. Add an answer contain a link which point to http://[currentmoodlesite]/course/view.php?id=[courseid]
      5. Save the question
      6. Duplicate the quiz
      7. There will be error displayed:

      Failed to find an answer matching "<p><a href="$@COURSEVIEWBYID*14@$">Link ABC</a></p>" in the question_answers database table. This occurred while restoring the question with id 1 in the backup file, which has been matched to the existing question with id 1 in the database.

      Error code: error_question_answers_missing_in_db

      • line 185 of /backup/moodle2/restore_qtype_plugin.class.php: restore_step_exception thrown
      • line 137 of /backup/util/plan/restore_structure_step.class.php: call to restore_qtype_plugin->process_question_answer()
      • line 121 of /backup/util/helper/restore_structure_parser_processor.class.php: call to restore_structure_step->process()
      • line 178 of /backup/util/xml/parser/processors/grouped_parser_processor.class.php: call to restore_structure_parser_processor->dispatch_chunk()
      • line 109 of /backup/util/helper/restore_structure_parser_processor.class.php: call to grouped_parser_processor->postprocess_chunk()
      • line 148 of /backup/util/xml/parser/processors/simplified_parser_processor.class.php: call to restore_structure_parser_processor->postprocess_chunk()
      • line 92 of /backup/util/xml/parser/processors/progressive_parser_processor.class.php: call to simplified_parser_processor->process_chunk()
      • line 190 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser_processor->receive_chunk()
      • line 278 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser->publish()
      • line ? of unknownfile: call to progressive_parser->end_tag()
      • line 179 of /backup/util/xml/parser/progressive_parser.class.php: call to xml_parse()
      • line 158 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser->parse()
      • line 110 of /backup/util/plan/restore_structure_step.class.php: call to progressive_parser->process()
      • line 181 of /backup/util/plan/base_task.class.php: call to restore_structure_step->execute()
      • line 178 of /backup/util/plan/base_plan.class.php: call to base_task->execute()
      • line 168 of /backup/util/plan/restore_plan.class.php: call to base_plan->execute()
      • line 384 of /backup/controller/restore_controller.class.php: call to restore_plan->execute()
      • line 3506 of /course/lib.php: call to restore_controller->execute_plan()
      • line 3518 of /course/externallib.php: call to duplicate_module()
      • line 244 of /lib/externallib.php: call to core_course_external::edit_module()
      • line 79 of /lib/ajax/service.php: call to external_api::call_external_function()

       

      I find that during an general course restore, the function define_decode_rules() is called
      But during the quiz duplication, the function is not called

       

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              ilyatregubov Ilya Tregubov
              Reporter:
              Nguyen Nathan Nguyen
              Peer reviewer:
              Dmitrii Metelkin Dmitrii Metelkin
              Integrator:
              Adrian Greeve Adrian Greeve
              Tester:
              Anna Carissa Sadia Anna Carissa Sadia
              Participants:
              Component watchers:
              Tim Hunt, Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Tim Hunt, Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              2 Vote for this issue
              Watchers:
              11 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                13/Jul/20

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 4 hours, 20 minutes
                  4h 20m