From e4db4343ca594e641dbe2c66c62b166fd4c8d849 Mon Sep 17 00:00:00 2001 From: Philipp Memmel Date: Mon, 4 Mar 2024 13:04:36 +0000 Subject: [PATCH] Fix requiring of constants in locallib --- classes/task/distribute_unallocated_task.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/classes/task/distribute_unallocated_task.php b/classes/task/distribute_unallocated_task.php index 6f131caa..b0737b84 100644 --- a/classes/task/distribute_unallocated_task.php +++ b/classes/task/distribute_unallocated_task.php @@ -45,7 +45,10 @@ class distribute_unallocated_task extends adhoc_task { * @throws moodle_exception */ public function execute(): void { - global $DB; + global $CFG, $DB; + // Make sure to include the global definitions of constants defined in locallib. + require_once($CFG->dirroot . '/mod/ratingallocate/locallib.php'); + $data = $this->get_custom_data(); if (empty($data->distributionalgorithm) || !in_array($data->distributionalgorithm, [ACTION_DISTRIBUTE_UNALLOCATED_EQUALLY, ACTION_DISTRIBUTE_UNALLOCATED_FILL])) {