From a58fefb902e5711561aba06060e58a69103e9c47 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Thu, 11 Oct 2012 11:33:36 +0200 Subject: [PATCH] =?UTF-8?q?Champs=20date=5Fday=20et=20date=5Ftime=20s?= =?UTF-8?q?=C3=A9par=C3=A9=20au=20lieu=20du=20timestamp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mail_log.sql | 3 ++- root/usr/share/qpsmtpd/plugins/logging/log2sql | 13 ++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/mail_log.sql b/mail_log.sql index e6060ee..14071da 100644 --- a/mail_log.sql +++ b/mail_log.sql @@ -1,6 +1,7 @@ CREATE TABLE `messages` ( `mail_id` varchar(255) NOT NULL default '', - `time` int(11) default '0', + `date_day` date, + `date_time` time, `remote_ip` varchar(255) default NULL, `remote_host` varchar(255) default NULL, `remote_info` varchar(255) default NULL, diff --git a/root/usr/share/qpsmtpd/plugins/logging/log2sql b/root/usr/share/qpsmtpd/plugins/logging/log2sql index 1421dee..3a795fe 100644 --- a/root/usr/share/qpsmtpd/plugins/logging/log2sql +++ b/root/usr/share/qpsmtpd/plugins/logging/log2sql @@ -4,10 +4,13 @@ # By Todor Todorov # # http://www.geocities.com/tttodorov/ # # VERSION 0.06 # -# Last modified 2005/02/22 # +# Last modified 2012/10/11 # +# Edit by Daniel Berteaud # +# # ##################################################### use DBI; +use DateTime; use strict; #plugin level variables are here since version 0.02 @@ -65,12 +68,16 @@ $transaction->notes('log2sql_mail_id', $mail_id); # quote the mail_id for later use: $mail_id = $dbh->quote($mail_id); +my $dt = DateTime->now; + my($statement) = "INSERT INTO ".$mail_table." (mail_id,". - $mail_table.".time,". + $mail_table.".date_day,". + $mail_table.".date_time,". "remote_ip,remote_host,remote_info) ". "VALUES(". $mail_id.",". - $dbh->quote(time).",". + $dbh->quote($dt->ymd).",". + $dbh->quote($dt->hms).",". $dbh->quote($self->qp->connection->remote_ip).",". $dbh->quote($self->qp->connection->remote_host).",". $dbh->quote($self->qp->connection->remote_info).")";