From 19f7bb5b7e5eb732767199dd72fb6bf981f6482d Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Mon, 27 Jun 2011 13:59:57 +0100 Subject: [PATCH] MDL-28049 conditional include so xml question format can work for both lesson and 3rd party qtypes. This is a regression caused by MDL-27956. --- question/format/xml/format.php | 8 ++++++++ question/format/xml/simpletest/testxmlformat.php | 1 - 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/question/format/xml/format.php b/question/format/xml/format.php index 21821a0483e..ca1af3a74ee 100644 --- a/question/format/xml/format.php +++ b/question/format/xml/format.php @@ -27,6 +27,14 @@ defined('MOODLE_INTERNAL') || die(); require_once($CFG->libdir . '/xmlize.php'); +if (!class_exists('qformat_default')) { + // This is ugly, but this class is also (ab)used by mod/lesson, which defines + // a different base class in mod/lesson/format.php. Thefore, we can only + // include the proper base class conditionally like this. (We have to include + // the base class like this, otherwise it breaks third-party question types.) + // This may be reviewd, and a better fix found one day. + require_once($CFG->dirroot . '/question/format.php'); +} /** diff --git a/question/format/xml/simpletest/testxmlformat.php b/question/format/xml/simpletest/testxmlformat.php index d45afd2b2db..9ab295fac37 100644 --- a/question/format/xml/simpletest/testxmlformat.php +++ b/question/format/xml/simpletest/testxmlformat.php @@ -27,7 +27,6 @@ defined('MOODLE_INTERNAL') || die(); require_once($CFG->libdir . '/questionlib.php'); -require_once($CFG->dirroot . '/question/format.php'); require_once($CFG->dirroot . '/question/format/xml/format.php');