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

Define how we should handle restore exceptions like error_question_answers_missing_in_db

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.1.2
    • 2.3
    • Backup, Language
    • Any
    • MOODLE_21_STABLE
    • MOODLE_23_STABLE
    • MDL-30434_debug_exception
    • Hide

      Add a line to lang/en/error.php such as:

      $string['error_question_answers_missing_in_db'] = 'Unable to import question {$a->filequestionid} into database as {$a->dbquestionid} because answer "{$a->answer}" did not import correctly.';

      Being able to tell which question and caused the exception would make it much easier to troubleshoot this problem in the future.

      Show
      Add a line to lang/en/error.php such as: $string ['error_question_answers_missing_in_db'] = 'Unable to import question {$a->filequestionid} into database as {$a->dbquestionid} because answer "{$a->answer}" did not import correctly.'; Being able to tell which question and caused the exception would make it much easier to troubleshoot this problem in the future.
    • Hide

      Create a quiz.

      Add a multiple choice question with at least two answers.

      perform a full backup of the course.

      modify the code to get an exception to be thrown.
      in backup/moodle2/restore_qtype_plugin.class.php find process_question_answer()
      change if ($questioncreated) { to if (false) {
      comment out if (!$newitemid)

      { and the matching }

      Restore the backup into a new course. The exception error message should include some debug information.

      Finally, revert your code changes and perform another restore. This one should complete without any errors.

      Show
      Create a quiz. Add a multiple choice question with at least two answers. perform a full backup of the course. modify the code to get an exception to be thrown. in backup/moodle2/restore_qtype_plugin.class.php find process_question_answer() change if ($questioncreated) { to if (false) { comment out if (!$newitemid) { and the matching } Restore the backup into a new course. The exception error message should include some debug information. Finally, revert your code changes and perform another restore. This one should complete without any errors.

    Description

      The language string for the backup restore question error: error_question_answers_missing_in_db is missing. The error has shown up in at least 3 different bugs in the tracker.

      Attachments

        Issue Links

          Activity

            People

              andyjdavis Andrew Davis
              tbannister Tyler Bannister
              Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
              Sam Hemelryk Sam Hemelryk
              Frédéric Massart Frédéric Massart
              Adrian Greeve, David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo, David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                25/Jun/12