mirror of
https://github.com/tuxis-ie/nsedit.git
synced 2025-04-19 20:09:14 +03:00
Check if serial is an integer, so we know if it's a new zone. Also, return the new zone upon saving it.
This commit is contained in:
parent
2cc92e6842
commit
cf754d0135
1 changed files with 8 additions and 4 deletions
|
@ -52,7 +52,7 @@ class PdnsAPI {
|
|||
unset($zonedata['url']);
|
||||
unset($zonedata['rrsets']);
|
||||
|
||||
if ($zone['serial'] == '') {
|
||||
if (gettype($zone['serial']) != 'integer') {
|
||||
$api->method = 'POST';
|
||||
$api->url = '/servers/localhost/zones';
|
||||
$api->content = json_encode($zonedata);
|
||||
|
@ -66,11 +66,15 @@ class PdnsAPI {
|
|||
$api->call();
|
||||
|
||||
// Then, update the rrsets
|
||||
if (count($zone['rrsets']) > 0) {
|
||||
$api->method = 'PATCH';
|
||||
$api->content = json_encode(Array('rrsets' => $zone['rrsets']));
|
||||
$api->call();
|
||||
}
|
||||
|
||||
return $this->loadzone($zone['id']);
|
||||
}
|
||||
|
||||
public function deletezone($zoneid) {
|
||||
$api = clone $this->http;
|
||||
$api->method = 'DELETE';
|
||||
|
|
Loading…
Add table
Reference in a new issue