summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjeff <jeff>2006-11-18 02:17:58 +0000
committerjeff <jeff>2006-11-18 02:17:58 +0000
commit79a393425645b123a1833e5b65dcb1683bbdccf5 (patch)
tree93bab209f85e8bd2adbfdc70f1a01e0cd21df45b
parent69bf46aa820bb3378944e0646398c4f093234783 (diff)
include templating on domain addition and make web hosting optional
-rw-r--r--lib/Net/Plesk.pm4
-rw-r--r--lib/Net/Plesk/Method/domain_add.pm32
2 files changed, 24 insertions, 12 deletions
diff --git a/lib/Net/Plesk.pm b/lib/Net/Plesk.pm
index 3e78963..62a6811 100644
--- a/lib/Net/Plesk.pm
+++ b/lib/Net/Plesk.pm
@@ -24,9 +24,9 @@ use Net::Plesk::Method::client_ippool_add_ip;
@ISA = qw(Exporter);
-$VERSION = '0.01';
+$VERSION = '0.02';
-$PROTO_VERSION = '1.4.0.0';
+$PROTO_VERSION = '1.4.1.0';
$DEBUG = 1;
diff --git a/lib/Net/Plesk/Method/domain_add.pm b/lib/Net/Plesk/Method/domain_add.pm
index cfe55be..0148367 100644
--- a/lib/Net/Plesk/Method/domain_add.pm
+++ b/lib/Net/Plesk/Method/domain_add.pm
@@ -5,7 +5,7 @@ use strict;
use vars qw( $VERSION @ISA $AUTOLOAD $DEBUG );
@ISA = qw( Net::Plesk::Method );
-$VERSION = '0.01';
+$VERSION = '0.02';
$DEBUG = 0;
@@ -38,8 +38,8 @@ $<ip_address> options are required.
=cut
sub init {
- my ($self, $domain, $client, $ip) = @_;
- $$self = join ( "\n", (
+ my ($self, $domain, $client, $ip, $template, $user, $pass) = @_;
+ my $xml = join ( "\n", (
'<domain>',
'<add>',
'<gen_setup>',
@@ -49,13 +49,25 @@ sub init {
'<client_id>',
$self->encode($client),
'</client_id>',
- '<ip_address>',
- $self->encode($ip),
- '</ip_address>',
- '</gen_setup>',
- '</add>',
- '</domain>',
- ));
+ ));
+ $xml .= '<htype>vrt_hst</htype>' if defined($user);
+ $xml .= join ( "\n", ( '<ip_address>',
+ $self->encode($ip),
+ '</ip_address>',
+ '</gen_setup>',
+ ));
+ if (defined($user)) {
+ $xml .= "<hosting><vrt_hst><ftp_login>" . $self->encode($user);
+ $xml .= "</ftp_login><ftp_password>" . $self->encode($pass);
+ $xml .= "</ftp_password><ip_address>" . $self->encode($ip);
+ $xml .= "</ip_address></vrt_hst></hosting>";
+ }
+ if ($template) {
+ $xml .= "<template-name>" . $self->encode($template) . "</template-name>";
+ }
+ $xml .= '</add></domain>';
+
+ $$self = $xml;
}
=back