X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_export%2Fwww_plesk.pm;h=a247f054eba67efbe91c232de3318edb365a5d6c;hb=90e15da7354b55cc5461b58ac087096ed47e0240;hp=3839596726a5af3baae94245427794bb89753ed8;hpb=55ba66c693dcd0f37123476bb4383491514bf41c;p=freeside.git
diff --git a/FS/FS/part_export/www_plesk.pm b/FS/FS/part_export/www_plesk.pm
index 383959672..a247f054e 100644
--- a/FS/FS/part_export/www_plesk.pm
+++ b/FS/FS/part_export/www_plesk.pm
@@ -3,8 +3,6 @@ package FS::part_export::www_plesk;
use vars qw(@ISA %info);
use Tie::IxHash;
use FS::part_export;
-use Net::Plesk;
-use Net::Plesk::Response;
@ISA = qw(FS::part_export);
@@ -12,20 +10,24 @@ tie my %options, 'Tie::IxHash',
'URL' => { label=>'URL' },
'login' => { label=>'Login' },
'password' => { label=>'Password' },
+ 'template' => { label=>'Domain Template' },
+ 'web' => { label=>'Host Website',
+ type=>'checkbox' },
'debug' => { label=>'Enable debugging',
type=>'checkbox' },
;
%info = (
- 'svc' => 'svc_www',
- 'desc' => 'Real-time export to Plesk managed hosting service',
- 'options'=> \%options,
- 'notes' => <<'END'
+ 'svc' => 'svc_www',
+ 'desc' => 'Real-time export to Plesk managed hosting service',
+ 'options' => \%options,
+ 'no_machine' => 1,
+ 'notes' => <<'END'
Real-time export to
Plesk managed server.
Requires installation of
Net::Plesk
-from CPAN.
+from CPAN and proper configuration.
END
);
@@ -37,7 +39,10 @@ sub rebless { shift; }
sub _export_insert {
my( $self, $www ) = ( shift, shift );
-
+
+ eval "use Net::Plesk;";
+ return $@ if $@;
+
my $plesk = new Net::Plesk (
'POST' => $self->option('URL'),
':HTTP_AUTH_LOGIN' => $self->option('login'),
@@ -70,15 +75,30 @@ sub _export_insert {
$www->domain_record->recdata,
);
- $self->_plesk_command( 'domain_add',
- $www->domain_record->svc_domain->domain,
- $gcresp->id,
- $www->domain_record->recdata,
- );
+ if ($self->option('web')) {
+ $self->_plesk_command( 'domain_add',
+ $www->domain_record->svc_domain->domain,
+ $gcresp->id,
+ $www->domain_record->recdata,
+ $self->option('template')?$self->option('template'):'',
+ $www->svc_acct->username,
+ $www->svc_acct->_password,
+ );
+ }else{
+ $self->_plesk_command( 'domain_add',
+ $www->domain_record->svc_domain->domain,
+ $gcresp->id,
+ $www->domain_record->recdata,
+ $self->option('template')?$self->option('template'):'',
+ );
+ }
}
sub _plesk_command {
my( $self, $method, @args ) = @_;
+
+ eval "use Net::Plesk;";
+ return $@ if $@;
local($Net::Plesk::DEBUG) = 1
if $self->option('debug');