Ignore:
Timestamp:
Jan 13, 2020, 1:10:38 AM (5 years ago)
Author:
chronos
Message:
  • Fixed: Wrong condition evaluation in check network availability and port status.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/Network/Network.php

    r867 r868  
    816816    $Output = '';
    817817    $Condition = 'WHERE (`NetworkInterface`.`LastOnline` <= "'.TimeToMysqlDateTime($Time - $MinDuration).'")';
    818     if ($OnlineNow != null) $Condition .= ' AND (`NetworkInterface`.`Online` = '.$OnlineNow.')';
    819     if ($OnlinePrevious != null) $Condition .= ' AND (`NetworkInterface`.`OnlineNotify` = '.$OnlinePrevious.')';
     818    echo($OnlineNow);
     819    if ($OnlineNow >= 0) $Condition .= ' AND (`NetworkInterface`.`Online` = '.$OnlineNow.')';
     820    echo($OnlinePrevious);
     821    if ($OnlinePrevious >= 0) $Condition .= ' AND (`NetworkInterface`.`OnlineNotify` = '.$OnlinePrevious.')';
     822    echo($Condition."\n");
    820823    $DbResult3 = $this->Database->query('SELECT CONCAT_WS("-", `NetworkDevice`.`Name`, NULLIF(`NetworkInterface`.`Name`, "")) AS `Name`, '.
    821824      '`NetworkInterface`.`Online`, `NetworkInterface`.`LastOnline` FROM `NetworkInterface` '.
     
    854857    $NewOffline = $this->OnlineList('Nově offline', 0, 1, $this->MinNotifyTime);
    855858    $Output .= $NewOffline['Report'];
    856     if ($Output != '')
    857     {
    858       $StillOffline = $this->OnlineList('Stále offline', 0, 0, 0);
    859       $Output .= $StillOffline['Report'];
    860     }
    861     $Offline = $this->OnlineList('Offline', 0, null, 0);
     859    $StillOffline = $this->OnlineList('Stále offline', 0, 0, 0);
     860    $Output .= $StillOffline['Report'];
     861    $Offline = $this->OnlineList('Offline', 0, -1, 0);
    862862    return(array('Report' => $Output, 'Count' => $Offline['Count'], 'ShortTitle' => 'Odezva'));
    863863  }
     
    869869    $Output = '';
    870870    $Condition = 'WHERE (`NetworkPort`.`LastOnline` <= "'.TimeToMysqlDateTime($Time - $MinDuration).'")';
    871     if ($OnlineNow != null) $Condition .= ' AND (`NetworkPort`.`Online` = '.$OnlineNow.')';
    872     if ($OnlinePrevious != null) $Condition .= ' AND (`NetworkPort`.`OnlineNotify` = '.$OnlinePrevious.')';
     871    if ($OnlineNow >= null) $Condition .= ' AND (`NetworkPort`.`Online` = '.$OnlineNow.')';
     872    if ($OnlinePrevious >= null) $Condition .= ' AND (`NetworkPort`.`OnlineNotify` = '.$OnlinePrevious.')';
    873873    $DbResult3 = $this->Database->query('SELECT CONCAT(CONCAT_WS("-", `NetworkDevice`.`Name`, NULLIF(`NetworkInterface`.`Name`, "")), ":", `NetworkPort`.`Number`, "(", `NetworkPort`.`Name`, ")") AS `Name`, '.
    874874      '`NetworkPort`.`Online`, `NetworkPort`.`LastOnline` FROM `NetworkPort` '.
     
    909909    $NewOffline = $this->PortCheckList('Nově offline', 0, 1, $this->MinNotifyTime);
    910910    $Output .= $NewOffline['Report'];
    911     if ($Output != '')
    912     {
    913       $StillOffline = $this->PortCheckList('Stále offline', 0, 0, 0);
    914       $Output .= $StillOffline['Report'];
    915     }
    916     $Offline = $this->PortCheckList('Offline', 0, null, 0);
     911    $StillOffline = $this->PortCheckList('Stále offline', 0, 0, 0);
     912    $Output .= $StillOffline['Report'];
     913    $Offline = $this->PortCheckList('Offline', 0, -1, 0);
    917914    return(array('Report' => $Output, 'Count' => $Offline['Count'], 'ShortTitle' => 'Port'));
    918915  }
Note: See TracChangeset for help on using the changeset viewer.