avoid unknown variable if there are no domains in domain-list

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2016-02-28 22:04:57 +01:00
parent 319668d384
commit 573fd69c95

View File

@@ -85,6 +85,8 @@ class bind {
WHERE `d`.`isbinddomain` = '1' ORDER BY `d`.`domain` ASC
");
$domains = array();
// don't use fetchall() to be able to set the first column to the domain id and use it later on to set the rows'
// array of direct children without having to search the outer array
while ($domain = $result_domains_stmt->fetch(PDO::FETCH_ASSOC)) {
@@ -109,6 +111,11 @@ class bind {
$domains['none'] = $hostname_arr;
}
if (empty($domains)) {
$this->logger->logAction(CRON_ACTION, LOG_INFO, 'No domains found for nameserver-config, skipping...');
return;
}
// collect domain IDs of direct child domains as arrays in ['children'] column
foreach (array_keys($domains) as $key) {
if (!isset($domains[$key]['children'])) {