Skip to content

Commit a464e1f

Browse files
committed
Fixed: FS#2417 - Custom awstats_index.php.master
1 parent 7799e8a commit a464e1f

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

server/cron_daily.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939

4040

4141
// Load required base-classes
42-
$app->uses('ini_parser,file,services,getconf');
42+
$app->uses('ini_parser,file,services,getconf,system');
4343

4444

4545
#######################################################################################################
@@ -238,7 +238,13 @@ function setConfigVar( $filename, $varName, $varValue ) {
238238
exec($command);
239239
if(is_file($rec['document_root'].'/'.$web_folder.'/stats/index.html')) unlink($rec['document_root'].'/'.$web_folder.'/stats/index.html');
240240
rename($rec['document_root'].'/'.$web_folder.'/stats/awstats.'.$domain.'.html',$rec['document_root'].'/'.$web_folder.'/stats/awsindex.html');
241-
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");
241+
if(!is_file($rec['document_root']."/".$web_folder."/stats/index.php")) {
242+
if(file_exists("/usr/local/ispconfig/server/conf-custom/awstats_index.php.master")) {
243+
copy("/usr/local/ispconfig/server/conf-custom/awstats_index.php.master",$rec['document_root']."/".$web_folder."/stats/index.php");
244+
} else {
245+
copy("/usr/local/ispconfig/server/conf/awstats_index.php.master",$rec['document_root']."/".$web_folder."/stats/index.php");
246+
}
247+
}
242248

243249
$app->log('Created awstats statistics with command: '.$command,LOGLEVEL_DEBUG);
244250
} else {

server/plugins-available/apache2_plugin.inc.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2271,7 +2271,11 @@ private function awstats_update ($data,$web_config) {
22712271
}
22722272

22732273
if(is_file($data['new']['document_root']."/" . $web_folder . "/stats/index.html")) $app->system->unlink($data['new']['document_root']."/" . $web_folder . "/stats/index.html");
2274-
$app->system->copy("/usr/local/ispconfig/server/conf/awstats_index.php.master",$data['new']['document_root']."/" . $web_folder . "/stats/index.php");
2274+
if(file_exists("/usr/local/ispconfig/server/conf-custom/awstats_index.php.master")) {
2275+
$app->system->copy("/usr/local/ispconfig/server/conf-custom/awstats_index.php.master",$data['new']['document_root']."/" . $web_folder . "/stats/index.php");
2276+
} else {
2277+
$app->system->copy("/usr/local/ispconfig/server/conf/awstats_index.php.master",$data['new']['document_root']."/" . $web_folder . "/stats/index.php");
2278+
}
22752279
}
22762280

22772281
//* Delete the awstats configuration file

server/plugins-available/nginx_plugin.inc.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1792,7 +1792,11 @@ private function awstats_update ($data,$web_config) {
17921792
}
17931793

17941794
if(is_file($data['new']['document_root']."/" . $web_folder . "/stats/index.html")) $app->system->unlink($data['new']['document_root']."/" . $web_folder . "/stats/index.html");
1795-
$app->system->copy("/usr/local/ispconfig/server/conf/awstats_index.php.master",$data['new']['document_root']."/" . $web_folder . "/stats/index.php");
1795+
if(file_exists("/usr/local/ispconfig/server/conf-custom/awstats_index.php.master")) {
1796+
$app->system->copy("/usr/local/ispconfig/server/conf-custom/awstats_index.php.master",$data['new']['document_root']."/" . $web_folder . "/stats/index.php");
1797+
} else {
1798+
$app->system->copy("/usr/local/ispconfig/server/conf/awstats_index.php.master",$data['new']['document_root']."/" . $web_folder . "/stats/index.php");
1799+
}
17961800
}
17971801

17981802
//* Delete the awstats configuration file

0 commit comments

Comments
 (0)