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:40 +01:00
parent d188d58ce9
commit f6e7eb2ebd

View File

@ -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,
]);