Changeset 945


Ignore:
Timestamp:
Dec 7, 2022, 12:25:42 AM (17 months ago)
Author:
chronos
Message:
  • Fixed: New offline devices and ports were not properly notified.
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Application/Version.php

    r944 r945  
    11<?php
    22
    3 $Revision = 943; // Subversion revision
     3$Revision = 945; // Subversion revision
    44$DatabaseRevision = 939; // SQL structure revision
    55$ReleaseTime = strtotime('2022-12-06');
  • trunk/Modules/Network/Network.php

    r944 r945  
    892892  }
    893893
    894   function OnlineList(string $Title, string $OnlineNow, string $OnlinePrevious, int $MinDuration): array
     894  function OnlineList(string $Title, int $OnlineNow, int $OnlinePrevious, int $MinDuration): array
    895895  {
    896896    $Time = time();
     
    899899    $Condition = 'WHERE (`NetworkInterface`.`LastOnline` <= "'.TimeToMysqlDateTime($Time - $MinDuration).'")';
    900900    if ($OnlineNow >= 0) $Condition .= ' AND (`NetworkInterface`.`Online` = '.$OnlineNow.')';
    901     if ($OnlinePrevious >= 0) $Condition .= ' AND (`NetworkInterface`.`OnlineNotify` = '.$OnlinePrevious.')';
     901    if ($OnlinePrevious >= 0) $Condition .= ' AND (`NetworkInterface`.`OnlineNotify` = '.$OnlinePrevious.')'; 
    902902    $DbResult3 = $this->Database->query('SELECT CONCAT_WS("-", `NetworkDevice`.`Name`, NULLIF(`NetworkInterface`.`Name`, "")) AS `Name`, '.
    903903      '`NetworkInterface`.`Online`, `NetworkInterface`.`LastOnline` FROM `NetworkInterface` '.
     
    925925      $Output .= '</table><br/>'."\n";
    926926    }
    927     $this->Database->query('UPDATE `NetworkInterface` SET `OnlineNotify` = `Online` '.
    928       $Condition);
     927
     928    if (($OnlineNow >= 0) and ($OnlinePrevious >= 0))
     929    {
     930      $this->Database->query('UPDATE `NetworkInterface` SET `OnlineNotify` = `Online` '.$Condition);
     931    }
    929932    return array('Report' => $Output, 'Count' => $DbResult3->num_rows);
    930933  }
     
    945948  }
    946949
    947   function PortCheckList(string $Title, string $OnlineNow, string $OnlinePrevious, int $MinDuration): array
     950  function PortCheckList(string $Title, int $OnlineNow, int $OnlinePrevious, int $MinDuration): array
    948951  {
    949952    $Time = time();
     
    979982      $Output .= '</table><br/>'."\n";
    980983    }
    981     $this->Database->query('UPDATE `NetworkPort` SET `OnlineNotify` = `Online` '.
    982       $Condition);
     984
     985    if (($OnlineNow >= 0) and ($OnlinePrevious >= 0))
     986    {
     987      $this->Database->query('UPDATE `NetworkPort` SET `OnlineNotify` = `Online` '.$Condition);
     988    }
    983989    return array('Report' => $Output, 'Count' => $DbResult3->num_rows);
    984990  }
Note: See TracChangeset for help on using the changeset viewer.