Changeset 697


Ignore:
Timestamp:
Sep 24, 2014, 12:40:54 PM (10 years ago)
Author:
chronos
Message:
  • Opraveno: U nově vložených položek stavu rozhraní se určuje trvání stavu do budoucna. V předchozím commitu se chybně počítalo trvání do minulosti.
Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Application/Version.php

    r696 r697  
    11<?php
    22
    3 $Revision = 696; // Subversion revision
    4 $DatabaseRevision = 696; // SQL structure revision
    5 $ReleaseTime = strtotime('2014-09-23');
     3$Revision = 697; // Subversion revision
     4$DatabaseRevision = 697; // SQL structure revision
     5$ReleaseTime = strtotime('2014-09-24');
  • trunk/Common/Setup/Updates.php

    r696 r697  
    920920}
    921921
     922function UpdateTo697($Manager)
     923{
     924        $Manager->Execute('ALTER TABLE `NetworkInterfaceUpDown` CHANGE `Duration` `Duration` INT( 11 ) NULL ;');
     925        $Manager->Execute('UPDATE `NetworkInterfaceUpDown` SET `Duration` = NULL');
     926        $Manager->Execute('UPDATE `NetworkInterfaceUpDown` AS `TM` SET `Duration` = TIMESTAMPDIFF(SECOND,
     927    `TM`.`Time`, (SELECT `Time` FROM (SELECT * FROM `NetworkInterfaceUpDown`) AS `TA` WHERE (`TA`.`Time` > `TM`.`Time`)
     928    AND (`TA`.`Interface`=`TM`.`Interface`) ORDER BY `TA`.`Time` ASC LIMIT 1))');
     929}
    922930
    923931class Updates
     
    972980      688 => array('Revision' => 692, 'Function' => 'UpdateTo692'),
    973981      692 => array('Revision' => 696, 'Function' => 'UpdateTo696'),
     982      696 => array('Revision' => 697, 'Function' => 'UpdateTo697'),
    974983    ));
    975984  }
  • trunk/Modules/NetworkConfigRouterOS/Generators/NetwatchImport.php

    r696 r697  
    5757    {
    5858        // Online state changed
    59       $System->Database->query('INSERT INTO `NetworkInterfaceUpDown` (`Interface`,
     59      $DbResult = $System->Database->query('INSERT INTO `NetworkInterfaceUpDown` (`Interface`,
    6060        `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'].')');
    6567      $System->Database->update('NetworkInterface', '`Id` = "'.$Interface['Id'].'"',
    6668        array('Online' => $Interface['NewOnline']));
Note: See TracChangeset for help on using the changeset viewer.