| | |
| | | |
| | | //TODO : change this when distribution information has been integrated into server record |
| | | if (file_exists('/etc/gentoo-release')) { |
| | | $filename = escapeshellcmd($dns_config['bind_zonefiles_dir'].'/pri/'.substr($zone['origin'],0,-1)); |
| | | $filename = escapeshellcmd($dns_config['bind_zonefiles_dir'].'/pri.'.str_replace("/", "_", substr($zone['origin'],0,-1))); |
| | | } |
| | | else { |
| | | $filename = escapeshellcmd($dns_config['bind_zonefiles_dir'].'/pri.'.substr($zone['origin'],0,-1)); |
| | | $filename = escapeshellcmd($dns_config['bind_zonefiles_dir'].'/pri.'.str_replace("/", "_", substr($zone['origin'],0,-1))); |
| | | } |
| | | |
| | | $app->log("Writing BIND domain file: ".$filename,LOGLEVEL_DEBUG); |
| | |
| | | if($data['old']['origin'] != $data['new']['origin']) { |
| | | //TODO : change this when distribution information has been integrated into server record |
| | | if (file_exists('/etc/gentoo-release')) { |
| | | $filename = $dns_config['bind_zonefiles_dir'].'/pri/'.substr($data['old']['origin'],0,-1); |
| | | $filename = $dns_config['bind_zonefiles_dir'].'/pri.'.str_replace("/", "_", substr($zone['origin'],0,-1)); |
| | | } |
| | | else { |
| | | $filename = $dns_config['bind_zonefiles_dir'].'/pri.'.substr($data['old']['origin'],0,-1); |
| | | $filename = $dns_config['bind_zonefiles_dir'].'/pri.'.str_replace("/", "_", substr($zone['origin'],0,-1)); |
| | | } |
| | | |
| | | if(is_file($filename)) unset($filename); |
| | |
| | | //* Delete the domain file |
| | | //TODO : change this when distribution information has been integrated into server record |
| | | if (file_exists('/etc/gentoo-release')) { |
| | | $zone_file_name = $dns_config['bind_zonefiles_dir'].'/pri/'.substr($data['old']['origin'],0,-1); |
| | | $zone_file_name = $dns_config['bind_zonefiles_dir'].'/pri/'.str_replace("/", "_",substr($data['old']['origin'],0,-1)); |
| | | } |
| | | else { |
| | | $zone_file_name = $dns_config['bind_zonefiles_dir'].'/pri.'.substr($data['old']['origin'],0,-1); |
| | | $zone_file_name = $dns_config['bind_zonefiles_dir'].'/pri.'.str_replace("/", "_",substr($data['old']['origin'],0,-1)); |
| | | } |
| | | |
| | | if(is_file($zone_file_name)) unlink($zone_file_name); |
| | |
| | | if($data['old']['origin'] != $data['new']['origin']) { |
| | | //TODO : change this when distribution information has been integrated into server record |
| | | if (file_exists('/etc/gentoo-release')) { |
| | | $filename = $dns_config['bind_zonefiles_dir'].'/sec/'.substr($data['old']['origin'],0,-1); |
| | | $filename = $dns_config['bind_zonefiles_dir'].'/sec/'.str_replace("/", "_",substr($data['old']['origin'],0,-1)); |
| | | } |
| | | else { |
| | | $filename = $dns_config['bind_zonefiles_dir'].'/slave/sec.'.substr($data['old']['origin'],0,-1); |
| | | $filename = $dns_config['bind_zonefiles_dir'].'/slave/sec.'.str_replace("/", "_",substr($data['old']['origin'],0,-1)); |
| | | } |
| | | |
| | | if(is_file($filename)) unset($filename); |
| | | } |
| | | |
| | | //* Ensure that the named slave directory is writable by the named user |
| | | if (file_exists('/etc/gentoo-release')) { |
| | | $slave_record_dir = $dns_config['bind_zonefiles_dir'].'/sec'; |
| | | } else { |
| | | $slave_record_dir = $dns_config['bind_zonefiles_dir'].'/slave'; |
| | | } |
| | | if(!@is_dir($slave_record_dir)) mkdir($slave_record_dir,0770); |
| | | chown($slave_record_dir,$dns_config['bind_user']); |
| | | chgrp($slave_record_dir,$dns_config['bind_group']); |
| | | |
| | | //* Reload bind nameserver |
| | | $app->services->restartServiceDelayed('bind','reload'); |
| | |
| | | //* Delete the domain file |
| | | //TODO : change this when distribution information has been integrated into server record |
| | | if (file_exists('/etc/gentoo-release')) { |
| | | $zone_file_name = $dns_config['bind_zonefiles_dir'].'/sec/'.substr($data['old']['origin'],0,-1); |
| | | $zone_file_name = $dns_config['bind_zonefiles_dir'].'/sec/'.str_replace("/", "_",substr($data['old']['origin'],0,-1)); |
| | | } |
| | | else { |
| | | $zone_file_name = $dns_config['bind_zonefiles_dir'].'/slave/sec.'.substr($data['old']['origin'],0,-1); |
| | | $zone_file_name = $dns_config['bind_zonefiles_dir'].'/slave/sec.'.str_replace("/", "_",substr($data['old']['origin'],0,-1)); |
| | | } |
| | | |
| | | if(is_file($zone_file_name)) unlink($zone_file_name); |
| | |
| | | |
| | | if($tmp['origin'] != $exclude_zone) { |
| | | $zones[] = array( 'zone' => substr($tmp['origin'],0,-1), |
| | | 'zonefile_path' => $pri_zonefiles_path.substr($tmp['origin'],0,-1), |
| | | 'zonefile_path' => $pri_zonefiles_path.str_replace("/", "_",substr($tmp['origin'],0,-1)), |
| | | 'options' => $options |
| | | ); |
| | | } |
| | |
| | | |
| | | |
| | | $zones_sec[] = array( 'zone' => substr($tmp['origin'],0,-1), |
| | | 'zonefile_path' => $sec_zonefiles_path.substr($tmp['origin'],0,-1), |
| | | 'zonefile_path' => $sec_zonefiles_path.str_replace("/", "_",substr($tmp['origin'],0,-1)), |
| | | 'options' => $options |
| | | ); |
| | | |