From 68fa0e6576c05eb0ac8d0c38feba05d07e989d60 Mon Sep 17 00:00:00 2001 From: "Michael Kaufmann (d00p)" Date: Sun, 15 May 2016 09:56:48 +0200 Subject: [PATCH] let createDomainZone() return the DnsZone object for better use later Signed-off-by: Michael Kaufmann (d00p) --- dns_editor.php | 3 ++- lib/classes/dns/class.DnsZone.php | 5 ++++- lib/functions/dns/function.createDomainZone.php | 4 ++-- scripts/jobs/cron_tasks.inc.dns.15.bind.php | 3 ++- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/dns_editor.php b/dns_editor.php index 777eeeff..bc9726a3 100644 --- a/dns_editor.php +++ b/dns_editor.php @@ -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) . "\";"); diff --git a/lib/classes/dns/class.DnsZone.php b/lib/classes/dns/class.DnsZone.php index b1b04eb5..9c4a8161 100644 --- a/lib/classes/dns/class.DnsZone.php +++ b/lib/classes/dns/class.DnsZone.php @@ -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; } diff --git a/lib/functions/dns/function.createDomainZone.php b/lib/functions/dns/function.createDomainZone.php index 4b990127..ca1e71dd 100644 --- a/lib/functions/dns/function.createDomainZone.php +++ b/lib/functions/dns/function.createDomainZone.php @@ -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) diff --git a/scripts/jobs/cron_tasks.inc.dns.15.bind.php b/scripts/jobs/cron_tasks.inc.dns.15.bind.php index 1e72166d..4c368be2 100644 --- a/scripts/jobs/cron_tasks.inc.dns.15.bind.php +++ b/scripts/jobs/cron_tasks.inc.dns.15.bind.php @@ -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');