Changeset 855
- Timestamp:
- Apr 8, 2018, 7:40:10 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Application/UpdateTrace.php
r844 r855 2041 2041 { 2042 2042 $Manager->Execute('ALTER TABLE `DocumentLine` ADD `Yearly` BOOLEAN NOT NULL DEFAULT FALSE AFTER `Shortcut`;'); 2043 } 2044 2045 function UpdateTo855($Manager) 2046 { 2047 $Manager->Execute('CREATE TABLE IF NOT EXISTS `NetworkDeviceLog` ( 2048 `Id` int(11) NOT NULL AUTO_INCREMENT, 2049 `Time` datetime NOT NULL, 2050 `Device` int(11) NOT NULL, 2051 `Message` varchar(255) NOT NULL, 2052 `Tags` varchar(255) NOT NULL, 2053 PRIMARY KEY (`Id`), 2054 KEY `Device` (`Device`) 2055 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;'); 2056 $Manager->Execute('ALTER TABLE `NetworkDeviceLog` 2057 ADD CONSTRAINT `NetworkDeviceLog_ibfk_1` FOREIGN KEY (`Device`) REFERENCES `NetworkDevice` (`Id`);'); 2043 2058 } 2044 2059 … … 2138 2153 831 => array('Revision' => 838, 'Function' => 'UpdateTo838'), 2139 2154 838 => array('Revision' => 844, 'Function' => 'UpdateTo844'), 2155 844 => array('Revision' => 855, 'Function' => 'UpdateTo855'), 2140 2156 )); 2141 2157 } -
trunk/Application/Version.php
r849 r855 1 1 <?php 2 2 3 $Revision = 8 49; // Subversion revision4 $DatabaseRevision = 8 44; // SQL structure revision5 $ReleaseTime = strtotime('201 7-09-05');3 $Revision = 855; // Subversion revision 4 $DatabaseRevision = 855; // SQL structure revision 5 $ReleaseTime = strtotime('2018-04-08'); -
trunk/Modules/Network/Network.php
r849 r855 142 142 $this->System->RegisterPage(array('network', 'frequency-plan'), 'PageFrequencyPlan'); 143 143 144 $this->System->RegisterCommandLine('config', array($this, 'ImportNetworkLog')); 145 144 146 $this->System->FormManager->RegisterClass('NetworkDomainAlias', array( 145 147 'Title' => 'Alias domény', … … 178 180 'LoginPassword' => array('Type' => 'String', 'Caption' => 'Přihlašovací heslo', 'Default' => '', 'Null' => true, 'NotInList' => true), 179 181 'API' => array('Type' => 'TDeviceAPIType', 'Caption' => 'API', 'Default' => '', 'Null' => true), 182 'Logs' => array('Type' => 'TDeviceLogList', 'Caption' => 'Záznamy', 'Default' => ''), 180 183 ), 181 184 'AfterInsert' => array($this, 'AfterInsertNetworkDevice'), … … 190 193 'ShowOnline' => array('Type' => 'Boolean', 'Caption' => 'Ukázat online', 'Default' => '0'), 191 194 'IconName' => array('Type' => 'String', 'Caption' => 'Jméno ikony', 'Default' => '0'), 195 ), 196 )); 197 $this->System->FormManager->RegisterClass('NetworkDeviceLog', array( 198 'Title' => 'Zprávy zařízení', 199 'Table' => 'NetworkDeviceLog', 200 'DefaultSortColumn' => 'Time', 201 'DefaultSortOrder' => 1, 202 'Items' => array( 203 'Time' => array('Type' => 'DateTime', 'Caption' => 'Čas', 'Default' => ''), 204 'Device' => array('Type' => 'TNetworkDevice', 'Caption' => 'Zařízení', 'Default' => ''), 205 'Message' => array('Type' => 'String', 'Caption' => 'Zpáva', 'Default' => ''), 206 'Tags' => array('Type' => 'String', 'Caption' => 'Značky', 'Default' => ''), 192 207 ), 193 208 )); … … 650 665 'Filter' => '1', 651 666 )); 667 $this->System->FormManager->RegisterFormType('TDeviceLogList', array( 668 'Type' => 'ManyToOne', 669 'Table' => 'NetworkDeviceLog', 670 'Id' => 'Id', 671 'Ref' => 'Device', 672 'Filter' => '1', 673 )); 652 674 $this->System->FormManager->RegisterFormType('TNetworkLinkListInterface', array( 653 675 'Type' => 'ManyToOne', … … 725 747 $this->Database->query('DELETE FROM `NetworkInterfaceWireless` WHERE `NetworkInterface`='.$Id); 726 748 $this->Database->query('DELETE FROM `NetworkInterfaceLatency` WHERE `Interface`='.$Id); 749 } 750 751 function ImportNetworkLog($Parameters) 752 { 753 global $Config; 754 755 $DbResult = $this->System->Database->select('NetworkDeviceLog', 'Time', 756 '1 ORDER BY Time DESC LIMIT 1'); 757 if ($DbResult->num_rows > 0) 758 { 759 $DbRow = $DbResult->fetch_assoc(); 760 $WhereTime = ' AND (`Time` > "'.$DbRow['Time'].'")'; 761 } else $WhereTime = ''; 762 763 $RemoteDb = new Database(); 764 $RemoteDb->Connect($Config['NetworkLog']['Host'], $Config['NetworkLog']['User'], 765 $Config['NetworkLog']['Password'], $Config['NetworkLog']['Database']); 766 $DbResult = $RemoteDb->select('SystemEvents', '*', '`ReceivedAt`>"'. TimeToMysqlDate($StartTime).'"'.$WhereTime.' ORDER BY `Time` DESC'); 767 while ($DbRow = $DbResult->fetch_array()) 768 { 769 $DbResult2 = $this->System->Database->select('NetworkInterface', 'Device, CONCAT(CONCAT_WS("-", `NetworkDevice`.`Name`, NULLIF(`NetworkInterface`.`Name`, "")), ".") AS `Name` ', '`Name` LIKE "'.$DbRow['FromHost'].'"'); 770 if ($DbResult2->num_rows > 0) 771 { 772 $DbRow2 = $DbResult2->fetch_assoc(); 773 $DeviceID = $DbRow2['Device']; 774 $this->System->Database->insert('NetworkDeviceLog', array('Time' => $DbRow['ReceivedAt'], 775 'Device' => $DeviceId, 'Message' => $DbRow['Message'], 'Tags' => $DbRow['SysLogTag'])); 776 } else echo('Host '.$DbRow['Host'].' not paired with network device.'."\n"); 777 } 727 778 } 728 779
Note:
See TracChangeset
for help on using the changeset viewer.