MDL-79747 quiz stats: task should run as admin the right way

The correct way to get an ad-hoc task to run as the main admin account
is to leave userid as null.

Setting it causes fatal errors if the main admin account is set to
auth: nologin.
This commit is contained in:
Tim Hunt
2023-10-17 16:38:44 +01:00
parent 23b86254d3
commit ec0c4e18ad
@@ -47,7 +47,6 @@ class recalculate extends \core\task\adhoc_task {
public static function instance(int $quizid): recalculate {
$task = new self();
$task->set_component('quiz_statistics');
$task->set_userid(get_admin()->id);
$task->set_custom_data((object)[
'quizid' => $quizid,
]);