From 8c034eb928cc61258c865c9d865d9b68be63dbf7 Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Mon, 10 Aug 2009 14:17:29 +0000
Subject: [PATCH] Fixed: FS#839 - Webalizer stats are missing since
 cron_daily.php script does not look for .gz compressed files.

---
 server/cron_daily.php | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/server/cron_daily.php b/server/cron_daily.php
index 2cac46c9ca..0c650e4c5f 100644
--- a/server/cron_daily.php
+++ b/server/cron_daily.php
@@ -93,14 +93,18 @@ $records = $app->db->queryAllRecords($sql);
 foreach($records as $rec) {
 	$yesterday = date("Ymd",time() - 86400);
 	$logfile = escapeshellcmd($rec["document_root"].'/log/'.$yesterday.'-access.log');
-	if(@is_file($logfile)) {
-		$domain = escapeshellcmd($rec["domain"]);
-		$statsdir = escapeshellcmd($rec["document_root"].'/web/stats');
-		$webalizer = '/usr/bin/webalizer';
-		$webalizer_conf = '/etc/webalizer/webalizer.conf';
-		if(!@is_dir($statsdir)) mkdir($statsdir);
-		exec("$webalizer -c $webalizer_conf -n $domain -s $domain -r $domain -q -T -o $statsdir $logfile");
+	if(!@is_file($logfile)) {
+		$logfile = escapeshellcmd($rec["document_root"].'/log/'.$yesterday.'-access.log.gz');
+		if(!@is_file($logfile)) {
+			continue;
+		}
 	}
+	$domain = escapeshellcmd($rec["domain"]);
+	$statsdir = escapeshellcmd($rec["document_root"].'/web/stats');
+	$webalizer = '/usr/bin/webalizer';
+	$webalizer_conf = '/etc/webalizer/webalizer.conf';
+	if(!@is_dir($statsdir)) mkdir($statsdir);
+	exec("$webalizer -c $webalizer_conf -n $domain -s $domain -r $domain -q -T -p -o $statsdir $logfile");
 }
 
 #######################################################################################################
-- 
GitLab