Changeset 814
- Timestamp:
- Mar 9, 2016, 10:07:18 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Application/UpdateTrace.php
r808 r814 1946 1946 "VALUES (NULL , 'Kontrola pokladen', ".$DbRow['Id'].", '".$ActionId."', '1');"); 1947 1947 } 1948 1948 } 1949 1950 function UpdateTo814($Manager) 1951 { 1952 $Manager->Execute('CREATE TABLE IF NOT EXISTS `NetworkPort` ( 1953 `Id` int(11) NOT NULL AUTO_INCREMENT, 1954 `Name` varchar(255) NOT NULL, 1955 `Interface` int(11) NOT NULL, 1956 `Number` int(11) NOT NULL, 1957 `Enabled` int(11) NOT NULL, 1958 `Online` int(11) NOT NULL, 1959 `LastOnline` datetime NULL, 1960 `OnlineNotify` int(11) NOT NULL, 1961 PRIMARY KEY (`Id`), 1962 KEY `Interface` (`Interface`) 1963 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;'); 1964 1965 $Manager->Execute('ALTER TABLE `NetworkPort` 1966 ADD CONSTRAINT `NetworkPort_ibfk_1` FOREIGN KEY (`Interface`) REFERENCES `NetworkInterface` (`Id`);'); 1967 $Manager->Execute('ALTER TABLE `NetworkInterface` ADD `Enabled` INT NOT NULL DEFAULT "1" AFTER `OnlineNotify`;'); 1968 $Manager->Execute('ALTER TABLE `NetworkInterface` CHANGE `LastOnline` `LastOnline` DATETIME NULL;'); 1969 $Manager->Execute('UPDATE `NetworkInterface` SET `LastOnline` = NULL WHERE `LastOnline` = "0000-00-00 00:00:00"'); 1970 $Manager->Execute('ALTER TABLE `NetworkDevice` CHANGE `LastOnline` `LastOnline` DATETIME NULL;'); 1971 $Manager->Execute('UPDATE `NetworkDevice` SET `LastOnline` = NULL WHERE `LastOnline` = "0000-00-00 00:00:00"'); 1949 1972 } 1950 1973 … … 2037 2060 803 => array('Revision' => 807, 'Function' => 'UpdateTo807'), 2038 2061 807 => array('Revision' => 808, 'Function' => 'UpdateTo808'), 2062 808 => array('Revision' => 814, 'Function' => 'UpdateTo814'), 2039 2063 )); 2040 2064 } -
trunk/Application/Version.php
r813 r814 1 1 <?php 2 2 3 $Revision = 81 3; // Subversion revision4 $DatabaseRevision = 8 08; // SQL structure revision3 $Revision = 814; // Subversion revision 4 $DatabaseRevision = 814; // SQL structure revision 5 5 $ReleaseTime = strtotime('2016-03-09'); -
trunk/Modules/Network/Network.php
r813 r814 120 120 function DoStart() 121 121 { 122 $this->System->ModuleManager->Modules['Notify']->RegisterCheck('NetworkReachability', array($this, 'ReachabilityCheck')); 122 $this->System->ModuleManager->Modules['Notify']->RegisterCheck('NetworkReachability', 123 array($this, 'ReachabilityCheck')); 124 $this->System->ModuleManager->Modules['Notify']->RegisterCheck('NetworkPort', 125 array($this, 'PortCheck')); 126 123 127 124 128 $this->System->RegisterPage('network', 'PageNetwork'); … … 188 192 'ExternalIP' => array('Type' => 'IPv4Address', 'Caption' => 'Veřejná IPv4', 'Default' => '', 'Null' => true), 189 193 'Device' => array('Type' => 'TNetworkDevice', 'Caption' => 'Zařízení', 'Default' => ''), 194 'Enabled' => array('Type' => 'Boolean', 'Caption' => 'Povoleno', 'Default' => '1'), 190 195 'Online' => array('Type' => 'TOnlineState', 'Caption' => 'Běží', 'Default' => '0', 'ReadOnly' => true), 191 196 'LastOnline' => array('Type' => 'DateTime', 'Caption' => 'Naposledy běželo', 'Default' => '', 'ReadOnly' => true), … … 194 199 'Signal' => array('Type' => 'TNetworkSignalListInterface', 'Caption' => 'Signál', 'Default' => ''), 195 200 'Wireless' => array('Type' => 'TNetworkInterfaceWirelessListInterface', 'Caption' => 'Bezdrátové spoje', 'Default' => ''), 201 'Ports' => array('Type' => 'TDevicePortListInterface', 'Caption' => 'Síťové porty', 'Default' => ''), 196 202 ), 197 203 )); … … 225 231 'AddressRangeIPv6' => array('Type' => 'String', 'Caption' => 'Rozsah adres IPv6', 'Default' => ''), 226 232 'Configure' => array('Type' => 'Boolean', 'Caption' => 'Nastavovat', 'Default' => ''), 233 ), 234 )); 235 $this->System->FormManager->RegisterClass('NetworkPort', array( 236 'Title' => 'Síťový port', 237 'Table' => 'NetworkPort', 238 'Items' => array( 239 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''), 240 'Number' => array('Type' => 'Integer', 'Caption' => 'Číslo', 'Default' => ''), 241 'Interface' => array('Type' => 'TNetworkInterface', 'Caption' => 'Rozhraní', 'Default' => ''), 242 'Enabled' => array('Type' => 'Boolean', 'Caption' => 'Povoleno', 'Default' => '1'), 243 'Online' => array('Type' => 'TOnlineState', 'Caption' => 'Běží', 'Default' => '0', 'ReadOnly' => true), 244 'LastOnline' => array('Type' => 'DateTime', 'Caption' => 'Naposledy běželo', 'Default' => '', 'ReadOnly' => true), 227 245 ), 228 246 )); … … 510 528 'Filter' => '1', 511 529 )); 530 $this->System->FormManager->RegisterFormType('TDevicePortListInterface', array( 531 'Type' => 'ManyToOne', 532 'Table' => 'NetworkPort', 533 'Id' => 'Id', 534 'Ref' => 'Interface', 535 'Filter' => '1', 536 )); 512 537 $this->System->FormManager->RegisterFormType('TNetworkLinkType', array( 513 538 'Type' => 'Reference', … … 654 679 } 655 680 } 681 682 function PortCheckList($Title, $OnlineNow, $OnlinePrevious, $MinDuration) 683 { 684 $Time = time(); 685 $OnlineText = array('<span style="color:red;">Nedostupný</span>', '<span style="color:green;">Dostupný</span>'); 686 $Output = ''; 687 $Condition = 'WHERE (`NetworkPort`.`Online` = '.$OnlineNow.') AND (`NetworkPort`.`OnlineNotify` = '.$OnlinePrevious.') '. 688 'AND (`NetworkPort`.`LastOnline` <= "'.TimeToMysqlDateTime($Time - $MinDuration).'")'; 689 $DbResult3 = $this->Database->query('SELECT CONCAT(CONCAT_WS("-", `NetworkDevice`.`Name`, NULLIF(`NetworkInterface`.`Name`, "")), ":", `NetworkPort`.`Number`) AS `Name`, '. 690 '`NetworkPort`.`Online`, `NetworkPort`.`LastOnline` FROM `NetworkPort` '. 691 'LEFT JOIN `NetworkInterface` ON `NetworkInterface`.`Id` = `NetworkPort`.`Interface` '. 692 'LEFT JOIN `NetworkDevice` ON `NetworkDevice`.`Id` = `NetworkInterface`.`Device` '. 693 $Condition.' AND (`NetworkDevice`.`PermanentOnline`=1) AND (`NetworkDevice`.`Used`=1) AND '. 694 '(`NetworkInterface`.`LocalIP` != "") AND (`NetworkPort`.`Enabled` = 1)'. 695 'ORDER BY `Name` ASC'); 696 echo($this->Database->LastQuery); 697 if($DbResult3->num_rows > 0) 698 { 699 $Output .= $Title.'<br/>'; 700 $Output .= '<table>'. 701 '<tr><th align="center">Jméno</th><th align="center">Stav</th><th align="center">Čas</th><th align="center">Trvání</th></tr>'."\n"; 702 while($Item = $DbResult3->fetch_assoc()) 703 { 704 $Duration = $Time - MysqlDateTimeToTime($Item['LastOnline']); 705 $DurationText = sprintf('%02d', floor($Duration / 3600 % 24)).':'. 706 sprintf('%02d', floor($Duration / 60 % 60)).':'. 707 sprintf('%02d', floor($Duration % 60)); 708 $Days = floor($Duration / (60 * 60 * 24)); 709 if($Days > 0) $DurationText = $Days.' dnů '.$DurationText; 710 711 $Output .= '<tr><td>'.$Item['Name'].'</td><td>'.$OnlineText[$Item['Online']]. 712 '</td><td>'.$Item['LastOnline'].'</td><td>'.$DurationText.'</td></tr>'."\n"; 713 } 714 $Output .= '</table><br/>'."\n"; 715 } 716 $this->Database->query('UPDATE `NetworkPort` SET `OnlineNotify` = `Online` '. 717 $Condition); 718 return $Output; 719 } 720 721 function PortCheck() 722 { 723 $Output = ''; 724 $Output = $this->PortCheckList('Nově online', 1, 0, 0); 725 $Output .= $this->PortCheckList('Nově offline', 0, 1, 5 * 60); 726 if($Output != '') $Output .= $this->PortCheckList('Stále offline', 0, 0, 0); 727 return($Output); 728 } 656 729 } -
trunk/Modules/NetworkConfigAirOS/Generators/Signal.php
r781 r814 11 11 // Load netwatch status from all DHCP routers 12 12 $DbResult3 = $this->Database->query('SELECT `Id`, `LoginName`, `LoginPassword`, '. 13 14 13 '(SELECT `LocalIP` FROM `NetworkInterface` WHERE `NetworkInterface`.`Device` = `NetworkDevice`.`Id` LIMIT 1) AS `LocalIP` '. 14 'FROM `NetworkDevice` WHERE (`API` = 2) AND (`Used` = 1)'); 15 15 while($Device = $DbResult3->fetch_assoc()) 16 16 { … … 34 34 $RateTx = $Properties['tx']; 35 35 $this->Database->insert('NetworkSignal', array('MAC' => $Properties['mac'], 36 37 36 'Value' => $Strength, 'RateRx' => $RateRx, 'RateTx' => $RateTx, 37 'Time' => TimeToMysqlDateTime($Time), 'Interface' => $Interface, 'Device' => $Device['Id'])); 38 38 } 39 39 }
Note:
See TracChangeset
for help on using the changeset viewer.