From 0b50f8f4d7f2dc23a1886599b2f14d70eaa8d705 Mon Sep 17 00:00:00 2001
From: Till Brehm <tbrehm@ispconfig.org>
Date: Mon, 06 Jan 2014 04:25:04 -0500
Subject: [PATCH] Merge branch 'master' of /home/git/repositories/Schoene/ispconfig3

---
 server/lib/classes/cron.d/150-awstats.inc.php |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/server/lib/classes/cron.d/150-awstats.inc.php b/server/lib/classes/cron.d/150-awstats.inc.php
index 7c59b57..5b54a18 100644
--- a/server/lib/classes/cron.d/150-awstats.inc.php
+++ b/server/lib/classes/cron.d/150-awstats.inc.php
@@ -100,11 +100,20 @@
 			}
 
 			if(!is_file($awstats_website_conf_file)) {
-				$awstats_conf_file_content = 'Include "'.$awstats_conf_dir.'/awstats.conf"
+				if (is_file($awstats_conf_dir."/awstats.conf")) {
+                                	$include_file = $awstats_conf_dir."/awstats.conf";
+				} elseif (is_file($awstats_conf_dir."/awstats.model.conf")) {
+					$include_file = $awstats_conf_dir."/awstats.model.conf";
+				}
+				$awstats_conf_file_content = 'Include "'.$include_file.'"
         LogFile="/var/log/ispconfig/httpd/'.$domain.'/yesterday-access.log"
         SiteDomain="'.$domain.'"
         HostAliases="www.'.$domain.' localhost 127.0.0.1'.$aliasdomain.'"';
-				file_put_contents($awstats_website_conf_file, $awstats_conf_file_content);
+				if (isset($include_file)) {
+					file_put_contents($awstats_website_conf_file, $awstats_conf_file_content);
+				} else {
+					$app->log("No awstats base config found. Either awstats.conf or awstats.model.conf must exist in ".$awstats_conf_dir.".", LOGLEVEL_WARN);
+				}
 			}
 
 			if(!@is_dir($statsdir)) mkdir($statsdir);

--
Gitblit v1.9.1