Fixed mailparser ignoring last day of year

Signed-off-by: Roman Schmerold (BNoiZe) <bnoize@froxlor.org>
This commit is contained in:
Roman Schmerold (BNoiZe)
2014-01-05 18:16:55 +01:00
parent d5df53bb60
commit d9a5f052a1

View File

@@ -249,8 +249,6 @@ class MailLogParser {
* @param int traffic
*/
private function _addDomainTraffic($domain, $traffic, $timestamp) {
if ($timestamp < ($this->startTime + 60 * 60 * 24)) {
// Only add traffic if it's not in the future!
$date = date("Y-m-d", $timestamp);
if (in_array($domain, $this->myDomains)) {
if (array_key_exists($domain, $this->domainTraffic) && array_key_exists($date, $this->domainTraffic[$domain])) {
@@ -264,8 +262,6 @@ class MailLogParser {
}
}
}
/**
* getLogTimestamp
@@ -274,7 +270,12 @@ class MailLogParser {
*/
private function _getLogTimestamp($line) {
if (preg_match("/((?:[A-Z]{3}\s{1,2}\d{1,2}|\d{4}-\d{2}-\d{2}) \d{2}:\d{2}:\d{2})/i", $line, $matches)) {
$timestamp = strtotime($matches[1]);
if ($timestamp > ($this->startTime + 60 * 60 * 24)) {
return strtotime($matches[1] . " -1 year");
} else {
return strtotime($matches[1]);
}
} else {
return 0;
}