Changeset 575


Ignore:
Timestamp:
Oct 2, 2013, 8:26:20 PM (11 years ago)
Author:
chronos
Message:
  • Opraveno: Nastavení online stavu rozhraní a zařízení na nedostupné pokud čas LastOnline je starší než perioda. Pokud se neprováděla aktualizace, tak zařízení se tvářila falešně jako online.
Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Common/Update.php

    r548 r575  
    250250      if($Def['Type'] == 'Password') $Output .= '<input type="password" name="'.$Def['Name'].'"/>';
    251251      if($Def['Type'] == 'Integer') $Output .= '<input type="text" name="'.$Def['Name'].'" value="'.$Value.'"/>';
     252      if($Def['Type'] == 'Float') $Output .= '<input type="text" name="'.$Def['Name'].'" value="'.$Value.'"/>';
    252253      if($Def['Type'] == 'Boolean') $Output .= '<input type="text" name="'.$Def['Name'].'" value="'.$Value.'"/>';
    253254    }
     
    270271        $Value = $_POST[$Def['Name']];
    271272      if($Def['Type'] == 'Integer') if(array_key_exists($Def['Name'], $_POST))
     273        $Value = $_POST[$Def['Name']];
     274      if($Def['Type'] == 'Float') if(array_key_exists($Def['Name'], $_POST))
    272275        $Value = $_POST[$Def['Name']];
    273276      if($Def['Type'] == 'Boolean') if(array_key_exists($Def['Name'], $_POST))
  • trunk/Common/Version.php

    r574 r575  
    11<?php
    22
    3 $Revision = 574; // Subversion revision
     3$Revision = 575; // Subversion revision
    44$DatabaseRevision = 574; // SQL structure revision
    5 $ReleaseTime = '2013-09-29';
     5$ReleaseTime = '2013-10-02';
  • trunk/Modules/NetworkConfigRouterOS/Generators/NetwatchImport.php

    r548 r575  
    1212  $StartTime = time();
    1313
     14  // Load netwatch status from all DHCP routers
    1415  $DbResult3 = $System->Database->query('SELECT DHCP, AddressRange, Mask FROM `NetworkSubnet` WHERE (`Configure` = 1) AND (`Member` IS NULL) GROUP BY DHCP');
    15   //echo($DbResult3->num_rows);
    1616  while($Subnet = $DbResult3->fetch_assoc())
    1717  {
     
    2424    foreach($List as $Properties)
    2525    {
    26       //echo($Properties['host'].', ');
    2726      if($Properties['status'] == 'up')
    2827      {
    29         $Online = 1;
    30         $Values = array('Online' => $Online, 'LastOnline' => 'NOW()');
    31         //echo($Properties['host']." up\n");
    32       } else
    33       {
    34         $Online = 0;
    35         $Values = array('Online' => $Online);
    36         //echo($Properties['host']." down\n");
    37       }
    38 
    39       $DbResult = $System->Database->update('NetworkInterface', '`LocalIP` = "'.$Properties['host'].'"', $Values);
     28        $DbResult = $System->Database->update('NetworkInterface', '`LocalIP` = "'.$Properties['host'].'"',
     29          array('Online' => $Online, 'LastOnline' => TimeToMysqlDateTime($StartTime)));
     30      }
    4031    }
    41   }
     32  }
     33  $DbResult = $System->Database->update('NetworkInterface', '`LastOnline` < "'.TimeToMysqlDateTime($StartTime).'"', array('Online' => 0));
    4234
    4335  // Update device online state
    44   $DbResult = $System->Database->select('NetworkDevice', 'Id', '`Used`=1');
     36  $DbResult = $System->Database->select('NetworkInterface', '`Device`, SUM(`Online`) AS `SumOnline`', '`Online` = 1 GROUP BY `Device`');
    4537  while($Device = $DbResult->fetch_assoc())
    4638  {
    47     $DbResult2 = $System->Database->select('NetworkInterface', 'SUM(`Online`) AS `SumOnline`', '`Device`='.$Device['Id']);
    48     $DbRow = $DbResult2->fetch_array();
    49     if($DbRow['SumOnline'] > 0) $Online = 1;
    50       else $Online = 0; 
    51     $Values = array('Online' => $Online);
    52     if($Online == 1) $Values['LastOnline'] = 'NOW()';
    53     $System->Database->update('NetworkDevice', 'Id='.$Device['Id'], $Values);
     39    if($Device['SumOnline'] > 0)
     40      $System->Database->update('NetworkDevice', 'Id='.$Device['Device'], array('LastOnline' => TimeToMysqlDateTime($StartTime)));
    5441  }
     42  $DbResult = $System->Database->update('NetworkDevice', '`LastOnline` < "'.TimeToMysqlDateTime($StartTime).'"', array('Online' => 0));
    5543
    5644  // Update interface online statistics
Note: See TracChangeset for help on using the changeset viewer.