Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 310 and 402] [Versions 310 and 403]

This file contains the code required to upgrade all the attempt data from old versions of Moodle into the tables used by the new question engine.

Copyright: 2010 The Open University
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 479 lines (18 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 0 files

Defines 4 classes

question_engine_attempt_upgrader:: (14 methods):
  save_usage()
  set_quba_preferred_behaviour()
  set_quiz_attempt_layout()
  delete_quiz_attempt()
  insert_record()
  load_question()
  load_dataset()
  get_next_question_session()
  get_question_states()
  get_converter_class_name()
  supply_missing_question_attempt()
  convert_question_attempt()
  decode_random_attempt()
  prepare_to_restore()

question_engine_upgrade_question_loader:: (4 methods):
  __construct()
  load_question()
  get_question()
  load_dataset()

question_qtype_attempt_updater:: (6 methods):
  __construct()
  discard()
  to_text()
  question_summary()
  compare_answers()
  is_blank_answer()

question_deleted_question_attempt_updater:: (7 methods):
  right_answer()
  response_summary()
  was_answered()
  set_first_step_data_elements()
  supply_missing_first_step_data()
  set_data_elements_for_step()
  quiz_attempts_upgraded()


Class: question_engine_attempt_upgrader  - X-Ref

This class manages upgrading all the question attempts from the old database
structure to the new question engine.

Class: question_engine_upgrade_question_loader  - X-Ref

This class deals with loading (and caching) question definitions during the
question engine upgrade.

__construct($logger)   X-Ref
No description

load_question($questionid, $quizid)   X-Ref
No description

get_question($questionid, $quizid)   X-Ref
No description

load_dataset($questionid, $selecteditem)   X-Ref
No description

Class: question_qtype_attempt_updater  - X-Ref

Base class for the classes that convert the question-type specific bits of
the attempt data.

__construct($updater, $question, $logger, $qeupdater)   X-Ref
No description

discard()   X-Ref
No description

to_text($html)   X-Ref
No description

question_summary()   X-Ref
No description

compare_answers($answer1, $answer2)   X-Ref
No description

is_blank_answer($state)   X-Ref
No description

Class: question_deleted_question_attempt_updater  - X-Ref

right_answer()   X-Ref
No description

response_summary($state)   X-Ref
No description

was_answered($state)   X-Ref
No description

set_first_step_data_elements($state, &$data)   X-Ref
No description

supply_missing_first_step_data(&$data)   X-Ref
No description

set_data_elements_for_step($state, &$data)   X-Ref
No description

quiz_attempts_upgraded(environment_results $result)   X-Ref
This check verifies that all quiz attempts were upgraded since following
the question engine upgrade in Moodle 2.1.

Note: This custom check (and its environment.xml declaration) will be safely
removed once we raise min required Moodle version to be 2.7 or newer.

param: environment_results object to update, if relevant.
return: environment_results updated results object, or null if this test is not relevant.