From 56565037dddc68f1c1185002c1384c16bbd1a84a Mon Sep 17 00:00:00 2001 From: Valeriy Streltsov Date: Sun, 4 Dec 2011 00:13:59 +0400 Subject: [PATCH] MDL-30562 qtypes: extra_answer_fields & questionid_column_name public Will let us make more of qtype backup and restore work automatically. --- question/type/questiontypebase.php | 4 ++-- question/type/shortanswer/questiontype.php | 2 +- question/type/upgrade.txt | 5 +++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/question/type/questiontypebase.php b/question/type/questiontypebase.php index 5e76deb5fdb80..ba8858dea4796 100644 --- a/question/type/questiontypebase.php +++ b/question/type/questiontypebase.php @@ -165,7 +165,7 @@ public function extra_question_fields() { * If you use extra_question_fields, overload this function to return question id field name * in case you table use another name for this column */ - protected function questionid_column_name() { + public function questionid_column_name() { return 'questionid'; } @@ -176,7 +176,7 @@ protected function questionid_column_name() { * * @return mixed array as above, or null to tell the base class to do nothing. */ - protected function extra_answer_fields() { + public function extra_answer_fields() { return null; } diff --git a/question/type/shortanswer/questiontype.php b/question/type/shortanswer/questiontype.php index b43e3ee59c65c..ff9df64f76388 100644 --- a/question/type/shortanswer/questiontype.php +++ b/question/type/shortanswer/questiontype.php @@ -42,7 +42,7 @@ public function extra_question_fields() { return array('question_shortanswer', 'answers', 'usecase'); } - protected function questionid_column_name() { + public function questionid_column_name() { return 'question'; } diff --git a/question/type/upgrade.txt b/question/type/upgrade.txt index aaf221306018f..acaacd322a1be 100644 --- a/question/type/upgrade.txt +++ b/question/type/upgrade.txt @@ -38,3 +38,8 @@ $string['pluginnameediting'] = 'Editing a Description'; $string['pluginnamesummary'] = 'This is not actually a question. Instead it is a way to add some instructions, rubric or other content to the activity. This is similar to the way that labels can be used to add content to the course page.'; The old strings will continue to work, but only until Moodle 2.3 is released. + +* If you are using the facilities provided by overriding the extra_answer_fields + or questionid_column_name methods, then you must change these to be public + methods. (This is required so that backup and restore can be made to work + automatically. MDL-24408, MDL-25617, MDL-30562)