Merge branch 'MDL-37584-28' of git://github.com/ankitagarwal/moodle into MOODLE_28_STABLE
This commit is contained in:
@@ -28,6 +28,9 @@ namespace core\task;
|
||||
*/
|
||||
class send_failed_login_notifications_task extends scheduled_task {
|
||||
|
||||
/** The maximum time period to look back (30 days = 30 * 24 * 3600) */
|
||||
const NOTIFY_MAXIMUM_TIME = 2592000;
|
||||
|
||||
/**
|
||||
* Get a descriptive name for this task (shown to admins).
|
||||
*
|
||||
@@ -50,8 +53,10 @@ class send_failed_login_notifications_task extends scheduled_task {
|
||||
|
||||
$recip = get_users_from_config($CFG->notifyloginfailures, 'moodle/site:config');
|
||||
|
||||
if (empty($CFG->lastnotifyfailure)) {
|
||||
$CFG->lastnotifyfailure = 0;
|
||||
// Do not look back more than 1 month to avoid crashes due to huge number of records.
|
||||
$maximumlastnotifytime = time() - self::NOTIFY_MAXIMUM_TIME;
|
||||
if (empty($CFG->lastnotifyfailure) || ($CFG->lastnotifyfailure < $maximumlastnotifytime)) {
|
||||
$CFG->lastnotifyfailure = $maximumlastnotifytime;
|
||||
}
|
||||
|
||||
// If it has been less than an hour, or if there are no recipients, don't execute.
|
||||
|
||||
Reference in New Issue
Block a user