Skip to content

Commit

Permalink
Fix missing class question_bank version independent by requiring the …
Browse files Browse the repository at this point in the history
…correct file.
  • Loading branch information
srobotta committed Nov 28, 2024
1 parent 699d8ae commit 2e0b6d9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions classes/plugininfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand All @@ -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 {
Expand Down

0 comments on commit 2e0b6d9

Please sign in to comment.