chenged from content to panel

Signed-off-by: tracer <tracer@24unix.net>
This commit is contained in:
tracer 2022-02-22 15:32:23 +01:00
parent 8c7755e096
commit 18112b7937
1 changed files with 3 additions and 40 deletions

View File

@ -117,7 +117,7 @@ class DomainController
$bindGroup = posix_getgrnam(name: 'bind');
$members = $bindGroup['members'];
if (in_array(needle: $name, haystack: $members)) {
echo "\tis in group 'bind" . PHP_EOL;
echo "\t$name is in group 'bind" . PHP_EOL;
} else {
echo "\t$name needs to be in group $bindGroup!" . PHP_EOL;
@ -211,15 +211,13 @@ class DomainController
// check if we're a master zone
$keyhelpConf = file_get_contents(filename: $this->keyhelpNamedCond);
if (str_contains($keyhelpConf, $domain->getName())) {
if (str_contains(haystack: $keyhelpConf, needle: $domain->getName())) {
echo 'We a zone master for ' . $domain->getName() . PHP_EOL;
exit(1);
}
if ($zonefile = fopen(filename: $this->localZonesDir . $domain->getName(), mode: 'w')) {
// TODO fixme soon
$content = json_decode(json: $domain->getContent());
$panelName = $content->panel;
$panelName = $domain->getPanel();
$panel = $this->panelRepository->findByName(name: $panelName);
$a = $panel->getA();
$aaaa = $panel->getAaaa();
@ -237,42 +235,7 @@ class DomainController
fputs(stream: $zonefile, data: "};" . PHP_EOL);
}
$this->createIncludeFile();
// TODO add on nameservers
}
/**
* @param String $panel
*
* @return String
*/
function createPanelContent(String $panel): String
{
return json_encode(value: [
'panel' => $panel
]
);
}
/**
* @param array $ip
*
* @return String
*/
function createIPContent(array $ip): String
{
$result = [];
if (!empty($ip['a'])) {
$result['a'] = $ip['a'];
}
if (!empty($ip['aaaa'])) {
$result['aaaa'] = $ip['aaaa'];
}
return json_encode(value: [
'custom' => $result
]
);
}
}