let createDomainZone() return the DnsZone object for better use later

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2016-05-15 09:56:48 +02:00
parent 8d8da0986a
commit 68fa0e6576
4 changed files with 10 additions and 5 deletions

View File

@@ -279,5 +279,6 @@ foreach ($type_select_values as $_type) {
eval("\$record_list=\"" . getTemplate("dns_editor/list", true) . "\";");
$zonefile = createDomainZone($domain_id);
$zone = createDomainZone($domain_id);
$zonefile = (string)$zone;
eval("echo \"" . getTemplate("dns_editor/index", true) . "\";");

View File

@@ -21,12 +21,15 @@ class DnsZone
public $origin;
public $serial;
public $records;
public function __construct($ttl = 18000, $origin = '', $records = null)
public function __construct($ttl = 18000, $origin = '', $serial = '', $records = null)
{
$this->ttl = $ttl;
$this->origin = $origin;
$this->serial = $serial;
$this->records = $records;
}

View File

@@ -259,9 +259,9 @@ function createDomainZone($domain_id, $froxlorhostname = false)
$soa_record = new DnsEntry('@', 'SOA', $soa_content);
array_unshift($zonerecords, $soa_record);
$zone = new DnsZone((int) Settings::Get('system.defaultttl'), $domain['domain'], $zonerecords);
$zone = new DnsZone((int) Settings::Get('system.defaultttl'), $domain['domain'], $domain['bindserial'], $zonerecords);
return (string)$zone;
return $zone;
}
function addRequiredEntry($record = '@', $type = 'A', &$required)

View File

@@ -46,7 +46,8 @@ class bind2 extends DnsBase
}
// create zone-file
$this->_logger->logAction(CRON_ACTION, LOG_DEBUG, 'Generating dns zone for ' . $domain['domain']);
$zonefile = createDomainZone($domain['id'], $isFroxlorHostname);
$zone = createDomainZone($domain['id'], $isFroxlorHostname);
$zonefile = (string)$zone;
$domain['zonefile'] = 'domains/' . $domain['domain'] . '.zone';
$zonefile_name = makeCorrectFile(Settings::Get('system.bindconf_directory') . '/' . $domain['zonefile']);
$zonefile_handler = fopen($zonefile_name, 'w');