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
@@ -366,7 +366,7 @@ class manager {
}
// Record the user that this script is currently being run as. This is important when re-processing existing
// messages, as cron_setup_user is called multiple times.
// messages, as \core\cron::setup_user is called multiple times.
$originaluser = $USER;
$envelope = $message->getEnvelope();
@@ -433,7 +433,7 @@ class manager {
// Process the message as the user.
$user = $this->addressmanager->get_data()->user;
mtrace("-- Processing the message as user {$user->id} ({$user->username}).");
cron_setup_user($user);
\core\cron::setup_user($user);
// Process and retrieve the message data for this message.
// This includes fetching the full content, as well as all headers, and attachments.
@@ -459,7 +459,7 @@ class manager {
// Returning to normal cron user.
mtrace("-- Returning to the original user.");
cron_setup_user($originaluser);
\core\cron::setup_user($originaluser);
return;
}
@@ -478,7 +478,7 @@ class manager {
// Returning to normal cron user.
mtrace("-- Returning to the original user.");
cron_setup_user($originaluser);
\core\cron::setup_user($originaluser);
return;
} catch (\Exception $e) {
// An unknown error occurred. The user is not informed, but the administrator is.
@@ -487,7 +487,7 @@ class manager {
// Returning to normal cron user.
mtrace("-- Returning to the original user.");
cron_setup_user($originaluser);
\core\cron::setup_user($originaluser);
return;
}
@@ -501,7 +501,7 @@ class manager {
// Returning to normal cron user.
mtrace("-- Returning to the original user.");
cron_setup_user($originaluser);
\core\cron::setup_user($originaluser);
mtrace("-- Finished processing " . $message->getUid());