Changeset 818 for trunk/Modules/NetworkConfigRouterOS
- Timestamp:
- Mar 16, 2016, 10:01:02 PM (9 years ago)
- Location:
- trunk/Modules/NetworkConfigRouterOS
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/NetworkConfigRouterOS/Generators/NetwatchImport.php
r793 r818 49 49 array('LastOnline' => TimeToMysqlDateTime($StartTime))); 50 50 51 52 53 54 55 `State`, `Time`, `Duration`) VALUES ('.$Interface['Id'].', '.$Interface['NewOnline'].', "'.56 57 58 59 60 61 62 63 64 51 if($Interface['Online'] != $Interface['NewOnline']) 52 { 53 // Online state changed 54 $DbResult = $this->Database->query('INSERT INTO `NetworkInterfaceUpDown` (`Interface`, 55 `State`, `Time`, `Duration`) VALUES ('.$Interface['Id'].', '.$Interface['NewOnline'].', "'. 56 TimeToMysqlDateTime($StartTime).'", NULL)'); 57 // Update previous record duration in UpDown table 58 $this->Database->query('UPDATE `NetworkInterfaceUpDown` AS `TM` SET `Duration` = TIMESTAMPDIFF(SECOND, '. 59 '`TM`.`Time`, (SELECT `Time` FROM (SELECT * FROM `NetworkInterfaceUpDown`) AS `TA` WHERE (`TA`.`Time` > `TM`.`Time`) '. 60 'AND (`TA`.`Interface`=`TM`.`Interface`) ORDER BY `TA`.`Time` ASC LIMIT 1)) '. 61 'WHERE (`TM`.`Duration` IS NULL) AND (`TM`.`Interface` ='.$Interface['Id'].')'); 62 $this->Database->update('NetworkInterface', '`Id` = "'.$Interface['Id'].'"', 63 array('Online' => $Interface['NewOnline'])); 64 } 65 65 } 66 66 -
trunk/Modules/NetworkConfigRouterOS/NetworkConfigRouterOS.php
r781 r818 40 40 { 41 41 $this->System->Pages['zdarma'] = 'PageFreeAccess'; 42 $this->System->FormManager->RegisterClass('NetworkInterfaceUpDown', array(43 'Title' => 'Změny stavu rozhraní',44 'Table' => 'NetworkInterfaceUpDown',45 'DefaultSortColumn' => 'Time',46 'DefaultSortOrder' => 1,47 'Items' => array(48 'Time' => array('Type' => 'DateTime', 'Caption' => 'Čas', 'Default' => '', 'ReadOnly' => true),49 'Interface' => array('Type' => 'TNetworkInterface', 'Caption' => 'Rozhraní', 'Default' => '', 'ReadOnly' => true),50 'State' => array('Type' => 'TOnlineState', 'Caption' => 'Stav', 'Default' => '', 'ReadOnly' => true),51 'Duration' => array('Type' => 'TimeDiff', 'Caption' => 'Trvání', 'Default' => '', 'ReadOnly' => true),52 ),53 ));54 55 42 $this->System->ModuleManager->Modules['NetworkConfig']->RegisterConfigItem('routeros-dns', 'ConfigRouterOSDNS'); 56 43 $this->System->ModuleManager->Modules['NetworkConfig']->RegisterConfigItem('routeros-dhcp', 'ConfigRouterOSDHCP');
Note:
See TracChangeset
for help on using the changeset viewer.