Skip to content

Commit

Permalink
create empty dns-server config if no (dns-enabled) domain is determin…
Browse files Browse the repository at this point in the history
…ed; fixes #1230

Signed-off-by: Michael Kaufmann <[email protected]>
  • Loading branch information
d00p committed Jan 24, 2024
1 parent 2629718 commit a7ee5e0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 21 deletions.
21 changes: 10 additions & 11 deletions lib/Froxlor/Cron/Dns/Bind.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,17 @@ public function writeConfigs()
$domains = $this->getDomainList();

if (empty($domains)) {
$this->logger->logAction(FroxlorLogger::CRON_ACTION, LOG_INFO, 'No domains found for nameserver-config, skipping...');
return;
}

$this->bindconf_file = '# ' . Settings::Get('system.bindconf_directory') . 'froxlor_bind.conf' . "\n" . '# Created ' . date('d.m.Y H:i') . "\n" . '# Do NOT manually edit this file, all changes will be deleted after the next domain change at the panel.' . "\n\n";

foreach ($domains as $domain) {
if ($domain['is_child']) {
// domains that are subdomains to other main domains are handled by recursion within walkDomainList()
continue;
$this->logger->logAction(FroxlorLogger::CRON_ACTION, LOG_INFO, 'No domains found for nameserver-config, not creating any zones...');
$this->bindconf_file = '';
} else {
$this->bindconf_file = '# ' . Settings::Get('system.bindconf_directory') . 'froxlor_bind.conf' . "\n" . '# Created ' . date('d.m.Y H:i') . "\n" . '# Do NOT manually edit this file, all changes will be deleted after the next domain change at the panel.' . "\n\n";
foreach ($domains as $domain) {
if ($domain['is_child']) {
// domains that are subdomains to other main domains are handled by recursion within walkDomainList()
continue;
}
$this->walkDomainList($domain, $domains);
}
$this->walkDomainList($domain, $domains);
}

$bindconf_file_handler = fopen(FileDir::makeCorrectFile(Settings::Get('system.bindconf_directory') . '/froxlor_bind.conf'), 'w');
Expand Down
18 changes: 8 additions & 10 deletions lib/Froxlor/Cron/Dns/PowerDNS.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,16 @@ public function writeConfigs()
$this->clearZoneTables($domains);

if (empty($domains)) {
$this->logger->logAction(FroxlorLogger::CRON_ACTION, LOG_INFO, 'No domains found for nameserver-config, skipping...');
return;
}

foreach ($domains as $domain) {
if ($domain['is_child']) {
// domains that are subdomains to other main domains are handled by recursion within walkDomainList()
continue;
$this->logger->logAction(FroxlorLogger::CRON_ACTION, LOG_INFO, 'No domains found for nameserver-config, not creating any zones...');
} else {
foreach ($domains as $domain) {
if ($domain['is_child']) {
// domains that are subdomains to other main domains are handled by recursion within walkDomainList()
continue;
}
$this->walkDomainList($domain, $domains);
}
$this->walkDomainList($domain, $domains);
}

$this->logger->logAction(FroxlorLogger::CRON_ACTION, LOG_INFO, 'PowerDNS database updated');
$this->reloadDaemon();
$this->logger->logAction(FroxlorLogger::CRON_ACTION, LOG_INFO, 'Task4 finished');
Expand Down

0 comments on commit a7ee5e0

Please sign in to comment.