/**
  * Assigns SOA to domain_id
  *
  * @since 1.3
  * @package facileManager
  * @subpackage fmDNS
  *
  * @param id $soa_id SOA ID to assign
  * @param id $domain_id Domain ID to assign to
  * @return boolean
  */
 function assignSOA($soa_id, $domain_id)
 {
     global $__FM_CONFIG, $fm_dns_zones;
     $old_soa_id = getNameFromID($domain_id, "fm_{$__FM_CONFIG['fmDNS']['prefix']}domains", 'domain_', 'domain_id', 'soa_id');
     if (basicUpdate("fm_{$__FM_CONFIG['fmDNS']['prefix']}domains", $domain_id, 'soa_id', $soa_id, 'domain_id')) {
         /** Delete old custom SOA */
         if (getNameFromID($old_soa_id, "fm_{$__FM_CONFIG['fmDNS']['prefix']}soa", 'soa_', 'soa_id', 'soa_template') == 'no') {
             updateStatus("fm_{$__FM_CONFIG['fmDNS']['prefix']}soa", $old_soa_id, 'soa_', 'deleted', 'soa_id');
         }
         if (!isset($fm_dns_zones)) {
             include ABSPATH . 'fm-modules/' . $_SESSION['module'] . '/classes/class_zones.php';
         }
         /** Update the SOA serial number */
         foreach ($fm_dns_zones->getZoneTemplateChildren($domain_id) as $child_id) {
             $domain_id = getParentDomainID($child_id);
             if (reloadAllowed($domain_id) && getSOACount($domain_id) && getNSCount($domain_id)) {
                 $this->updateSOAReload($child_id, 'yes');
             }
         }
     }
 }
Beispiel #2
0
 /**
  * Sets SOA serials and reload flags per domain_id
  *
  * @since 2.1
  * @package facileManager
  * @subpackage fmDNS
  *
  * @param id $domain_id domain_id to set
  * @param id $record_type Record type to check
  * @param id $action Add or update
  * @return null
  */
 function processSOAUpdates($domain_id, $record_type, $action)
 {
     global $fm_dns_zones;
     if (!$fm_dns_zones) {
         include ABSPATH . 'fm-modules/' . $_SESSION['module'] . '/classes/class_zones.php';
     }
     foreach ($fm_dns_zones->getZoneTemplateChildren($domain_id) as $child_id) {
         $domain_id = getParentDomainID($child_id);
         $soa_count = getSOACount($domain_id);
         $ns_count = getNSCount($domain_id);
         if (reloadAllowed($domain_id) && $soa_count && $ns_count) {
             $this->updateSOAReload($child_id, 'yes');
         }
         if ($action == 'add') {
             if (in_array($record_type, array('SOA', 'NS')) && $soa_count && $ns_count) {
                 /** Update all associated DNS servers */
                 setBuildUpdateConfigFlag(getZoneServers($child_id), 'yes', 'build');
             }
         }
     }
 }