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

Define how we should handle restore exceptions like error_question_answers_missing_in_db

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.1.2
    • Fix Version/s: 2.3
    • Component/s: Backup, Language
    • Labels:
    • Database:
      Any
    • Testing Instructions:
      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.
    • Workaround:
      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.
    • Affected Branches:
      MOODLE_21_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE
    • Pull Master Branch:
      MDL-30434_debug_exception

      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.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    25/Jun/12