added zone type

Signed-off-by: tracer <tracer@24unix.net>
This commit is contained in:
tracer 2022-04-06 16:26:08 +02:00
parent 2f79e39a8c
commit d6922be2a4
1 changed files with 6 additions and 3 deletions

View File

@ -384,6 +384,7 @@ class BindAPI
return true; return true;
} }
/** /**
* @param String $domainName * @param String $domainName
* @param \App\Entity\Panel $panel * @param \App\Entity\Panel $panel
@ -470,6 +471,7 @@ class BindAPI
exit(1); exit(1);
} }
if ($create['header'] != 201) { if ($create['header'] != 201) {
print_r(value: $create);
die("make error handling"); die("make error handling");
} else { } else {
echo COLOR_GREEN . 'OK' . COLOR_DEFAULT; echo COLOR_GREEN . 'OK' . COLOR_DEFAULT;
@ -1011,7 +1013,7 @@ class BindAPI
} }
if (!empty($domains)) { if (!empty($domains)) {
$table = new ConsoleTable(); $table = new ConsoleTable();
$table->setHeaders(content: ['ID', 'Name', 'Panel']); $table->setHeaders(content: ['ID', 'Name', 'Panel', 'Type']);
/** @var Domain $domain */ /** @var Domain $domain */
foreach ($domains as $domain) { foreach ($domains as $domain) {
$row = []; $row = [];
@ -1019,6 +1021,7 @@ class BindAPI
$row[] = $domain->getId(); $row[] = $domain->getId();
$row[] = $domain->getName(); $row[] = $domain->getName();
$row[] = $domain->getPanel(); $row[] = $domain->getPanel();
$row[] = $this->domainController->isMasterZone(domain: $domain) ? 'MASTER' : 'SLAVE';
} catch (DependencyException|NotFoundException $e) { } catch (DependencyException|NotFoundException $e) {
echo $e->getMessage(); echo $e->getMessage();
} }
@ -1105,14 +1108,14 @@ class BindAPI
if (empty($name) && empty($panel)) { if (empty($name) && empty($panel)) {
echo 'No name or panel given, just recreate the config file' . PHP_EOL; echo 'No name or panel given, just recreate the config file' . PHP_EOL;
$this->domainController->createSlaveZoneFile(domain: $domain); $this->domainController->updateSlaveZones();
exit(1); exit(1);
} }
$newDomain = new Domain(name: $name, panel: $panelName, id: $domain->getId()); $newDomain = new Domain(name: $name, panel: $panelName, id: $domain->getId());
if ($this->domainRepository->update(domain: $newDomain) !== false) { if ($this->domainRepository->update(domain: $newDomain) !== false) {
echo 'Domain server has been updated' . PHP_EOL; echo 'Domain server has been updated' . PHP_EOL;
$this->domainController->createSlaveZoneFile(domain: $domain); $this->domainController->updateSlaveZones();
} else { } else {
echo 'Error while updating domain server.' . PHP_EOL; echo 'Error while updating domain server.' . PHP_EOL;
} }