From a031b0f334e0529c4ff77035d15565b8cd164df9 Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Thu, 5 Apr 2012 17:26:44 +0100 Subject: [PATCH] MDL-32347 questions: API improvement for the benefit of strict syntax. --- question/type/questiontypebase.php | 4 ++-- question/type/upgrade.txt | 33 +++++++++++++++++------------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/question/type/questiontypebase.php b/question/type/questiontypebase.php index 8bf911f05d0..713b2478f74 100644 --- a/question/type/questiontypebase.php +++ b/question/type/questiontypebase.php @@ -906,7 +906,7 @@ class question_type { * Imports question using information from extra_question_fields function * If some of you fields contains id's you'll need to reimplement this */ - public function import_from_xml($data, $question, $format, $extra=null) { + public function import_from_xml($data, $question, qformat_xml $format, $extra=null) { $question_type = $data['@']['type']; if ($question_type != $this->name()) { return false; @@ -959,7 +959,7 @@ class question_type { * Export question using information from extra_question_fields function * If some of you fields contains id's you'll need to reimplement this */ - public function export_to_xml($question, $format, $extra=null) { + public function export_to_xml($question, qformat_xml $format, $extra=null) { $extraquestionfields = $this->extra_question_fields(); if (!is_array($extraquestionfields)) { return false; diff --git a/question/type/upgrade.txt b/question/type/upgrade.txt index 056112ef972..0281c6f08a0 100644 --- a/question/type/upgrade.txt +++ b/question/type/upgrade.txt @@ -1,18 +1,12 @@ This files describes API changes for question type plugins. -=== 2.0 === +=== 2.3 === -* Lots of changes due to all the API changes in Moodle 2.0. - -* This plugin type now supports cron in the standard way. If required, Create a - lib.php file containing -function qtype_mypluginname_cron() {}; - - -=== 2.1 === - -* Lots of API changes due to the new question engine. See -http://docs.moodle.org/dev/Developing_a_Question_Type#Converting_a_Moodle_2.0_question_type +* Support for backwards-compatible string names dropped. MDL-30120. (See under 2.2 below.) +* If you are overriding export_to_xml and import_from_xml to provide Moodle XML format + import and export, then you will probably get PHP strict syntax notices in developer + debug mode until you change the method signature to include qformat_xml $format. + That is, you need to specify the argument type. === 2.2 === @@ -59,6 +53,17 @@ The old strings will continue to work, but only until Moodle 2.3 is released. methods. (This is required so that backup and restore can be made to work automatically. MDL-24408, MDL-25617, MDL-30562) -=== 2.3 === -* Support for backwards-compatible string names dropped. MDL-30120. (See under 2.2 above.) +=== 2.1 === + +* Lots of API changes due to the new question engine. See +http://docs.moodle.org/dev/Developing_a_Question_Type#Converting_a_Moodle_2.0_question_type + + +=== 2.0 === + +* Lots of changes due to all the API changes in Moodle 2.0. + +* This plugin type now supports cron in the standard way. If required, Create a + lib.php file containing +function qtype_mypluginname_cron() {};