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

Question restoration should not use a loop over questions, it can be done once per context

XMLWordPrintable

    • MOODLE_26_STABLE, MOODLE_27_STABLE
    • MOODLE_26_STABLE, MOODLE_27_STABLE
    • MDL-39726-master
    • Hide
      1. Download and restore the attached Test-Images.mbz into a new course
      2. Go into the Images quiz in the course, and edit the quiz
      3. Edit each question in the quiz, verifying that there are no broken images in the various text fields (some maybe hidden in collapsed sections)
      4. Go back to the course front page, duplicate the Images quiz
      5. In the duplicate quiz, edit each question in the quiz, verifying that there are no broken images in the various text fields (some maybe hidden in collapsed sections)
      6. Backup the quiz (module backup), and restore it into a new course
      7. In the newly restored quiz, again check all images

      Because of the (relatively) complex select, please test against all DBs.

      Show
      Download and restore the attached Test-Images.mbz into a new course Go into the Images quiz in the course, and edit the quiz Edit each question in the quiz, verifying that there are no broken images in the various text fields (some maybe hidden in collapsed sections) Go back to the course front page, duplicate the Images quiz In the duplicate quiz, edit each question in the quiz, verifying that there are no broken images in the various text fields (some maybe hidden in collapsed sections) Backup the quiz (module backup), and restore it into a new course In the newly restored quiz, again check all images Because of the (relatively) complex select, please test against all DBs.

      Question restoration in backup/moodle2/restore_stepslib.php has the following function;

      /**
       * Execution step that will create all the question/answers/qtype-specific files for the restored
       * questions. It must be executed after {@link restore_move_module_questions_categories}
       * because only then each question is in its final category and only then the
       * context can be determined
       *
       * TODO: Improve this. Instead of looping over each question, it can be reduced to
       *       be done by contexts (this will save a huge ammount of queries)
       */
      class restore_create_question_files extends restore_execution_step {
       
          protected function define_execution() {
      

      That TODO is causing issues with large question bank restoration. The loop of questions adds lots of backwards and forwards latency and query parsing time to the restore process when talking to the database.

      This issue has been created to address the TODO item as it's been raised and discussed in MDL-29439.

      This is considered an Improvement as it's an alteration to the Question restore on a sufficiently large scale that it would not be particularly safe to back-patch. Especially given that it's still possible to restore large quizzes in previous versions.

            emerrill Eric Merrill
            mr-russ Russell Smith
            Tim Hunt Tim Hunt
            Damyon Wiese Damyon Wiese
            Mark Nelson Mark Nelson
            Votes:
            12 Vote for this issue
            Watchers:
            23 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.