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.

38 lines
906 B

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{
@domains = ($d->domains);
13 years ago
}
foreach my $dom (@domains){
my $name = $dom->key;
if (($event eq 'domain-delete') ){
rmtree "/home/e-smith/files/stats/$name";
13 years ago
}
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;
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);