From a464e1f42fd73ae080df752c6a1c1a57d73deb43 Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Wed, 03 Oct 2012 05:49:21 -0400
Subject: [PATCH] Fixed: FS#2417 - Custom awstats_index.php.master
---
server/plugins-available/apache2_plugin.inc.php | 6 +++++-
server/plugins-available/nginx_plugin.inc.php | 6 +++++-
server/cron_daily.php | 10 ++++++++--
3 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/server/cron_daily.php b/server/cron_daily.php
index 7c91a46..9420a05 100644
--- a/server/cron_daily.php
+++ b/server/cron_daily.php
@@ -39,7 +39,7 @@
// Load required base-classes
-$app->uses('ini_parser,file,services,getconf');
+$app->uses('ini_parser,file,services,getconf,system');
#######################################################################################################
@@ -238,7 +238,13 @@
exec($command);
if(is_file($rec['document_root'].'/'.$web_folder.'/stats/index.html')) unlink($rec['document_root'].'/'.$web_folder.'/stats/index.html');
rename($rec['document_root'].'/'.$web_folder.'/stats/awstats.'.$domain.'.html',$rec['document_root'].'/'.$web_folder.'/stats/awsindex.html');
- if(!is_file($rec['document_root']."/".$web_folder."/stats/index.php")) copy("/usr/local/ispconfig/server/conf/awstats_index.php.master",$rec['document_root']."/".$web_folder."/stats/index.php");
+ if(!is_file($rec['document_root']."/".$web_folder."/stats/index.php")) {
+ if(file_exists("/usr/local/ispconfig/server/conf-custom/awstats_index.php.master")) {
+ copy("/usr/local/ispconfig/server/conf-custom/awstats_index.php.master",$rec['document_root']."/".$web_folder."/stats/index.php");
+ } else {
+ copy("/usr/local/ispconfig/server/conf/awstats_index.php.master",$rec['document_root']."/".$web_folder."/stats/index.php");
+ }
+ }
$app->log('Created awstats statistics with command: '.$command,LOGLEVEL_DEBUG);
} else {
diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php
index 45134fe..ae5ce80 100644
--- a/server/plugins-available/apache2_plugin.inc.php
+++ b/server/plugins-available/apache2_plugin.inc.php
@@ -2271,7 +2271,11 @@
}
if(is_file($data['new']['document_root']."/" . $web_folder . "/stats/index.html")) $app->system->unlink($data['new']['document_root']."/" . $web_folder . "/stats/index.html");
- $app->system->copy("/usr/local/ispconfig/server/conf/awstats_index.php.master",$data['new']['document_root']."/" . $web_folder . "/stats/index.php");
+ if(file_exists("/usr/local/ispconfig/server/conf-custom/awstats_index.php.master")) {
+ $app->system->copy("/usr/local/ispconfig/server/conf-custom/awstats_index.php.master",$data['new']['document_root']."/" . $web_folder . "/stats/index.php");
+ } else {
+ $app->system->copy("/usr/local/ispconfig/server/conf/awstats_index.php.master",$data['new']['document_root']."/" . $web_folder . "/stats/index.php");
+ }
}
//* Delete the awstats configuration file
diff --git a/server/plugins-available/nginx_plugin.inc.php b/server/plugins-available/nginx_plugin.inc.php
index ef376e0..2e76d4c 100644
--- a/server/plugins-available/nginx_plugin.inc.php
+++ b/server/plugins-available/nginx_plugin.inc.php
@@ -1792,7 +1792,11 @@
}
if(is_file($data['new']['document_root']."/" . $web_folder . "/stats/index.html")) $app->system->unlink($data['new']['document_root']."/" . $web_folder . "/stats/index.html");
- $app->system->copy("/usr/local/ispconfig/server/conf/awstats_index.php.master",$data['new']['document_root']."/" . $web_folder . "/stats/index.php");
+ if(file_exists("/usr/local/ispconfig/server/conf-custom/awstats_index.php.master")) {
+ $app->system->copy("/usr/local/ispconfig/server/conf-custom/awstats_index.php.master",$data['new']['document_root']."/" . $web_folder . "/stats/index.php");
+ } else {
+ $app->system->copy("/usr/local/ispconfig/server/conf/awstats_index.php.master",$data['new']['document_root']."/" . $web_folder . "/stats/index.php");
+ }
}
//* Delete the awstats configuration file
--
Gitblit v1.9.1