Bugfixe bind generation

This commit is contained in:
Alan Garcia 2014-02-04 17:24:11 +00:00
parent 77b22d46dd
commit 82e8c2e40c
1 changed files with 11 additions and 6 deletions

View File

@ -132,9 +132,11 @@ class m_bind_regenerate {
function dkim_delete($domain) { function dkim_delete($domain) {
$target_dir = "/etc/opendkim/keys/$domain"; $target_dir = "/etc/opendkim/keys/$domain";
if (file_exists($target_dir)) {
@unlink("$target_dir/alternc_private"); @unlink("$target_dir/alternc_private");
@unlink("$target_dir/alternc.txt"); @unlink("$target_dir/alternc.txt");
@rmdir($target_dir); @rmdir($target_dir);
}
return true; return true;
} }
@ -344,13 +346,16 @@ class m_bind_regenerate {
// Regenerate bind configuration and load it // Regenerate bind configuration and load it
function regenerate_conf($all=false) { function regenerate_conf($all=false) {
foreach ($this->get_domain_summary() as $domain => $ds ) { foreach ($this->get_domain_summary() as $domain => $ds ) {
if ( ! $ds['gesdns'] ) continue; // Skip if we do not manage DNS for this domain if ( ! $ds['gesdns'] && strtoupper($ds['dns_action']) == 'OK' ) continue; // Skip if we do not manage DNS and is up-to-date for this domain
if ( strtoupper($ds['dns_action']) == 'DELETE' ) { if ( (strtoupper($ds['dns_action']) == 'DELETE' ) ||
(strtoupper($ds['dns_action']) == 'UPDATE' && $ds['gesdns']==false ) // in case we update the zone to disable DNS management
) {
$this->delete_zone($domain); $this->delete_zone($domain);
continue;
} }
if ($all || strtoupper($ds['dns_action']) == 'UPDATE' ) { if ($all || ( strtoupper($ds['dns_action']) == 'UPDATE' && $ds['gesdns'] )) {
$this->save_zone($domain); $this->save_zone($domain);
$this->reload_zone($domain); $this->reload_zone($domain);
// FIXME reload zone hooks // FIXME reload zone hooks