You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.2 KiB
44 lines
1.2 KiB
13 years ago
|
#!/usr/bin/perl -w
|
||
|
|
||
|
use esmith::DomainsDB;
|
||
|
use File::Path qw/rmtree/;
|
||
|
|
||
|
my $event = $ARGV [0];
|
||
|
my $domain = $ARGV [1];
|
||
|
use esmith::DomainsDB;
|
||
|
my $d = esmith::DomainsDB->open_ro or die "Couldn't open DomainsDB\n";
|
||
|
|
||
|
die "Event name missing\n" unless defined ($event);
|
||
|
|
||
|
my @domains = ();
|
||
|
if (defined $domain){
|
||
|
@domains = $d->get($domain);
|
||
|
}
|
||
|
else{
|
||
13 years ago
|
@domains = ($d->domains);
|
||
13 years ago
|
}
|
||
|
|
||
|
foreach my $dom (@domains){
|
||
|
my $name = $dom->key;
|
||
|
if (($event eq 'domain-delete') ){
|
||
13 years ago
|
rmtree "/home/e-smith/files/stats/$name";
|
||
13 years ago
|
unlink <"/etc/awstats/$awstats.$domain.conf">;
|
||
13 years ago
|
}
|
||
|
else{
|
||
|
my $stats = $dom->prop('Stats') || 'disabled';
|
||
13 years ago
|
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",
|
||
|
});
|
||
13 years ago
|
}
|
||
13 years ago
|
elsif (($stats ne 'enabled') && (-d "/home/e-smith/files/stats/$name")){
|
||
|
rmtree "/home/e-smith/files/stats/$name";
|
||
13 years ago
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
exit (0);
|