From 4e6fbf663cef70f8d9e7985fc8f79eee1cda9e88 Mon Sep 17 00:00:00 2001 From: Eric Merrill Date: Wed, 6 Jun 2012 12:04:03 -0400 Subject: [PATCH] MDL-32985 cron: Fixing related problem with setting of lastnotifyfailure Because of a flaw in the logic, lastnotifyfailure was not set unless there was a failure. This means that after 1 hour of no failures, the function would execute every cron cycle, which has a pretty high cost on large sites. --- lib/cronlib.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/cronlib.php b/lib/cronlib.php index 86650c40a1c..1f1bddeba74 100644 --- a/lib/cronlib.php +++ b/lib/cronlib.php @@ -702,11 +702,11 @@ function notify_login_failures() { //emailing the admins directly rather than putting these through the messaging system email_to_user($admin,get_admin(), $subject, $body); } - - // Update lastnotifyfailure with current time - set_config('lastnotifyfailure', time()); } + // Update lastnotifyfailure with current time + set_config('lastnotifyfailure', time()); + // Finally, delete all the temp records we have created in cache_flags $DB->delete_records_select('cache_flags', "flagtype IN ('login_failure_by_ip', 'login_failure_by_info')");