- Timestamp:
- Sep 24, 2014, 12:40:54 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/NetworkConfigRouterOS/Generators/NetwatchImport.php
r696 r697 57 57 { 58 58 // Online state changed 59 $ System->Database->query('INSERT INTO `NetworkInterfaceUpDown` (`Interface`,59 $DbResult = $System->Database->query('INSERT INTO `NetworkInterfaceUpDown` (`Interface`, 60 60 `State`, `Time`, `Duration`) VALUES ('.$Interface['Id'].', '.$Interface['NewOnline'].', "'. 61 TimeToMysqlDateTime($StartTime).'", IFNULL(TIMESTAMPDIFF(SECOND, '. 62 '(SELECT `Time` FROM `NetworkInterfaceUpDown` AS `TA` WHERE (`TA`.`Time` < "'.TimeToMysqlDateTime($StartTime).'") '. 63 'AND (`TA`.`Interface`='.$Interface['Id'].') ORDER BY `TA`.`Time` DESC LIMIT 1), "'.TimeToMysqlDateTime($StartTime).'"), 0))'); 64 echo($System->Database->LastQuery."\n"); 61 TimeToMysqlDateTime($StartTime).'", NULL)'); 62 // Update previous record duration in UpDown table 63 $System->Database->query('UPDATE `NetworkInterfaceUpDown` AS `TM` SET `Duration` = TIMESTAMPDIFF(SECOND, '. 64 '`TM`.`Time`, (SELECT `Time` FROM (SELECT * FROM `NetworkInterfaceUpDown`) AS `TA` WHERE (`TA`.`Time` > `TM`.`Time`) '. 65 'AND (`TA`.`Interface`=`TM`.`Interface`) ORDER BY `TA`.`Time` ASC LIMIT 1)) '. 66 'WHERE (`TM`.`Duration` IS NULL) AND (`TM`.`Interface` ='.$Interface['Id'].')'); 65 67 $System->Database->update('NetworkInterface', '`Id` = "'.$Interface['Id'].'"', 66 68 array('Online' => $Interface['NewOnline']));
Note:
See TracChangeset
for help on using the changeset viewer.