MDL-36088 questions: Add new events
[moodle.git] / question / upgrade.txt
CommitLineData
181393aa
TH
1This files describes API changes for code that uses the question API.
2
48aad79a
JMV
3=== 3.7 ===
4
5The code for the is_valid_number function that was duplicated in the
ebdd3450 6qtype_numerical and qtype_multianswer plugins in the qtype_numerical_edit_form
48aad79a
JMV
7and qtype_multianswer_edit_form classes has been moved to a static function
8in the qtype_numerical class of the qtype_numerical plugin.
9
5dd1cf33
JMV
10The exportprocess function of the qformat_default class doesn't output a blank line
11if the result of the writequestion function is null. This permit to qformat plugins
12to ignore some questions without the need to overwrite this function.
13
d499cb35
SL
14* The question_preview_cron() has been deleted. Please use \core\task\question_cron_task::execute().
15* The question_usage_statistics_cron() has been deleted. Please use \core\task\question_cron_task::execute().
16* The method question_bank::cron() has been deleted, please use question related scheduled tasks.
17
cc98914e
AN
18=== 3.5 ===
19
201) The question format exportprocess function now adds a
21 $checkcapabilities boolean to allow questions to be exported in
22 certain circumstances.
23
891750bc
FM
24=== 3.2 ===
25
261) The following renderers have been deprecated in favour of the renderable
27 core_question\output\qbank_chooser and associated render_* method.
28 * qbank_chooser
29 * qbank_chooser_types
30 * qbank_chooser_qtype
31 * qbank_chooser_title
32
5aeba199
DP
33=== 3.1 ===
34
351) The argument $requirecourseid was removed from question_edit_setup() and
36 is no longer respected. The behaviour was found to be buggy and now throws
37 debugging notices if passed.
38
4c3c1b51
TH
39=== 2.9 ===
40
1b49f31d
TH
411) Some functions in questionlib.php which were deprecated in the past have now
42 been deleted:
4c3c1b51
TH
43
44 Deprecated since 2.1
45 * question_list_instances
46 * get_grade_options
47 * question_category_isused
48 * save_question_options
49 * question_get_real_state
50
1b49f31d
TH
51 Deprecated since 2.6
52 * question_rewrite_questiontext_preview_urls
53 * question_send_questiontext_file
54 * question_pluginfile no longer falls back to using the old
55 {$previewcomponent}_questiontext_preview_pluginfile callback if the new
56 {$previewcomponent}_question_preview_pluginfile callback is missing.
57
4c3c1b51 58
16e246ac
TH
59=== 2.8 ===
60
f6579bea 611) This is just a warning that some methods of the question_engine_data_mapper
16e246ac
TH
62 class have changed. All these methods are ones that you should not have been
63 calling directly from your code, so this should not cause any problems.
64 The changed methods are:
65 * insert_question_attempt
66 * insert_step_data
67 * update_question_attempt_step
68
69
efa5155a
RM
70=== 2.7 ===
71
721) Changes to class question_bank_view:
73
74 Filters, including $recurse and $showhidden, are now implemented as
d62382d1 75 pluggable \core_question\bank\search\condition classes.
efa5155a
RM
76
77 Therefore $recurse and $showhidden are no longer passed to the following functions:
78 protected function display_options [deprecated, use display_options_form()]
79 protected function build_query_sql [deprecated, use build_query()]
80
d62382d1 81 protected function display_category_form() is deprecated. Use \core_question\bank\search\category_condition
efa5155a 82
d62382d1 83 protected function display_category_form_checkbox deprecated use html_writer::checkbox and separate JavaScript
efa5155a
RM
84
85To add filters, local plugins can now implement the function local_[pluginname]_get_question_bank_search_conditions,
86
17f229fa
RM
872) To make columns available to question_bank_view, plugins can extend core_question\bank\column_base.
88 Users may choose to display additional columns by setting $CFG->questionbankcolumns to a comma-delimited list of columns.
89
903) The subsort separator has changed from _ to - in order to distinuguish subsorts vs frankenstyle component separators.
91
924) Because of the move to autoloading, $knowncolumntypes and known_field_types() are no longer used.
93
945) question_bank_column_base and it's derived classes have been namespaced to core_question\bank\column_base.
d62382d1 95
16e246ac 96
181393aa
TH
97=== 2.6 ===
98
b07ef13b
DP
991) Modules using the question bank MUST now declare their use of it with the xxx_supports()
100 flag FEATURE_USES_QUESTIONS. question_module_uses_questions() should be used to determine
101 if a module uses questions.
102
1032) It is sometimes necessary to display bits of question content without having
181393aa
TH
104 and attempt (question_usage) in progress. Two examples of this are the option
105 in the question bank to display the questiontext, and in the quiz statistics
106 report, where it displays the question text above the report.
107
108 Previously, this display was done using a special method that only worked for
109 the question text, but which would not work for other parts of the question.
110 That old mechanism has been deprecated, and there is a new method that you
111 should use.
112
113 To display the question, replace calls to question_rewrite_questiontext_preview_urls
114 with calls to question_rewrite_question_preview_urls. Because the new function
115 is more flexibile, you have to pass more arguments.
116
117 To perform the necessary permission checks when the file is downloaded, you need
118 to implement the callback [component name]_question_preview_pluginfile.
119 (Previously you implemented [component name]_questiontext_preview_pluginfile.)
120 quiz_statistics_question_preview_pluginfile is an example of what to do.
121
122 question_send_questiontext_file has been deprecated. It is no longer necessary.
123
124 To ensure you are no longer using or defining any deprecated functions,
125 search for the regular expression:
126 question_rewrite_questiontext_preview_urls|_questiontext_preview_pluginfile|question_send_questiontext_file
70f22d60 127
c2f35e0b
TH
1283) The argument list for core_question_renderer::mark_summary has changed.
129 Please update your calls. (The most likely scenario for this is if you have
130 overridden core_question_renderer::info in your own renderer.) You need to
131 make a change like:
132 - $this->mark_summary($qa, $options);
133 + $this->mark_summary($qa, $behaviouroutput, $options);