tempaltes for awstats conf

tags/0.1.0
Daniel Berteaud 13 years ago
parent b355e289fe
commit ff3dce9dd7
  1. 2
      createlinks
  2. 10
      root/etc/e-smith/events/actions/awstats-update
  3. 17
      root/etc/e-smith/templates/etc/awstats/domain.conf/000Setup
  4. 4
      root/etc/e-smith/templates/etc/awstats/domain.conf/010Log
  5. 2
      root/etc/e-smith/templates/etc/awstats/domain.conf/020DomainName
  6. 3
      root/etc/e-smith/templates/etc/awstats/domain.conf/030Dir
  7. 2
      root/etc/e-smith/templates/etc/cron.hourly/awstats/10All

@ -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");

@ -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";

@ -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 .= '';
}

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

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

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

@ -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";
}
}

Loading…
Cancel
Save