MDL-70153 qtype_essay: Add behat test for attachments max size
[moodle.git] / question / engine / upgrade.txt
CommitLineData
f6579bea
TH
1This files describes API changes for the core question engine.
2
9cbbb779
TH
3=== 3.9 ===
4
51) In the past, whenever a question_usage_by_activity was loaded from the database,
6 the apply_attempt_state was immediately called on every question, whether the
7 results of doing that were ever used, or not.
8
9 Now we have changed the code flow, so that apply_attempt_state is only called
10 when some data or processing is requested (e.g. analysing a response or rendering
11 the question) which requires the question to be fully initialised. This is MDL-67183.
12
13 This change should be completely invisible with everything handled by the question
14 engine. If you don't change your code, it should continue to work.
15
16 However, to get the full advantage of this change, you should review your code,
17 and look at every call to get_question or get_behaviour (on a question_attempt or
18 question_usage_by_activity). The problem with these methods is that the question engine
19 cannot know what you are planning to do with the question once you have got it.
20 Therefore, they have to assume that apply_attempt_state must be called - which can be expensive.
21 If you know that you don't need that (because, for example, you are just going to
22 look at ->id or ->questiontext or something simple) then you should pass
23 false to these functions, to get the possible performance benefit.
24 In addition, there is a new method $qa->get_question_id() to handle that case more simply.
25
64207dab
TH
26 Note that you don't have worry about this in places like the renderer for your question
27 type, because by the time you are in the renderer, the question will already have been
28 initialised.
29
9cbbb779 30
f1ffd134
TH
31=== 3.7 ===
32
331) When a question is rendered, the outer div of the question has an id="q123"
34 added. Unfortunately, this id was not actually unique, leading to bugs like
35 MDL-52572. Therefore, we have had to change it. The id used now is what
36 is returned by the new method $qa->get_outer_question_div_unique_id().
37 The old code that you need to search for and replace with a call to this
38 method is "'q' . $qa->get_slot()"
39
40 Note, the new method has also been added to Moodle 3.5.6 and 3.6.4, but
41 returning the old id. This is to help question types that want to support
42 multiple Moodle versions.
43
97e9eb20
TH
44=== 3.1, 3.0.3, 2.9.5 ===
45
461) The field question_display_options::$extrainfocontent is now displayed in the
47 outcomes (yellow) div by default. It used to be in the info div. If you have
48 overriden the question renderer, you may need to make a corresponding change.
49
50
b2694c02
TH
51=== 3.0, 2.9.2, 2.8.8 ===
52
531) The extra internal PARAM constant question_attempt::PARAM_MARK should no
54 longer be used. (It should not have been used outside the core of the
55 question system). See MDL-51090 if you want more explanation.
56
f6579bea
TH
57
58=== 2.9 ===
59
601) Some new methods on the question_usage class (and corresponding methods on
61 question_attempt, question_attempt_step, question_usage_observer, ... requried
62 to implement them, but almost certainly you should only be calling the
63 question_usage methods from your code.
64
65 * question_usage::add_question_in_place_of_other($slot, $question, $maxmark = null)
66
67 This creates a new questoin_attempt in place of an existing one, moving the
68 existing question_attempt to the end of the usage, in a new slot number.
69 The new slot number is returned. The goal is to replace the old attempt, but
70 not lose the old data.
71
72 * question_usage::set_question_max_mark($slot, $maxmark)
73
74 Sets the max mark for one question in this usage. Previously, you could
75 only change this using the bulk operation question_usage::set_max_mark_in_attempts;
76
77 * question_usage::set_question_attempt_metadata($slot, $name, $value);
78 question_usage::get_question_attempt_metadata($slot, $name);
79
80 You can now record metadata, that is, values stored by name, against
81 question_attempts. The question engine ignores this data (other than storing
82 and loading it) but you may find it useful in your code.
83
84 To see examples of where these are used, look at the chagnes from MDL-40992.
f3460297 85
5e63b335
TH
862) New fields in question_display_options, ->extrainfocontent and ->extrahistorycontent.
87 These default to blank, but can be used to inject extra content into those parts
88 of the question display. If you have overridden the methods in
89 core_question_renderer that use these fields, you may need to update your renderer.
90
f3460297 91
e9af46d8 92=== 2.6 ===
f3460297
TH
93
941) The method question_behaviour::is_manual_grade_in_range and move and become
f6579bea 95 question_engine::is_manual_grade_in_range.
02d3e4d5
TH
96
972) The arguments to core_question_renderer::mark_summary changed from
f6579bea
TH
98 ($qa, $options) to ($qa, $behaviouroutput, $options). If you have overridden
99 that method you will need to update your code.
02d3e4d5 100
c544ee92 1013) Heading level for number(), add_part_heading() and respond_history()
f6579bea
TH
102 has been lowered by one level. These changes are part of improving the page
103 accessibility and making heading to have proper nesting. (MDL-41615)
02d3e4d5
TH
104
105=== Earlier changes ===
106
107* Were not documented in this way. Sorry.