Skip to content

Replace deprecated cron_setup_user() call #43

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ function hsuforum_cron() {
$userto->markposts = array();

// Set this so that the capabilities are cached, and environment matches receiving user.
cron_setup_user($userto);
\core\cron::setup_user($userto);

// Reset the caches.
foreach ($coursemodules as $forumid => $unused) {
Expand Down Expand Up @@ -673,7 +673,7 @@ function hsuforum_cron() {
// Note: If we want to check that userto and userfrom are not the same person this is probably the spot to do it.

// Setup global $COURSE properly - needed for roles and languages.
cron_setup_user($userto, $course);
\core\cron::setup_user($userto, $course);

// Fill caches.
if (!isset($userto->viewfullnames[$forum->id])) {
Expand Down Expand Up @@ -887,7 +887,7 @@ function hsuforum_cron() {
unset($mailcount);
unset($errorcount);

cron_setup_user();
\core\cron::setup_user();

$sitetimezone = core_date::get_server_timezone();

Expand Down Expand Up @@ -976,7 +976,7 @@ function hsuforum_cron() {

core_php_time_limit::raise(120); // terminate if processing of any account takes longer than 2 minutes

cron_setup_user();
\core\cron::setup_user();

mtrace(get_string('processingdigest', 'hsuforum', $userid), '... ');

Expand All @@ -997,7 +997,7 @@ function hsuforum_cron() {

// Override the language and timezone of the "current" user, so that
// mail is customised for the receiver.
cron_setup_user($userto);
\core\cron::setup_user($userto);

$postsubject = get_string('digestmailsubject', 'hsuforum', format_string($site->shortname, true));

Expand All @@ -1021,7 +1021,7 @@ function hsuforum_cron() {
$cm = $coursemodules[$forum->id];

//override language
cron_setup_user($userto, $course);
\core\cron::setup_user($userto, $course);

// Fill caches
if (!isset($userto->viewfullnames[$forum->id])) {
Expand Down Expand Up @@ -1200,7 +1200,7 @@ function hsuforum_cron() {
$config->digestmailtimelast = $timenow;
}

cron_setup_user();
\core\cron::setup_user();

if (!empty($usermailcount)) {
mtrace(get_string('digestsentusers', 'hsuforum', $usermailcount));
Expand Down