MDL-77186 core: Move all uses of cronlib to new class

This commit is contained in:
Andrew Nicols
2023-03-13 21:21:13 +08:00
parent 99a67b615f
commit 9ec46c232d
36 changed files with 73 additions and 92 deletions
@@ -53,11 +53,11 @@ class course_delete_modules extends \core\task\adhoc_task {
// Set the proper user.
if ($this->get_custom_data()->userid !== $this->get_custom_data()->realuserid) {
$realuser = \core_user::get_user($this->get_custom_data()->realuserid, '*', MUST_EXIST);
cron_setup_user($realuser);
\core\cron::setup_user($realuser);
\core\session\manager::loginas($this->get_custom_data()->userid, \context_system::instance(), false);
} else {
$user = \core_user::get_user($this->get_custom_data()->userid, '*', MUST_EXIST);
cron_setup_user($user);
\core\cron::setup_user($user);
}
$cms = $this->get_custom_data()->cms;