Changeset 867 for trunk/Modules/Network/Network.php
- Timestamp:
- Jan 13, 2020, 12:26:00 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Network/Network.php
r865 r867 132 132 $this->System->ModuleManager->Modules['Notify']->RegisterCheck('NetworkPort', 133 133 array($this, 'PortCheck')); 134 135 134 136 135 $this->System->RegisterPage('network', 'PageNetwork'); … … 816 815 $OnlineText = array('<span style="color:red;">Nedostupný</span>', '<span style="color:green;">Dostupný</span>'); 817 816 $Output = ''; 818 $Condition = 'WHERE (`NetworkInterface`.`Online` = '.$OnlineNow.') AND (`NetworkInterface`.`OnlineNotify` = '.$OnlinePrevious.') '. 819 'AND (`NetworkInterface`.`LastOnline` <= "'.TimeToMysqlDateTime($Time - $MinDuration).'")'; 817 $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.')'; 820 820 $DbResult3 = $this->Database->query('SELECT CONCAT_WS("-", `NetworkDevice`.`Name`, NULLIF(`NetworkInterface`.`Name`, "")) AS `Name`, '. 821 821 '`NetworkInterface`.`Online`, `NetworkInterface`.`LastOnline` FROM `NetworkInterface` '. … … 845 845 $this->Database->query('UPDATE `NetworkInterface` SET `OnlineNotify` = `Online` '. 846 846 $Condition); 847 return $Output;847 return array('Report' => $Output, 'Count' => $DbResult3->num_rows); 848 848 } 849 849 850 850 function ReachabilityCheck() 851 851 { 852 $Output = ''; 853 $Output = $this->OnlineList('Nově online', 1, 0, 0); 854 $Output .= $this->OnlineList('Nově offline', 0, 1, $this->MinNotifyTime); 855 if($Output != '') $Output .= $this->OnlineList('Stále offline', 0, 0, 0); 856 return($Output); 852 $NewOnline = $this->OnlineList('Nově online', 1, 0, 0); 853 $Output = $NewOnline['Report']; 854 $NewOffline = $this->OnlineList('Nově offline', 0, 1, $this->MinNotifyTime); 855 $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); 862 return(array('Report' => $Output, 'Count' => $Offline['Count'], 'ShortTitle' => 'Odezva')); 857 863 } 858 864 … … 862 868 $OnlineText = array('<span style="color:red;">Nedostupný</span>', '<span style="color:green;">Dostupný</span>'); 863 869 $Output = ''; 864 $Condition = 'WHERE (`NetworkPort`.`Online` = '.$OnlineNow.') AND (`NetworkPort`.`OnlineNotify` = '.$OnlinePrevious.') '. 865 'AND (`NetworkPort`.`LastOnline` <= "'.TimeToMysqlDateTime($Time - $MinDuration).'")'; 870 $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.')'; 866 873 $DbResult3 = $this->Database->query('SELECT CONCAT(CONCAT_WS("-", `NetworkDevice`.`Name`, NULLIF(`NetworkInterface`.`Name`, "")), ":", `NetworkPort`.`Number`, "(", `NetworkPort`.`Name`, ")") AS `Name`, '. 867 874 '`NetworkPort`.`Online`, `NetworkPort`.`LastOnline` FROM `NetworkPort` '. … … 871 878 '(`NetworkInterface`.`LocalIP` != "") AND (`NetworkPort`.`Enabled` = 1)'. 872 879 'ORDER BY `Name` ASC'); 873 if ($DbResult3->num_rows > 0)880 if ($DbResult3->num_rows > 0) 874 881 { 875 882 $Output .= $Title.'<br/>'; … … 892 899 $this->Database->query('UPDATE `NetworkPort` SET `OnlineNotify` = `Online` '. 893 900 $Condition); 894 return $Output;901 return array('Report' => $Output, 'Count' => $DbResult3->num_rows); 895 902 } 896 903 … … 898 905 { 899 906 $Output = ''; 900 $Output = $this->PortCheckList('Nově online', 1, 0, 0); 901 $Output .= $this->PortCheckList('Nově offline', 0, 1, $this->MinNotifyTime); 902 if($Output != '') $Output .= $this->PortCheckList('Stále offline', 0, 0, 0); 903 return($Output); 907 $NewOnline = $this->PortCheckList('Nově online', 1, 0, 0); 908 $Output .= $NewOnline['Report']; 909 $NewOffline = $this->PortCheckList('Nově offline', 0, 1, $this->MinNotifyTime); 910 $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); 917 return(array('Report' => $Output, 'Count' => $Offline['Count'], 'ShortTitle' => 'Port')); 904 918 } 905 919 }
Note:
See TracChangeset
for help on using the changeset viewer.