tempaltes for awstats conf

This commit is contained in:
Daniel Berteaud 2012-03-29 13:04:33 +02:00
parent b355e289fe
commit ff3dce9dd7
7 changed files with 36 additions and 4 deletions

View File

@ -5,7 +5,7 @@ use esmith::Build::CreateLinks qw(:all);
templates2events("/etc/cron.hourly/awstats", qw(webapps-update bootstrap-console-save domain-create domain-modify domain-delete));
foreach my $event (qw/webapps-update bootstrap-console-save domain-create domain-modify domain-delete/){
event_link("awstats-dir", "$event", "80");
event_link("awstats-update", "$event", "80");
}
foreach my $event (qw/ipasserelle-update bootstrap-console-save webapps-update/){
event_link("awstats-init-domain", "$event", "80");

View File

@ -22,11 +22,17 @@ foreach my $dom (@domains){
my $name = $dom->key;
if (($event eq 'domain-delete') ){
rmtree "/home/e-smith/files/stats/$name";
unlink <"/etc/awstats/$awstats.$domain.conf">;
}
else{
my $stats = $dom->prop('Stats') || 'disabled';
if (($stats eq 'enabled') && (!-d "/home/e-smith/files/stats/$name")){
mkdir "/home/e-smith/files/stats/$name", 0755;
if ($stats eq 'enabled'){
mkdir "/home/e-smith/files/stats/$name", 0755 if (!-d "/home/e-smith/files/stats/$name");
processTemplate({
TEMPLATE_PATH => "/etc/awstats/domain.conf",
MORE_DATA => {DOMAIN=>$name},
OUTPUT_FILENAME => "/etc/awstats/awstats.$name.conf",
});
}
elsif (($stats ne 'enabled') && (-d "/home/e-smith/files/stats/$name")){
rmtree "/home/e-smith/files/stats/$name";

View File

@ -0,0 +1,17 @@
{
use esmith::HostsDB;
use esmith::DomainsDB;
my $hdb = esmith::HostsDB->open_ro();
my %domains = map { $_->key => 1 } esmith::DomainsDB->open_ro->domains;
$domain = $DOMAIN;
my @hosts = grep {
my $h = $_;
($h->prop('HostType') eq 'Self') && !$domains{$h->key}
} $hdb->get_hosts_by_domain($domain);
$alias = join " ", map { $_->key } @hosts;
$OUT .= '';
}

View File

@ -0,0 +1,4 @@
LogFile="/var/log/httpd/access_log"
LogType=W
LogFormat=1
LogSeparator=" "

View File

@ -0,0 +1,2 @@
SiteDomain="{$domain}"
HostAliases="{$alias}"

View File

@ -0,0 +1,3 @@
DirData="/var/lib/awstats"
DirCgi="/awstats"
DirIcons="/awstatsicons"

View File

@ -7,6 +7,6 @@ foreach my $dom ($d->domains){
next if ($stats ne 'enabled');
my $name = $dom->key;
my $lang = $awstats{'Language'} || 'fr';
$OUT .= "/usr/share/awstats/tools/awstats_buildstaticpages.pl -config=$name -update -lang=$lang -dir=/var/lib/stats/$name\n";
$OUT .= "/usr/share/awstats/tools/awstats_buildstaticpages.pl -config=$name -update -lang=$lang -dir=/home/e-smith/files/stats/$name\n";
}
}