Merge branch 'MDL-62993_master' of git://github.com/markn86/moodle
[moodle.git] / question / upgrade.txt
blobf34bd6a46265226f80c8ab63b661619db006ca8c
1 This files describes API changes for code that uses the question API.
3 === 3.5 ===
5 1) The question format exportprocess function now adds a
6    $checkcapabilities boolean to allow questions to be exported in
7    certain circumstances.
9 === 3.2 ===
11 1) The following renderers have been deprecated in favour of the renderable
12    core_question\output\qbank_chooser and associated render_* method.
13     * qbank_chooser
14     * qbank_chooser_types
15     * qbank_chooser_qtype
16     * qbank_chooser_title
18 === 3.1 ===
20 1) The argument $requirecourseid was removed from question_edit_setup() and
21    is no longer respected. The behaviour was found to be buggy and now throws
22    debugging notices if passed.
24 === 2.9 ===
26 1) Some functions in questionlib.php which were deprecated in the past have now
27    been deleted:
29    Deprecated since 2.1
30     * question_list_instances
31     * get_grade_options
32     * question_category_isused
33     * save_question_options
34     * question_get_real_state
36    Deprecated since 2.6
37     * question_rewrite_questiontext_preview_urls
38     * question_send_questiontext_file
39     * question_pluginfile no longer falls back to using the old
40       {$previewcomponent}_questiontext_preview_pluginfile callback if the new
41       {$previewcomponent}_question_preview_pluginfile callback is missing.
44 === 2.8 ===
46 1) This is just a warning that some methods of the question_engine_data_mapper
47    class have changed. All these methods are ones that you should not have been
48    calling directly from your code, so this should not cause any problems.
49    The changed methods are:
50     * insert_question_attempt
51     * insert_step_data
52     * update_question_attempt_step
55 === 2.7 ===
57 1)  Changes to class question_bank_view:
59     Filters, including $recurse and $showhidden, are now implemented as
60     pluggable \core_question\bank\search\condition classes.
62     Therefore $recurse and $showhidden are no longer passed to the following functions:
63         protected function display_options [deprecated, use display_options_form()]
64         protected function build_query_sql [deprecated, use build_query()]
66     protected function display_category_form() is deprecated. Use \core_question\bank\search\category_condition
68     protected function display_category_form_checkbox deprecated use html_writer::checkbox and separate JavaScript
70 To add filters, local plugins can now implement the function local_[pluginname]_get_question_bank_search_conditions,
72 2) To make columns available to question_bank_view, plugins can extend core_question\bank\column_base.
73    Users may choose to display additional columns by setting $CFG->questionbankcolumns to a comma-delimited list of columns.
75 3) The subsort separator has changed from _ to - in order to distinuguish subsorts vs frankenstyle component separators.
77 4) Because of the move to autoloading, $knowncolumntypes and known_field_types() are no longer used.
79 5) question_bank_column_base and it's derived classes have been namespaced to core_question\bank\column_base.
82 === 2.6 ===
84 1) Modules using the question bank MUST now declare their use of it with the xxx_supports()
85    flag FEATURE_USES_QUESTIONS. question_module_uses_questions() should be used to determine
86    if a module uses questions.
88 2) It is sometimes necessary to display bits of question content without having
89    and attempt (question_usage) in progress. Two examples of this are the option
90    in the question bank to display the questiontext, and in the quiz statistics
91    report, where it displays the question text above the report.
93    Previously, this display was done using a special method that only worked for
94    the question text, but which would not work for other parts of the question.
95    That old mechanism has been deprecated, and there is a new method that you
96    should use.
98    To display the question, replace calls to question_rewrite_questiontext_preview_urls
99    with calls to question_rewrite_question_preview_urls. Because the new function
100    is more flexibile, you have to pass more arguments.
102    To perform the necessary permission checks when the file is downloaded, you need
103    to implement the callback [component name]_question_preview_pluginfile.
104    (Previously you implemented [component name]_questiontext_preview_pluginfile.)
105    quiz_statistics_question_preview_pluginfile is an example of what to do.
107    question_send_questiontext_file has been deprecated. It is no longer necessary.
109    To ensure you are no longer using or defining any deprecated functions,
110    search for the regular expression:
111    question_rewrite_questiontext_preview_urls|_questiontext_preview_pluginfile|question_send_questiontext_file
113 3) The argument list for core_question_renderer::mark_summary has changed.
114    Please update your calls. (The most likely scenario for this is if you have
115    overridden core_question_renderer::info in your own renderer.) You need to
116    make a change like:
117    - $this->mark_summary($qa, $options);
118    + $this->mark_summary($qa, $behaviouroutput, $options);