Skip to content

Commit 95df666

Browse files
committed
add dns only if there is dns support
1 parent 41f9fa4 commit 95df666

File tree

1 file changed

+21
-13
lines changed

1 file changed

+21
-13
lines changed

web/edit/web/index.php

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -167,15 +167,19 @@
167167
unset($output);
168168

169169
if (empty($_SESSION['error_msg'])) {
170-
exec (VESTA_CMD."v-delete-dns-on-web-alias ".$v_username." ".$v_domain." '".$alias."' 'no'", $output, $return_var);
171-
if ($return_var != 0) {
172-
$error = implode('<br>', $output);
173-
if (empty($error)) $error = __('Error code:',$return_var);
174-
$_SESSION['error_msg'] = $error;
170+
exec (VESTA_CMD."v-list-dns-domain ".$v_username." ".$v_domain, $output, $return_var);
171+
unset($output);
172+
if ($return_var == 0) {
173+
exec (VESTA_CMD."v-delete-dns-on-web-alias ".$v_username." ".$v_domain." '".$alias."' 'no'", $output, $return_var);
174+
if ($return_var != 0) {
175+
$error = implode('<br>', $output);
176+
if (empty($error)) $error = __('Error code:',$return_var);
177+
$_SESSION['error_msg'] = $error;
178+
}
179+
$restart_dns = 'yes';
175180
}
176-
$restart_dns = 'yes';
181+
unset($output);
177182
}
178-
unset($output);
179183
}
180184
}
181185

@@ -192,13 +196,17 @@
192196
}
193197
unset($output);
194198
if (empty($_SESSION['error_msg'])) {
195-
exec (VESTA_CMD."v-add-dns-on-web-alias ".$v_username." ".$v_domain." '".$alias."' 'no'", $output, $return_var);
196-
if ($return_var != 0) {
197-
$error = implode('<br>', $output);
198-
if (empty($error)) $error = __('Error code:',$return_var);
199-
$_SESSION['error_msg'] = $error;
199+
exec (VESTA_CMD."v-list-dns-domain ".$v_username." ".$v_domain, $output, $return_var);
200+
unset($output);
201+
if ($return_var == 0) {
202+
exec (VESTA_CMD."v-add-dns-on-web-alias ".$v_username." ".$v_domain." '".$alias."' 'no'", $output, $return_var);
203+
if ($return_var != 0) {
204+
$error = implode('<br>', $output);
205+
if (empty($error)) $error = __('Error code:',$return_var);
206+
$_SESSION['error_msg'] = $error;
207+
}
208+
$restart_dns = 'yes';
200209
}
201-
$restart_dns = 'yes';
202210
}
203211
unset($output);
204212
}

0 commit comments

Comments
 (0)