Skip to content

Commit 2a6eace

Browse files
committed
Fixed some awstats problems.
1 parent 58c2101 commit 2a6eace

File tree

6 files changed

+16
-13
lines changed

6 files changed

+16
-13
lines changed

install/tpl/server.ini.master

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ htaccess_allow_override=All
4949
awstats_conf_dir=/etc/awstats
5050
awstats_data_dir=/var/lib/awstats
5151
awstats_pl=/usr/lib/cgi-bin/awstats.pl
52-
awstats_updateall_pl=/usr/share/doc/awstats/examples/awstats_updateall.pl
52+
awstats_buildstaticpages_pl=/usr/share/awstats/tools/awstats_buildstaticpages.pl
5353

5454
[dns]
5555
bind_user=root

interface/web/admin/form/server_config.tform.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@
463463
'width' => '40',
464464
'maxlength' => '255'
465465
),
466-
'awstats_updateall_pl' => array (
466+
'awstats_buildstaticpages_pl' => array (
467467
'datatype' => 'VARCHAR',
468468
'formtype' => 'TEXT',
469469
'default' => '',

interface/web/admin/lib/lang/en_server_config.lng

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,5 +68,5 @@ $wb["htaccess_allow_override_error_empty"] = '.htaccess AllowOverride is empty.'
6868
$wb["awstats_conf_dir_txt"] = 'awstats conf folder';
6969
$wb["awstats_data_dir_txt"] = 'awstats data folder';
7070
$wb["awstats_pl_txt"] = 'awstats.pl script';
71-
$wb["awstats_updateall_pl_txt"] = 'awstats_updateall script';
71+
$wb["awstats_buildstaticpages_pl_txt"] = 'awstats_buildstaticpages.pl script';
7272
?>

interface/web/admin/templates/server_config_web_edit.htm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ <h2><tmpl_var name="list_head_txt"></h2>
7474
<input name="awstats_pl" id="awstats_pl" value="{tmpl_var name='awstats_pl'}" size="40" maxlength="255" type="text" class="textInput" />
7575
</div>
7676
<div class="ctrlHolder">
77-
<label for="awstats_updateall_pl">{tmpl_var name='awstats_updateall_pl_txt'}</label>
78-
<input name="awstats_updateall_pl" id="awstats_updateall_pl" value="{tmpl_var name='awstats_updateall_pl'}" size="40" maxlength="255" type="text" class="textInput" />
77+
<label for="awstats_buildstaticpages_pl">{tmpl_var name='awstats_buildstaticpages_pl_txt'}</label>
78+
<input name="awstats_buildstaticpages_pl" id="awstats_buildstaticpages_pl" value="{tmpl_var name='awstats_buildstaticpages_pl'}" size="40" maxlength="255" type="text" class="textInput" />
7979
</div>
8080
</fieldset>
8181

server/cron_daily.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,19 +168,20 @@ function setConfigVar( $filename, $varName, $varValue ) {
168168
$domain = escapeshellcmd($rec["domain"]);
169169
$statsdir = escapeshellcmd($rec["document_root"].'/web/stats');
170170
$awstats_pl = $web_config['awstats_pl'];
171-
$awstats_updateall_pl = $web_config['awstats_updateall_pl'];
171+
$awstats_buildstaticpages_pl = $web_config['awstats_buildstaticpages_pl'];
172172

173173

174174
if(!@is_dir($statsdir)) mkdir($statsdir);
175175

176176
// awstats_buildstaticpages.pl -update -config=mydomain.com -lang=en -dir=/var/www/domain.com/web/stats -awstatsprog=/path/to/awstats.pl
177-
$command = "$awstats_updateall_pl -update -config='$domain' -lang=en -dir='$statsdir' -awstatsprog='$awstats_pl'";
177+
$command = "$awstats_buildstaticpages_pl -update -config='$domain' -lang=en -dir='$statsdir' -awstatsprog='$awstats_pl'";
178178

179-
if($awstats_pl != '' && $awstats_updateall_pl != '' && fileowner($awstats_pl) == 0 && fileowner($awstats_updateall_pl) == 0) {
179+
if($awstats_pl != '' && $awstats_buildstaticpages_pl != '' && fileowner($awstats_pl) == 0 && fileowner($awstats_buildstaticpages_pl) == 0) {
180180
exec($command);
181+
rename($rec["document_root"].'/web/stats/awstats.'.$domain.'.html',$rec["document_root"].'/web/stats/index.html');
181182
$app->log("Created awstats statistics with command: $command",LOGLEVEL_DEBUG);
182183
} else {
183-
$app->log("No awstats statistics created. Either $awstats_pl or $awstats_updateall_pl is not owned by root user.",LOGLEVEL_WARN);
184+
$app->log("No awstats statistics created. Either $awstats_pl or $awstats_buildstaticpages_pl is not owned by root user.",LOGLEVEL_WARN);
184185
}
185186

186187
}

server/plugins-available/apache2_plugin.inc.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,16 +1211,18 @@ private function _patchVhostWebdav($fileName, $webdavRoot) {
12111211
private function awstats_update ($data,$web_config) {
12121212
global $app;
12131213

1214+
$awstats_conf_dir = $web_config['awstats_conf_dir'];
1215+
12141216
if(!@is_file($awstats_conf_dir."/awstats.".$data["new"]["domain"].".conf") || ($data["old"]["domain"] != '' && $data["new"]["domain"] != $data["old"]["domain"])) {
12151217
if ( @is_file($awstats_conf_dir."/awstats.".$data["old"]["domain"].".conf") ) {
12161218
unlink($awstats_conf_dir."/awstats.".$data["old"]["domain"].".conf");
12171219
}
12181220

12191221
$content = '';
1220-
$content .= "Include '".$awstats_conf_dir."/awstats.conf'\n";
1221-
$content .= "LogFile='/var/log/ispconfig/httpd/".$data["new"]["domain"]."/access.log'\n";
1222-
$content .= "SiteDomain='".$data["new"]["domain"]."'\n";
1223-
$content .= "HostAliases='www.".$data["new"]["domain"]." localhost 127.0.0.1'\n";
1222+
$content .= "Include \"".$awstats_conf_dir."/awstats.conf\"\n";
1223+
$content .= "LogFile=\"/var/log/ispconfig/httpd/".$data["new"]["domain"]."/access.log\"\n";
1224+
$content .= "SiteDomain=\"".$data["new"]["domain"]."\"\n";
1225+
$content .= "HostAliases=\"www.".$data["new"]["domain"]." localhost 127.0.0.1\"\n";
12241226

12251227
file_put_contents($awstats_conf_dir.'/awstats.'.$data["new"]["domain"].'.conf',$content);
12261228
$app->log("Created awstats config file: ".$awstats_conf_dir.'/awstats.'.$data["new"]["domain"].'.conf',LOGLEVEL_DEBUG);

0 commit comments

Comments
 (0)