| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# |
|
2
|
|
|
|
|
|
|
# DESCRIPTION: |
|
3
|
|
|
|
|
|
|
# Plesk Expand communicate interface. Static methods for managing domain accounts. |
|
4
|
|
|
|
|
|
|
# AUTHORS: |
|
5
|
|
|
|
|
|
|
# Pavel Odintsov (nrg) |
|
6
|
|
|
|
|
|
|
# |
|
7
|
|
|
|
|
|
|
#======================================================================== |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
package API::PleskExpand::Domains; |
|
10
|
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
1499
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
33
|
|
|
12
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
24
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
|
356
|
use API::Plesk::Methods; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
use Data::Dumper; |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our $VERSION = '1.04'; |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 NAME |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
API::PleskExpand::Domains - extension module to support operations with Plesk domains (only create) from Plesk Expand. |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
Directly not used, calls via API::Plesk. |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
use API::PleskExpand; |
|
28
|
|
|
|
|
|
|
use API::Plesk::Response; |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
Some code |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
The method used to add domain hosting account to a certain Plesk account from Plesk Expand. |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 METHODS |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=over 3 |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=item create() |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
Params: |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
dname => 'yandex.ru', # domain name |
|
45
|
|
|
|
|
|
|
client_id => 9, # add domain to client with certain id |
|
46
|
|
|
|
|
|
|
'template-id' => 1, # domain template id |
|
47
|
|
|
|
|
|
|
ftp_login => 'nrgsdasd', # username for ftp |
|
48
|
|
|
|
|
|
|
ftp_password => 'dasdasd', # password for ftp account |
|
49
|
|
|
|
|
|
|
attach_to_template => 1, # attach domain to template ? 1 -- yes, 0 -- no |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Return: |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
$VAR1 = bless( { |
|
54
|
|
|
|
|
|
|
'answer_data' => [ { |
|
55
|
|
|
|
|
|
|
'server_id' => '1', |
|
56
|
|
|
|
|
|
|
'status' => 'ok', |
|
57
|
|
|
|
|
|
|
'expiration' => '-1', |
|
58
|
|
|
|
|
|
|
'tmpl_id' => '1', |
|
59
|
|
|
|
|
|
|
'client_id' => '16', |
|
60
|
|
|
|
|
|
|
'id' => '15' |
|
61
|
|
|
|
|
|
|
} ], |
|
62
|
|
|
|
|
|
|
'error_codes' => '' |
|
63
|
|
|
|
|
|
|
}, 'API::Plesk::Response' ); |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=back |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 EXPORT |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
None. |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=cut |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
# Create element |
|
75
|
|
|
|
|
|
|
# STATIC |
|
76
|
|
|
|
|
|
|
sub create { |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
my %params = @_; |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
return '' unless $params{'dname'} && |
|
81
|
|
|
|
|
|
|
#$params{'ip'} && |
|
82
|
|
|
|
|
|
|
$params{'client_id'} && |
|
83
|
|
|
|
|
|
|
$params{'ftp_login'} && |
|
84
|
|
|
|
|
|
|
$params{'ftp_password'} && |
|
85
|
|
|
|
|
|
|
$params{'template-id'}; |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
$params{'attach_to_template'} ||= ''; |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
my $hosting_block = create_node('hosting', |
|
90
|
|
|
|
|
|
|
generate_info_block( |
|
91
|
|
|
|
|
|
|
'vrt_hst', |
|
92
|
|
|
|
|
|
|
'ftp_login' => $params{'ftp_login'}, |
|
93
|
|
|
|
|
|
|
'ftp_password' => $params{'ftp_password'}, |
|
94
|
|
|
|
|
|
|
) |
|
95
|
|
|
|
|
|
|
); |
|
96
|
|
|
|
|
|
|
my $template_block = create_node('tmpl_id', $params{'template-id'}) . |
|
97
|
|
|
|
|
|
|
( $params{'attach_to_template'} ? create_node('attach_to_template', '') : '' ); |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
return create_node( 'add_use_template', |
|
100
|
|
|
|
|
|
|
create_node( |
|
101
|
|
|
|
|
|
|
'gen_setup', |
|
102
|
|
|
|
|
|
|
create_node( 'name', $params{dname} ) . |
|
103
|
|
|
|
|
|
|
create_node( 'client_id', $params{client_id} ) . |
|
104
|
|
|
|
|
|
|
create_node( 'status', 0) |
|
105
|
|
|
|
|
|
|
) . $hosting_block . '' . $template_block |
|
106
|
|
|
|
|
|
|
); |
|
107
|
|
|
|
|
|
|
} |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
# Parse XML response |
|
111
|
|
|
|
|
|
|
# STATIC |
|
112
|
|
|
|
|
|
|
sub create_response_parse { |
|
113
|
|
|
|
|
|
|
return abstract_parser('add_use_template', +shift, [ ], 'system_error' ); |
|
114
|
|
|
|
|
|
|
} |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
# Modify element |
|
118
|
|
|
|
|
|
|
# STATIC |
|
119
|
|
|
|
|
|
|
sub modify { |
|
120
|
|
|
|
|
|
|
# stub |
|
121
|
|
|
|
|
|
|
} |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
# SET response handler |
|
125
|
|
|
|
|
|
|
# STATIC |
|
126
|
|
|
|
|
|
|
sub modify_response_parse { |
|
127
|
|
|
|
|
|
|
# stub |
|
128
|
|
|
|
|
|
|
} |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
# Delete element |
|
132
|
|
|
|
|
|
|
# STATIC( %args ) |
|
133
|
|
|
|
|
|
|
sub delete { |
|
134
|
|
|
|
|
|
|
# stub |
|
135
|
|
|
|
|
|
|
} |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
# DEL response handler |
|
139
|
|
|
|
|
|
|
# STATIC |
|
140
|
|
|
|
|
|
|
sub delete_response_parse { |
|
141
|
|
|
|
|
|
|
# stub |
|
142
|
|
|
|
|
|
|
} |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
# Get all element data |
|
146
|
|
|
|
|
|
|
# STATIC |
|
147
|
|
|
|
|
|
|
sub get { |
|
148
|
|
|
|
|
|
|
my %params = @_; |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
unless ($params{all}) { |
|
151
|
|
|
|
|
|
|
return ''; |
|
152
|
|
|
|
|
|
|
} |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
#return ''; |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
return create_node( 'get', |
|
157
|
|
|
|
|
|
|
create_node('filter', '') . create_node( 'dataset', create_node('gen_info') ) |
|
158
|
|
|
|
|
|
|
) . ''; |
|
159
|
|
|
|
|
|
|
} |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
# GET response handler |
|
163
|
|
|
|
|
|
|
# STATIC |
|
164
|
|
|
|
|
|
|
sub get_response_parse { |
|
165
|
|
|
|
|
|
|
my $answer = abstract_parser('get', +shift, [ ], 'system_error' ); |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
if (ref $answer eq 'ARRAY') { |
|
168
|
|
|
|
|
|
|
for my $domain (@$answer) { |
|
169
|
|
|
|
|
|
|
$domain->{data} = xml_extract_values($domain->{data} =~ m#(.*?)#); |
|
170
|
|
|
|
|
|
|
} |
|
171
|
|
|
|
|
|
|
} elsif ($answer) { |
|
172
|
|
|
|
|
|
|
$answer->{data} = xml_extract_values($answer->{data} =~ m#(.*?)#); |
|
173
|
|
|
|
|
|
|
} |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
return $answer; |
|
176
|
|
|
|
|
|
|
} |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
1; |
|
180
|
|
|
|
|
|
|
__END__ |