From 542c0f59b264177f1fe9f6e97dceb1507adae2b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antoine=20Beaupr=EF=BF=BD=EF=BF=BD?= Date: Thu, 27 Nov 2014 18:54:44 +0000 Subject: [PATCH] improve lastlogin performance by using indexes, closes #1633, patch by lelutin --- src/popimap-log-login.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/popimap-log-login.sh b/src/popimap-log-login.sh index 62d0e998..f1679254 100755 --- a/src/popimap-log-login.sh +++ b/src/popimap-log-login.sh @@ -15,7 +15,10 @@ if [ ! -r "$ALTERNC_CONFIG_FILE" ]; then fi . "$ALTERNC_CONFIG_FILE" -mysql_query "update address a, domaines d, mailbox m set m.lastlogin=now() where a.domain_id=d.id and m.address_id=a.id and concat_ws('@',a.address,d.domaine) = '$USER';" +addr=$(echo $USER | sed 's/@.*//') +dom=$(echo $USER | sed 's/^.*@//') + +mysql_query "update address a, domaines d, mailbox m set m.lastlogin=now() where a.domain_id=d.id and m.address_id=a.id and a.address='$addr' and d.domaine='$dom';" # Now launch the expected binary server exec "$@"