MDL-32985 cron: prevent notices on "new" sites.

This commit is contained in:
Eloy Lafuente (stronk7)
2012-06-05 02:15:49 +02:00
parent 8b01dd9d0f
commit 5d0c60f882
+4 -4
View File
@@ -605,15 +605,15 @@ function notify_login_failures() {
$recip = get_users_from_config($CFG->notifyloginfailures, 'moodle/site:config');
if (empty($CFG->lastnotifyfailure)) {
$CFG->lastnotifyfailure=0;
}
// If it has been less than an hour, or if there are no recipients, don't execute.
if (((time() - HOURSECS) < $CFG->lastnotifyfailure) || !is_array($recip) || count($recip) <= 0) {
return false;
}
if (empty($CFG->lastnotifyfailure)) {
$CFG->lastnotifyfailure=0;
}
// we need to deal with the threshold stuff first.
if (empty($CFG->notifyloginthreshold)) {
$CFG->notifyloginthreshold = 10; // default to something sensible.