Changeset 777 for trunk/Modules/NetworkConfigRouterOS/Generators/DNS.php
- Timestamp:
- Jan 2, 2016, 3:45:31 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/NetworkConfigRouterOS/Generators/DNS.php
r739 r777 27 27 } 28 28 29 $Items = array(); 30 29 31 // Devices, Interfaces 30 $Items = array();31 32 $DbResult2 = $System->Database->query('SELECT `NetworkInterface`.*, `NetworkDevice`.`Name` AS `DeviceName` FROM `NetworkInterface` '. 32 33 'JOIN `NetworkDevice` ON `NetworkInterface`.`Device`=`NetworkDevice`.`Id` '. 33 'WHERE `NetworkDevice`.`Used`=1');34 'WHERE (`NetworkDevice`.`Used`=1)'); 34 35 while($Interface = $DbResult2->fetch_assoc()) 35 36 { 36 37 $Name = $Interface['DeviceName']; 37 38 if($Interface['Name'] != '') $Name .= '-'.$Interface['Name']; 38 $Name .= '.'.$DomainName; 39 $Items[] = array('name' => $Name, 'address' => $Interface['LocalIP'], 'ttl' => '1d'); 39 $NameFull = $Name.'.'.$DomainName; 40 $NameExtFull = $Name.'-ext.'.$DomainName; 41 if($Interface['LocalIP'] != '') 42 $Items[] = array('name' => $NameFull, 'address' => $Interface['LocalIP']); 43 if($Interface['IPv6'] != '') 44 $Items[] = array('name' => $NameFull, 'address' => $Interface['IPv6']); 45 if($Interface['ExternalIP'] != '') 46 $Items[] = array('name' => $NameExtFull, 'address' => $Interface['ExternalIP']); 40 47 } 41 48 42 49 // Domain aliases 43 $DbResult2 = $System->Database->query('SELECT `NetworkDomainAlias`.*, `NetworkInterface`.`LocalIP` AS `LocalIP` FROM `NetworkDomainAlias` '. 44 'JOIN `NetworkDevice` ON `NetworkDomainAlias`.`Target`=`NetworkDevice`.`Name` '. 50 $DbResult2 = $System->Database->query('SELECT `NetworkDomainAlias`.*, `NetworkInterface`.`LocalIP` AS `LocalIP`, '. 51 '`NetworkInterface`.`IPv6` AS `IPv6`, `NetworkInterface`.`ExternalIP` AS `ExternalIP` FROM `NetworkDomainAlias` '. 52 'JOIN `NetworkDevice` ON SUBSTR(`NetworkDomainAlias`.`Target`, 1, LENGTH(`NetworkDevice`.`Name` ))=`NetworkDevice`.`Name` '. 45 53 'JOIN `NetworkInterface` ON `NetworkInterface`.`Device`=`NetworkDevice`.`Id` '. 46 'WHERE `NetworkDevice`.`Used`=1'); 54 'WHERE (`NetworkDevice`.`Used`=1) AND '. 55 '(CONCAT_WS("-", `NetworkDevice`.`Name`, NULLIF(`NetworkInterface`.`Name`, "")) = `NetworkDomainAlias`.`Target`)'); 47 56 while($Alias = $DbResult2->fetch_assoc()) 48 57 { 49 58 $Name = $Alias['Name']; 50 $Name .= '.'.$DomainName; 51 $Items[] = array('name' => $Name, 'address' => $Alias['LocalIP'], 'ttl' => $Domain['TTL']); 59 $NameFull = $Name.'.'.$DomainName; 60 $NameExtFull = $Name.'-ext.'.$DomainName; 61 if($Alias['LocalIP'] != '') 62 $Items[] = array('name' => $NameFull, 'address' => $Alias['LocalIP']); 63 if($Alias['IPv6'] != '') 64 $Items[] = array('name' => $NameFull, 'address' => $Alias['IPv6']); 65 if($Alias['ExternalIP'] != '') 66 $Items[] = array('name' => $NameExtFull, 'address' => $Alias['ExternalIP']); 52 67 } 53 68 54 69 $DbResult2 = $System->Database->query('SELECT * FROM `NetworkDomainServer` WHERE `Domain`='.$Domain['Id']); 55 if($DbResult2->num_rows > 0)70 while($Server = $DbResult2->fetch_assoc()) 56 71 { 57 $Server = $DbResult2->fetch_assoc();58 72 $Routerboard->HostName = $Server['Address']; 59 $Routerboard->ListUpdate($Path, array('name', 'address' , 'ttl'), $Items);73 $Routerboard->ListUpdate($Path, array('name', 'address'), $Items); 60 74 } 61 75 }
Note:
See TracChangeset
for help on using the changeset viewer.