From 2e0b6d9b26f26fa3f7cbb3a0be1c832d2a949955 Mon Sep 17 00:00:00 2001 From: Stephan Robotta Date: Thu, 28 Nov 2024 18:04:56 +0100 Subject: [PATCH] Fix missing class question_bank version independent by requiring the correct file. --- classes/plugininfo.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/classes/plugininfo.php b/classes/plugininfo.php index 3cc6987..4949d27 100644 --- a/classes/plugininfo.php +++ b/classes/plugininfo.php @@ -76,6 +76,7 @@ public static function get_plugin_configuration_for_context( array $fpoptions, ?editor $editor = null ): array { + global $CFG; // When on the test site, check that the simulation config for an existing regex question type is set. if (\behat_util::is_test_site()) { @@ -90,10 +91,9 @@ public static function get_plugin_configuration_for_context( 'multianswerrgx' => false, ]; - // In Moodle 4.1 in /user/editadvanced.php the class question_bank is not found. So - // multianswerrgx is not supported with 4.1. - if (moodle_major_version() < 4.2) { - return $config; + // The class question_bank is not found at times. Therefore check and include the file. + if (!class_exists('question_bank')) { + require_once($CFG->dirroot . '/question/engine/bank.php'); } try {