Commit 4188c227 authored by Marius Burkard's avatar Marius Burkard
Browse files

- backported some more code from old vlogger

parent 5b051c99
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
# 1.4p2 implemented anonymization in error log part # 1.4p2 implemented anonymization in error log part
# 1.4p3 implemented stronger anonymization # 1.4p3 implemented stronger anonymization
# 1.4p4 implemented re-opening on externally rotated error.log # 1.4p4 implemented re-opening on externally rotated error.log
# 1.4p5 backported old ISPConfig changes (improved DBI error handling) # 1.4p5 backported old ISPConfig changes (improved DBI error handling, naming)
# #
# #
# TODO: # TODO:
...@@ -566,21 +566,21 @@ sub dump_tracker { ...@@ -566,21 +566,21 @@ sub dump_tracker {
my $dbh = DBI->connect( $DBI_DSN, $DBI_USER, $DBI_PASS ) my $dbh = DBI->connect( $DBI_DSN, $DBI_USER, $DBI_PASS )
or warn "DBI Error: $!"; or warn "DBI Error: $!";
foreach my $key ( keys(%tracker) ) { foreach my $key ( keys(%tracker) ) {
my $ts = time2str( "%m%d%Y", time() ); my $ts = time2str( "%Y-%m-%d", time() );
my $sth = my $sth =
$dbh->prepare( "select * from wwwusage where vhost='" . $key $dbh->prepare( "select * from web_traffic where hostname='" . $key
. "' and ldate='" . $ts . "'" ); . "' and traffic_date='" . $ts . "'" );
$sth->execute; $sth->execute;
if ( $sth->rows ) { if ( $sth->rows ) {
my $query = my $query =
"update wwwusage set bytes=bytes+" "update web_traffic set traffic_bytes=traffic_bytes+"
. $tracker{$key} . $tracker{$key}
. " where vhost='" . $key . " where hostname='" . $key
. "' and ldate='" . $ts . "'"; . "' and traffic_date='" . $ts . "'";
$dbh->do($query); $dbh->do($query);
} }
else { else {
my $query = "insert into wwwusage (vhost, ldate, bytes) values ('$key', '$ts', '$tracker{$key}')"; my $query = "insert into web_traffic (hostname, traffic_date, traffic_bytes) values ('$key', '$ts', '$tracker{$key}')";
$dbh->do($query); $dbh->do($query);
} }
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment