Skip to content

Commit 47ef5ce

Browse files
committed
Show rendered dns zone in tab, #5983
1 parent 3550ee0 commit 47ef5ce

File tree

6 files changed

+31
-1
lines changed

6 files changed

+31
-1
lines changed

install/sql/incremental/upd_dev_collection.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ ALTER TABLE `server_php` ADD `php_fpm_socket_dir` varchar(255) DEFAULT NULL AFTE
66

77
-- fix #5939
88
UPDATE `ftp_user` SET `expires` = NULL WHERE `expires` = '0000-00-00 00:00:00';
9+
10+
ALTER TABLE `dns_soa` ADD `rendered_zone` MEDIUMTEXT NULL AFTER `dnssec_info`;

install/sql/ispconfig3.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,7 @@ CREATE TABLE `dns_soa` (
629629
`dnssec_algo` SET('NSEC3RSASHA1','ECDSAP256SHA256') NOT NULL DEFAULT 'ECDSAP256SHA256',
630630
`dnssec_last_signed` BIGINT NOT NULL DEFAULT '0',
631631
`dnssec_info` TEXT NULL,
632+
`rendered_zone` MEDIUMTEXT NULL,
632633
PRIMARY KEY (`id`),
633634
UNIQUE KEY `origin` (`origin`),
634635
KEY `active` (`active`)

interface/web/dns/form/dns_soa.tform.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,17 @@
322322
//#################################
323323
)
324324
);
325+
$form["tabs"]['dns_rendered_zone'] = array (
326+
'title' => "Zone rendering",
327+
'width' => 100,
328+
'template' => "templates/dns_soa_rendered.htm",
329+
'fields' => array (
330+
'rendered_zone' => array (
331+
'datatype' => 'TEXT',
332+
'formtype' => 'TEXTAREA',
333+
),
334+
)
335+
);
325336

326337
// show update acl to admins only.
327338
if(!$app->auth->is_admin()) unset($form["tabs"]['dns_soa']['fields']['update_acl']);

interface/web/dns/lib/lang/en_dns_soa.lng

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,5 @@ $wb['error_not_allowed_server_id'] = 'The selected server is not allowed for thi
4242
$wb['soa_cannot_be_changed_txt'] = 'The Zone (SOA) can not be changed. Please contact your administrator to change the zone.';
4343
$wb['configuration_error_txt'] = 'CONFIGURATION ERROR';
4444
$wb['dnssec_algo_txt'] = 'DNSSEC Algorithm';
45+
$wb['rendered_zone_txt'] = 'Bind zone format for reference and export.';
4546
?>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
{tmpl_var name='rendered_zone_txt'}
3+
<pre>
4+
{tmpl_var name='rendered_zone'}
5+
</pre>
6+
7+
<div class="pnl_formsarea">
8+
<input type="hidden" name="id" value="{tmpl_var name='id'}">
9+
</div>
10+

server/plugins-available/bind_plugin.inc.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,10 +328,15 @@ function soa_update($event_name, $data) {
328328
$filename = $dns_config['bind_zonefiles_dir'].'/' . $this->zone_file_prefix() . str_replace("/", "_", substr($zone['origin'], 0, -1));
329329

330330
$old_zonefile = @file_get_contents($filename);
331-
file_put_contents($filename, $tpl->grab());
331+
$rendered_zone = $tpl->grab();
332+
file_put_contents($filename, $rendered_zone);
333+
332334
chown($filename, $dns_config['bind_user']);
333335
chgrp($filename, $dns_config['bind_group']);
334336

337+
// Store also in the db for exports.
338+
$app->dbmaster->query("UPDATE `dns_soa` SET `rendered_zone`=?", $rendered_zone);
339+
335340
//* Check the zonefile
336341
if(is_file($filename.'.err')) unlink($filename.'.err');
337342
$app->system->exec_safe('named-checkzone ? ?', $zone['origin'], $filename);

0 commit comments

Comments
 (0)