Changeset 739
- Timestamp:
- May 23, 2015, 12:07:08 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Application/Version.php
r738 r739 1 1 <?php 2 2 3 $Revision = 73 8; // Subversion revision4 $DatabaseRevision = 73 6; // SQL structure revision5 $ReleaseTime = strtotime('2015-0 4-14');3 $Revision = 739; // Subversion revision 4 $DatabaseRevision = 739; // SQL structure revision 5 $ReleaseTime = strtotime('2015-05-22'); -
trunk/Common/Setup/Updates.php
r738 r739 1343 1343 $Manager->Execute('ALTER TABLE `NetworkLinkType` 1344 1344 MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;'); 1345 } 1346 1347 function UpdateTo739($Manager) 1348 { 1349 $Manager->Execute('ALTER TABLE `NetworkDomain` ADD KEY (`Parent`);'); 1350 $Manager->Execute('ALTER TABLE `NetworkDomain` ADD FOREIGN KEY (`Parent`) REFERENCES `NetworkDomain`(`Id`) ON DELETE RESTRICT ON UPDATE RESTRICT;'); 1351 1352 $Manager->Execute('CREATE TABLE IF NOT EXISTS `NetworkDomainServer` ( 1353 `Id` int(11) NOT NULL AUTO_INCREMENT, 1354 `Address` varchar(255) NOT NULL, 1355 `Domain` int(11) NOT NULL, 1356 `Sequence` int(11) NOT NULL 1357 ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;'); 1358 1359 $Manager->Execute('ALTER TABLE `NetworkDomainServer` 1360 ADD PRIMARY KEY (`Id`), ADD KEY `Domain` (`Domain`);'); 1361 1362 $Manager->Execute('ALTER TABLE `NetworkDomainServer` 1363 ADD CONSTRAINT `NetworkDomainServer_ibfk_1` FOREIGN KEY (`Domain`) REFERENCES `NetworkDomain` (`Id`);'); 1364 1345 1365 } 1346 1366 … … 1411 1431 731 => array('Revision' => 735, 'Function' => 'UpdateTo735'), 1412 1432 735 => array('Revision' => 736, 'Function' => 'UpdateTo736'), 1433 736 => array('Revision' => 739, 'Function' => 'UpdateTo739'), 1413 1434 )); 1414 1435 } -
trunk/Modules/Network/Network.php
r738 r739 294 294 'Refresh' => array('Type' => 'Integer', 'Caption' => 'Obnovení', 'Default' => '28800'), 295 295 'TTL' => array('Type' => 'Integer', 'Caption' => 'TTL', 'Default' => '86400', 'Suffix' => 'sekund'), 296 'Servers' => array('Type' => 'TNetworkDomainServerList', 'Caption' => 'Servery', 'Default' => ''), 296 297 ), 297 298 )); … … 301 302 'Id' => 'Id', 302 303 'Name' => 'Name', 304 'Filter' => '1', 305 )); 306 $this->System->FormManager->RegisterClass('NetworkDomainServer', array( 307 'Title' => 'Doménový server', 308 'Table' => 'NetworkDomainServer', 309 'DefaultSortColumn' => 'Address', 310 'DefaultSortOrder' => 1, 311 'Items' => array( 312 'Address' => array('Type' => 'String', 'Caption' => 'Adresa', 'Default' => ''), 313 'Domain' => array('Type' => 'TNetworkDomain', 'Caption' => 'Doména', 'Default' => ''), 314 'Sequence' => array('Type' => 'Integer', 'Caption' => 'Pořadí', 'Default' => '1'), 315 ), 316 )); 317 $this->System->FormManager->RegisterFormType('TNetworkDomainServerList', array( 318 'Type' => 'ManyToOne', 319 'Table' => 'NetworkDomainServer', 320 'Id' => 'Id', 321 'Ref' => 'Domain', 303 322 'Filter' => '1', 304 323 )); -
trunk/Modules/NetworkConfigRouterOS/Generators/DNS.php
r738 r739 13 13 $Routerboard->Debug = true; 14 14 15 // Devices, Interfaces 16 $Items = array(); 17 $DbResult = $System->Database->query('SELECT `NetworkInterface`.*, `NetworkDevice`.`Name` AS `DeviceName` FROM `NetworkInterface` '. 18 'JOIN `NetworkDevice` ON `NetworkInterface`.`Device`=`NetworkDevice`.`Id` '. 19 'WHERE `NetworkDevice`.`Used`=1'); 20 while($Interface = $DbResult->fetch_assoc()) 15 $DbResult = $System->Database->query('SELECT * FROM `NetworkDomain`'); 16 while($Domain = $DbResult->fetch_assoc()) 21 17 { 22 $Name = $Interface['DeviceName']; 23 if($Interface['Name'] != '') $Name .= '-'.$Interface['Name']; 24 $Name .= '.zdechov.net'; 25 $Items[] = array('name' => $Name, 'address' => $Interface['LocalIP'], 'ttl' => '1d'); 18 $DomainName = $Domain['Name']; 19 20 // Get full domain name from parent items 21 $CurrentDomain = $Domain; 22 while($CurrentDomain['Parent'] > 0) 23 { 24 $DbResult2 = $System->Database->query('SELECT * FROM `NetworkDomain` WHERE `Id`='.$CurrentDomain['Parent']); 25 $CurrentDomain = $DbResult2->fetch_assoc(); 26 $DomainName .= '.'.$CurrentDomain['Name']; 27 } 28 29 // Devices, Interfaces 30 $Items = array(); 31 $DbResult2 = $System->Database->query('SELECT `NetworkInterface`.*, `NetworkDevice`.`Name` AS `DeviceName` FROM `NetworkInterface` '. 32 'JOIN `NetworkDevice` ON `NetworkInterface`.`Device`=`NetworkDevice`.`Id` '. 33 'WHERE `NetworkDevice`.`Used`=1'); 34 while($Interface = $DbResult2->fetch_assoc()) 35 { 36 $Name = $Interface['DeviceName']; 37 if($Interface['Name'] != '') $Name .= '-'.$Interface['Name']; 38 $Name .= '.'.$DomainName; 39 $Items[] = array('name' => $Name, 'address' => $Interface['LocalIP'], 'ttl' => '1d'); 40 } 41 42 // Domain aliases 43 $DbResult2 = $System->Database->query('SELECT `NetworkDomainAlias`.*, `NetworkInterface`.`LocalIP` AS `LocalIP` FROM `NetworkDomainAlias` '. 44 'JOIN `NetworkDevice` ON `NetworkDomainAlias`.`Target`=`NetworkDevice`.`Name` '. 45 'JOIN `NetworkInterface` ON `NetworkInterface`.`Device`=`NetworkDevice`.`Id` '. 46 'WHERE `NetworkDevice`.`Used`=1'); 47 while($Alias = $DbResult2->fetch_assoc()) 48 { 49 $Name = $Alias['Name']; 50 $Name .= '.'.$DomainName; 51 $Items[] = array('name' => $Name, 'address' => $Alias['LocalIP'], 'ttl' => $Domain['TTL']); 52 } 53 54 $DbResult2 = $System->Database->query('SELECT * FROM `NetworkDomainServer` WHERE `Domain`='.$Domain['Id']); 55 if($DbResult2->num_rows > 0) 56 { 57 $Server = $DbResult2->fetch_assoc(); 58 $Routerboard->HostName = $Server['Address']; 59 $Routerboard->ListUpdate($Path, array('name', 'address', 'ttl'), $Items); 60 } 26 61 } 27 28 // Domain aliases29 $DbResult = $System->Database->query('SELECT `NetworkDomainAlias`.*, `NetworkInterface`.`LocalIP` AS `LocalIP` FROM `NetworkDomainAlias` '.30 'JOIN `NetworkDevice` ON `NetworkDomainAlias`.`Target`=`NetworkDevice`.`Name` '.31 'JOIN `NetworkInterface` ON `NetworkInterface`.`Device`=`NetworkDevice`.`Id` '.32 'WHERE `NetworkDevice`.`Used`=1');33 while($Alias = $DbResult->fetch_assoc())34 {35 $Name = $Alias['Name'];36 $Name .= '.zdechov.net';37 $Items[] = array('name' => $Name, 'address' => $Alias['LocalIP'], 'ttl' => '1d');38 }39 40 $Routerboard->HostName = '192.168.10.1';41 $Routerboard->ListUpdate($Path, array('name', 'address', 'ttl'), $Items);
Note:
See TracChangeset
for help on using the changeset viewer.