ipasserelle-phpmyadmin/root/etc/e-smith/events/actions/ipasserelle-pma-init-domain
2012-10-09 19:21:19 +02:00

30 lines
789 B
Perl

#!/usr/bin/perl -w
use strict;
use warnings;
use esmith::DomainsDB;
use esmith::ConfigDB;
my $d = esmith::DomainsDB->open or die "Couldn't open DomainsDB\n";
my $c = esmith::ConfigDB->open_ro() or die "Couldn't open ConfigDB\n";
my $domain = $c->get('DomainName')->value;
my $vhost = $d->get("sql.$domain");
exit(0) if ($vhost);
$d->new_record("sql.$domain",{
type => 'domain',
Description => 'phpMyAdmin',
Content => 'Primary',
TemplatePath => 'WebAppVirtualHost',
DocumentRoot => '/usr/share/phpMyAdmin',
Authentication => 'LemonLDAP',
RequireSSL => 'yes'
});
die "Failed to create domain sql.$domain\n"
unless ( system("/sbin/e-smith/signal-event", "domain-create" , "sql.$domain") == 0 );