From: Rajesh Taneja Date: Fri, 30 Mar 2012 03:44:53 +0000 (+0800) Subject: MDL-30051 cron: login error sql is now cross db X-Git-Tag: v2.3.0-beta~801^2 X-Git-Url: http://git.moodle.org/gw?p=moodle.git;a=commitdiff_plain;h=a415ecc21cf7b4f2848fc86c1e5b35da98a0d96d MDL-30051 cron: login error sql is now cross db --- diff --git a/lib/cronlib.php b/lib/cronlib.php index 818a774bdc4..62d4348342e 100644 --- a/lib/cronlib.php +++ b/lib/cronlib.php @@ -646,7 +646,8 @@ function notify_login_failures() { // Now, select all the login error logged records belonging to the ips and infos // since lastnotifyfailure, that we have stored in the cache_flags table - $sql = "SELECT l.*, u.firstname, u.lastname + $sql = "SELECT * FROM ( + SELECT l.*, u.firstname, u.lastname FROM {log} l JOIN {cache_flags} cf ON l.ip = cf.name LEFT JOIN {user} u ON l.userid = u.id @@ -660,8 +661,8 @@ function notify_login_failures() { LEFT JOIN {user} u ON l.userid = u.id WHERE l.module = 'login' AND l.action = 'error' AND l.time > ? - AND cf.flagtype = 'login_failure_by_info' - ORDER BY time DESC"; + AND cf.flagtype = 'login_failure_by_info') t + ORDER BY t.time DESC"; $params = array($CFG->lastnotifyfailure, $CFG->lastnotifyfailure); // Init some variables