Permalink
Browse files

MDL-30051 cron: login error sql is now cross db

  • Loading branch information...
1 parent c54172b commit 8f343c64f6d621b9c34778c698a4630afb7278e8 Rajesh Taneja committed Mar 30, 2012
Showing with 4 additions and 3 deletions.
  1. +4 −3 lib/moodlelib.php
View
@@ -8166,7 +8166,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
@@ -8180,8 +8181,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

0 comments on commit 8f343c6

Please sign in to comment.