MDL-32985 cron: prevent notices on "new" sites.
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Tue, 5 Jun 2012 00:14:13 +0000 (02:14 +0200)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Tue, 5 Jun 2012 00:14:13 +0000 (02:14 +0200)
lib/cronlib.php

index 758d1d5..b79057d 100644 (file)
@@ -614,15 +614,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.