Skip to content

Commit

Permalink
fix cron failure of unable to print #179
Browse files Browse the repository at this point in the history
  • Loading branch information
isuru89 committed Apr 2, 2024
1 parent 47d6bfa commit a0b0d98
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
8 changes: 4 additions & 4 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
* ======== CONSTANTS ==========================================
*/

define('REMINDERS_DAYIN_SECONDS', 24 * 3600);
define('REMINDERS_DAYIN_SECONDS', 24 * 3600 * 7);

define('REMINDERS_FIRST_CRON_CYCLE_CUTOFF_DAYS', 1);

Expand Down Expand Up @@ -401,11 +401,11 @@ function local_reminders_cron_pre($currtime, $timewindowstart) {
$mailresult = message_send($eventdata);

if (!$mailresult) {
mtrace("Could not send out message for event#$event->id to user $eventdata->userto");
mtrace("Could not send out reminder for event#$event->id to user $touser->id");
} else {
mtrace('[LOCAL_REMINDERS] Mail Result: '.$mailresult);
mtrace('[LOCAL_REMINDERS] Mail successfully sent to user: '.$touser->id);
}
} catch (\Exception $mex) {
} catch (\Throwable $mex) {
$failedcount++;
mtrace('Error: local/reminders/lib.php local_reminders_cron(): '.$mex->getMessage());
}
Expand Down
7 changes: 4 additions & 3 deletions locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -252,12 +252,13 @@ function send_overdue_activity_reminders($curtime, $timewindowstart, $activityro
$eventdata = $reminderref->get_updating_send_event(REMINDERS_CALL_TYPE_OVERDUE, $fromuser, $touser, $ctxinfo);

$mailresult = message_send($eventdata);
mtrace('[LOCAL_REMINDERS] Post Activity Mail Result: '.$mailresult);

if (!$mailresult) {
mtrace("[LOCAL REMINDERS] Could not send out message for event#$event->id to user $eventdata->userto");
mtrace("[LOCAL REMINDERS] Could not send out reminder for event#$event->id to user $touser->id");
} else {
mtrace('[LOCAL_REMINDERS] Post Activity Mail sent to user: '.$touser->id);
}
} catch (\Exception $mex) {
} catch (\Throwable $mex) {
mtrace('[LOCAL REMINDERS] Error: local/reminders/locallib.php send_post_activity_reminders(): '.$mex->getMessage());
}
}
Expand Down
4 changes: 2 additions & 2 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@

defined('MOODLE_INTERNAL') || die();

$plugin->version = 2024011200;
$plugin->version = 2024040200;
$plugin->requires = 2018051700; // Require moodle 3.5 or higher.
$plugin->release = '2.7.1';
$plugin->release = '2.7.2';
$plugin->maturity = MATURITY_STABLE;
$plugin->component = 'local_reminders';

0 comments on commit a0b0d98

Please sign in to comment.