- Timestamp:
- Mar 16, 2016, 10:01:02 PM (9 years ago)
- File:
-
- 1 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
Note:
See TracChangeset
for help on using the changeset viewer.