Use cgi instead of static

tags/0.1.1 0.1.1
Daniel Berteaud 13 years ago
parent 5661fa833c
commit bea175879b
  1. 2
      createlinks
  2. 6
      ipasserelle-stats.spec
  3. 2
      root/etc/e-smith/events/actions/awstats-init-domain
  4. 14
      root/etc/e-smith/templates/etc/cron.hourly/awstats/10All
  5. 31
      root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/98awstats

@ -2,7 +2,7 @@
use esmith::Build::CreateLinks qw(:all);
templates2events("/etc/cron.hourly/awstats", qw(webapps-update bootstrap-console-save domain-create domain-modify domain-delete));
templates2events("/usr/share/awstats/wwwroot/index.html", 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-update", "$event", "80");

@ -1,5 +1,5 @@
%define version 0.1.0
%define release 1
%define version 0.1.1
%define release 1.beta0
%define name ipasserelle-stats
@ -31,14 +31,12 @@ Génère des statistique de consultation de vos sites web
%build
perl createlinks
%{__mkdir_p} root/home/e-smith/files/stats/
%install
/bin/rm -rf $RPM_BUILD_ROOT
(cd root ; /usr/bin/find . -depth -print | /bin/cpio -dump $RPM_BUILD_ROOT)
/bin/rm -f %{name}-%{version}-filelist
/sbin/e-smith/genfilelist $RPM_BUILD_ROOT \
--dir /home/e-smith/files/stats/ 'attr(0750,root,www)' \
> %{name}-%{version}-filelist
%files -f %{name}-%{version}-filelist

@ -38,7 +38,7 @@ if (!$vhost){
Description => "Statistiques web",
Nameservers => 'internet',
TemplatePath => 'WebAppVirtualHost',
DocumentRoot => '/home/e-smith/files/stats',
DocumentRoot => '/usr/share/awstats/wwwroot',
LemonLDAP => 'enabled',
Removable => 'yes',
});

@ -1,14 +0,0 @@
{
use esmith::DomainsDB;
my $d = esmith::DomainsDB->open_ro or die "Couldn't open DomainsDB\n";
my $lang = $awstats{'Language'} || 'fr';
$OUT .= 'YEAR=$(date +%Y)'."\n";
foreach my $dom ($d->domains){
my $stats = $dom->prop('Stats') || 'disabled';
next if ($stats ne 'enabled');
my $name = $dom->key;
$OUT .= 'mkdir -p /home/e-smith/files/stats/'."$name".'/$YEAR/'."\n";
$OUT .= "/usr/share/awstats/tools/awstats_buildstaticpages.pl -config=$name -update -lang=$lang -dir=/home/e-smith/files/stats/$name/\$YEAR/ 2>&1 > /dev/null\n\n";
}
}

@ -24,40 +24,13 @@ Alias /awstatsicons "/usr/share/awstats/wwwroot/icon/"
Allow from $allow
</Directory>
<Directory "/usr/share/awstats/wwwroot/cgi-bin">
Deny from all
Options +ExecCGI
SetHandler cgi-script
</Directory>
<IfModule mod_env.c>
SetEnv PERL5LIB /usr/share/awstats/lib:/usr/share/awstats/plugins
</IfModule>
<Directory /home/e-smith/files/stats>
Options None
Options +Indexes
Order deny,allow
Deny from all
Allow from $allow
SSLRequireSSL on
</Directory>
EOF
foreach my $dom ($d->domains){
my $stats = $dom->prop('Stats') || 'disabled';
next unless ($stats eq 'enabled');
my $name = $dom->key;
my @users = split /[;,]/, ($dom->prop('StatsUsers') || '');
foreach my $u (@users){
$OUT .= " SetEnvIf Auth-User \"$u\" allow_$name\n";
}
my $allowfromenv = (scalar @users > 0) ? "allow from env=allow_$name":'';
$OUT .=<<"HERE";
<Directory /home/e-smith/files/stats/$name>
DirectoryIndex awstats.$name.html
$allowfromenv
</Directory>
HERE
}
}
}

Loading…
Cancel
Save