MDL-70324 Question: get_all_response_file_areas() not work correctly
[moodle.git] / question / upgrade.txt
CommitLineData
181393aa
TH
1This files describes API changes for code that uses the question API.
2
887daf93
TH
3=== 3.9 ==
4
4a45b711
TH
51) For years, the ..._questions_in_use callback has been the right way for plugins to
6 tell the core question system if questions are required. Previously this callback
7 only worked in mods. Now it works in all plugins.
8
9 At the same time, if you are still relying on the legacy ..._question_list_instances
10 callback for this, you will now get a debugging warning telling you to upgrade.
11
122) Previously, the functions question_delete_activity, question_delete_course and
13 question_delete_course_category would echo output. This was not correct behaviour for
14 a low-level API function. Now, they no longer output. Related to this, the helper
15 function they use, question_delete_context, now always returns an empty array.
16
17 This probably won't acutally cause you any problems. However, you may previously
18 have had to add expectOutputRegex calls to your unit tests to avoid warnings about
19 risky tests. If you have done that, those tests will now fail until you delete that expectation.
887daf93 20
887daf93 21
61cc1e64
TH
22=== 3.8 ===
23
24If you have customised the display of the question bank (using $CFG->questionbankcolumns)
25then be aware that the default configuration has changed, and you may wish to make
26equivalent changes in your customised version. The old column question_name_column
27has been replaced by question_name_idnumber_tags_column. The old question_name_column
28still exists, so it is safe to continue using it.
29
701ae1eb
TH
30There is a new question bank column edit_menu_column which displays all actions
31in a drop-down menu, instead of as separate icons. This is now used by default.
32Specifically, it gathers all other columns which implement the new interface
33menuable_action. If you have made a custom subclasses of action_column_base,
34you probably want to implement the new interface. If your column is a simple action,
35the easiest way to do this will be to subclass menu_action_column_base. If your action
36is more complex, and does not follow the simple pattern that menu_action_column_base
37uses, then you will need to implement menuable_action yourself. The commit for
38MDL-66816 updates all the core action columns. Looking at that change should make
39it clearly the changes you need to make to your columns.
40
41
48aad79a
JMV
42=== 3.7 ===
43
44The code for the is_valid_number function that was duplicated in the
ebdd3450 45qtype_numerical and qtype_multianswer plugins in the qtype_numerical_edit_form
48aad79a
JMV
46and qtype_multianswer_edit_form classes has been moved to a static function
47in the qtype_numerical class of the qtype_numerical plugin.
48
5dd1cf33
JMV
49The exportprocess function of the qformat_default class doesn't output a blank line
50if the result of the writequestion function is null. This permit to qformat plugins
51to ignore some questions without the need to overwrite this function.
52
d499cb35
SL
53* The question_preview_cron() has been deleted. Please use \core\task\question_cron_task::execute().
54* The question_usage_statistics_cron() has been deleted. Please use \core\task\question_cron_task::execute().
55* The method question_bank::cron() has been deleted, please use question related scheduled tasks.
56
cc98914e
AN
57=== 3.5 ===
58
591) The question format exportprocess function now adds a
60 $checkcapabilities boolean to allow questions to be exported in
61 certain circumstances.
62
891750bc
FM
63=== 3.2 ===
64
651) The following renderers have been deprecated in favour of the renderable
66 core_question\output\qbank_chooser and associated render_* method.
67 * qbank_chooser
68 * qbank_chooser_types
69 * qbank_chooser_qtype
70 * qbank_chooser_title
71
5aeba199
DP
72=== 3.1 ===
73
741) The argument $requirecourseid was removed from question_edit_setup() and
75 is no longer respected. The behaviour was found to be buggy and now throws
76 debugging notices if passed.
77
4c3c1b51
TH
78=== 2.9 ===
79
1b49f31d
TH
801) Some functions in questionlib.php which were deprecated in the past have now
81 been deleted:
4c3c1b51
TH
82
83 Deprecated since 2.1
84 * question_list_instances
85 * get_grade_options
86 * question_category_isused
87 * save_question_options
88 * question_get_real_state
89
1b49f31d
TH
90 Deprecated since 2.6
91 * question_rewrite_questiontext_preview_urls
92 * question_send_questiontext_file
93 * question_pluginfile no longer falls back to using the old
94 {$previewcomponent}_questiontext_preview_pluginfile callback if the new
95 {$previewcomponent}_question_preview_pluginfile callback is missing.
96
4c3c1b51 97
16e246ac
TH
98=== 2.8 ===
99
f6579bea 1001) This is just a warning that some methods of the question_engine_data_mapper
16e246ac
TH
101 class have changed. All these methods are ones that you should not have been
102 calling directly from your code, so this should not cause any problems.
103 The changed methods are:
104 * insert_question_attempt
105 * insert_step_data
106 * update_question_attempt_step
107
108
efa5155a
RM
109=== 2.7 ===
110
1111) Changes to class question_bank_view:
112
113 Filters, including $recurse and $showhidden, are now implemented as
d62382d1 114 pluggable \core_question\bank\search\condition classes.
efa5155a
RM
115
116 Therefore $recurse and $showhidden are no longer passed to the following functions:
117 protected function display_options [deprecated, use display_options_form()]
118 protected function build_query_sql [deprecated, use build_query()]
119
d62382d1 120 protected function display_category_form() is deprecated. Use \core_question\bank\search\category_condition
efa5155a 121
d62382d1 122 protected function display_category_form_checkbox deprecated use html_writer::checkbox and separate JavaScript
efa5155a
RM
123
124To add filters, local plugins can now implement the function local_[pluginname]_get_question_bank_search_conditions,
125
17f229fa
RM
1262) To make columns available to question_bank_view, plugins can extend core_question\bank\column_base.
127 Users may choose to display additional columns by setting $CFG->questionbankcolumns to a comma-delimited list of columns.
128
1293) The subsort separator has changed from _ to - in order to distinuguish subsorts vs frankenstyle component separators.
130
1314) Because of the move to autoloading, $knowncolumntypes and known_field_types() are no longer used.
132
1335) question_bank_column_base and it's derived classes have been namespaced to core_question\bank\column_base.
d62382d1 134
16e246ac 135
181393aa
TH
136=== 2.6 ===
137
b07ef13b
DP
1381) Modules using the question bank MUST now declare their use of it with the xxx_supports()
139 flag FEATURE_USES_QUESTIONS. question_module_uses_questions() should be used to determine
140 if a module uses questions.
141
1422) It is sometimes necessary to display bits of question content without having
181393aa
TH
143 and attempt (question_usage) in progress. Two examples of this are the option
144 in the question bank to display the questiontext, and in the quiz statistics
145 report, where it displays the question text above the report.
146
147 Previously, this display was done using a special method that only worked for
148 the question text, but which would not work for other parts of the question.
149 That old mechanism has been deprecated, and there is a new method that you
150 should use.
151
152 To display the question, replace calls to question_rewrite_questiontext_preview_urls
153 with calls to question_rewrite_question_preview_urls. Because the new function
154 is more flexibile, you have to pass more arguments.
155
156 To perform the necessary permission checks when the file is downloaded, you need
157 to implement the callback [component name]_question_preview_pluginfile.
158 (Previously you implemented [component name]_questiontext_preview_pluginfile.)
159 quiz_statistics_question_preview_pluginfile is an example of what to do.
160
161 question_send_questiontext_file has been deprecated. It is no longer necessary.
162
163 To ensure you are no longer using or defining any deprecated functions,
164 search for the regular expression:
165 question_rewrite_questiontext_preview_urls|_questiontext_preview_pluginfile|question_send_questiontext_file
70f22d60 166
c2f35e0b
TH
1673) The argument list for core_question_renderer::mark_summary has changed.
168 Please update your calls. (The most likely scenario for this is if you have
169 overridden core_question_renderer::info in your own renderer.) You need to
170 make a change like:
171 - $this->mark_summary($qa, $options);
172 + $this->mark_summary($qa, $behaviouroutput, $options);