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.

37 lines
906 B

#!/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);
}
foreach my $dom (@domains){
my $name = $dom->key;
if (($event eq 'domain-delete') ){
rmtree "/home/e-smith/files/stats/$name";
}
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;
}
elsif (($stats ne 'enabled') && (-d "/home/e-smith/files/stats/$name")){
rmtree "/home/e-smith/files/stats/$name";
}
}
}
exit (0);