Changeset 873 for trunk/Modules/TimeMeasure
- Timestamp:
- Apr 6, 2020, 11:17:40 PM (5 years ago)
- Location:
- trunk/Modules/TimeMeasure
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/TimeMeasure/Graph.php
r738 r873 20 20 { 21 21 $this->ClearPage = true; 22 return ($this->Render());22 return ($this->Render()); 23 23 } 24 24 … … 27 27 $PrefixMultiplier = new PrefixMultiplier(); 28 28 29 if (array_key_exists('Debug', $_GET)) $Debug = $_GET['Debug'];29 if (array_key_exists('Debug', $_GET)) $Debug = $_GET['Debug']; 30 30 else $Debug = 0; 31 31 32 if (!array_key_exists('From', $_GET)) die('Musíte zadat čas počátku');32 if (!array_key_exists('From', $_GET)) die('Musíte zadat čas počátku'); 33 33 $StartTime = addslashes($_GET['From']); 34 if (!array_key_exists('To', $_GET)) die('Musíte zadat čas konce');34 if (!array_key_exists('To', $_GET)) die('Musíte zadat čas konce'); 35 35 $EndTime = addslashes($_GET['To']); 36 if ($EndTime < $StartTime) $EndTime = $StartTime + 60;36 if ($EndTime < $StartTime) $EndTime = $StartTime + 60; 37 37 $TimeDifference = $EndTime - $StartTime; 38 if (!array_key_exists('Measure', $_GET)) die('Musíte zadat měřenou veličinu');38 if (!array_key_exists('Measure', $_GET)) die('Musíte zadat měřenou veličinu'); 39 39 $MeasureId = addslashes($_GET['Measure']); 40 if (!array_key_exists('Width', $_GET)) $Width = $this->DefaultWidth;40 if (!array_key_exists('Width', $_GET)) $Width = $this->DefaultWidth; 41 41 else $Width = addslashes($_GET['Width']); 42 if (!array_key_exists('Height', $_GET)) $Height = $this->DefaultHeight;42 if (!array_key_exists('Height', $_GET)) $Height = $this->DefaultHeight; 43 43 else $Height = addslashes($_GET['Height']); 44 if (!array_key_exists('Differential', $_GET)) $Differential = $this->Config['Application']['DefaultVariables']['Differential'];44 if (!array_key_exists('Differential', $_GET)) $Differential = $this->Config['Application']['DefaultVariables']['Differential']; 45 45 else $Differential = addslashes($_GET['Differential']); 46 46 $VerticalLinesCount = round($Height / ($this->FontSize + 4)); … … 63 63 64 64 $Level = floor(log(($EndTime - $StartTime) / $Measure->DivisionCount / 60) / log($Measure->LevelReducing)) - 1; 65 if ($Level < 0) $Level = 0;66 if ($Level > $Measure->MaxLevel) $Level = $Measure->MaxLevel;65 if ($Level < 0) $Level = 0; 66 if ($Level > $Measure->MaxLevel) $Level = $Measure->MaxLevel; 67 67 //$Level = 0; 68 68 69 69 $Points = $Measure->GetValues($StartTime, $EndTime, $Level); 70 70 71 if ($Debug) echo('Points count: '.count($Points).'<br/>');72 //if ($Debug) foreach($Points as $Index => $Item)71 if ($Debug) echo('Points count: '.count($Points).'<br/>'); 72 //if ($Debug) foreach ($Points as $Index => $Item) 73 73 // echo($Index.': '.$Item['min'].'<br>'); 74 74 … … 77 77 $AvgValue = 0; 78 78 $MinValue = 1000000000000000000; 79 foreach ($Points as $Index => $Item)79 foreach ($Points as $Index => $Item) 80 80 { 81 81 //$Points[$Index]['min'] = $Points[$Index]['min'] / $Measure['Divider']; 82 82 //$Points[$Index]['avg'] = $Points[$Index]['avg'] / $Measure['Divider']; 83 83 //$Points[$Index]['max'] = $Points[$Index]['max'] / $Measure['Divider']; 84 if ($Points[$Index]['Avg'] > $MaxValue) $MaxValue = $Points[$Index]['Avg'];85 if ($Points[$Index]['Avg'] < $MinValue) $MinValue = $Points[$Index]['Avg'];86 if ($Points[$Index]['Max'] > $MaxValue) $MaxValue = $Points[$Index]['Max'];87 if ($Points[$Index]['Min'] < $MinValue) $MinValue = $Points[$Index]['Min'];84 if ($Points[$Index]['Avg'] > $MaxValue) $MaxValue = $Points[$Index]['Avg']; 85 if ($Points[$Index]['Avg'] < $MinValue) $MinValue = $Points[$Index]['Avg']; 86 if ($Points[$Index]['Max'] > $MaxValue) $MaxValue = $Points[$Index]['Max']; 87 if ($Points[$Index]['Min'] < $MinValue) $MinValue = $Points[$Index]['Min']; 88 88 $AvgValue = $AvgValue + $Points[$Index]['Avg']; 89 89 } … … 96 96 $PointsAvg = array(0, $Height - 1); 97 97 $PointsMax = array(0, $Height - 1); 98 if (($MaxValue - $MinValue) == 0) $MaxValue = $MinValue + 1;98 if (($MaxValue - $MinValue) == 0) $MaxValue = $MinValue + 1; 99 99 { 100 foreach ($Points as $Index => $Item)100 foreach ($Points as $Index => $Item) 101 101 { 102 102 $PointsMin[] = $Index * $Width / $Measure->DivisionCount; … … 128 128 129 129 // Generate image 130 if (!$Debug)130 if (!$Debug) 131 131 { 132 132 Header('Content-type: image/png'); … … 153 153 $TimeRange = $EndTime - $StartTime; 154 154 $TimeMarksIndex = 0; 155 while (($TimeRange / $TimeMarks[$TimeMarksIndex]) > 1) $TimeMarksIndex += 1;156 if ($TimeMarksIndex < 2) $TimeMarksIndex = 2;155 while (($TimeRange / $TimeMarks[$TimeMarksIndex]) > 1) $TimeMarksIndex += 1; 156 if ($TimeMarksIndex < 2) $TimeMarksIndex = 2; 157 157 $MajorTimeMarks = $TimeMarks[$TimeMarksIndex - 1]; 158 158 $MinorTimeMarks = $TimeMarks[$TimeMarksIndex - 2]; … … 163 163 // Zobraz měřítko Y 164 164 $VerticalLinesDistance = $Height / $VerticalLinesCount; 165 for ($I = 1; $I <= $VerticalLinesCount; $I++)165 for ($I = 1; $I <= $VerticalLinesCount; $I++) 166 166 { 167 167 $Y = $Height - 1 - ($VerticalLinesDistance * $I); 168 for ($X = 1; $X < $Width; $X = $X + 3) imagesetpixel($Image, $X, $Y, $Gray);168 for ($X = 1; $X < $Width; $X = $X + 3) imagesetpixel($Image, $X, $Y, $Gray); 169 169 //imageline($Image, 30, $Y, $Width-1, $Y, IMG_COLOR_STYLED); 170 170 } … … 174 174 // Zobraz měřítko X 175 175 $LastTextEnd = 0; 176 for ($Time = $StartTime; $Time < $EndTime; $Time += $MajorTimeMarks)176 for ($Time = $StartTime; $Time < $EndTime; $Time += $MajorTimeMarks) 177 177 { 178 178 $X = round(($Time - $StartTime + $TimeShift) / $TimeRange * $Width) % $Width; 179 179 //imageline($Image, 30, $Y, $Width-1, $Y, IMG_COLOR_STYLED); 180 if (($MajorTimeMarks > 60 * 60 * 24)) $Text = date('j.n.Y', $Time + $TimeShift);180 if (($MajorTimeMarks > 60 * 60 * 24)) $Text = date('j.n.Y', $Time + $TimeShift); 181 181 else $Text = date('j.n.Y G:i', $Time + $TimeShift); 182 182 $BoundBox = imagettfbbox($FontSize, 0, $FontFile, $Text); 183 if ($LastTextEnd < ($X - ($BoundBox[2] - $BoundBox[0] + 20) / 2))183 if ($LastTextEnd < ($X - ($BoundBox[2] - $BoundBox[0] + 20) / 2)) 184 184 { 185 for ($Y = 0; $Y < $Height; $Y = $Y + 1) imagesetpixel($Image, $X, $Y, $Gray);185 for ($Y = 0; $Y < $Height; $Y = $Y + 1) imagesetpixel($Image, $X, $Y, $Gray); 186 186 imagettftext($Image, $FontSize, 0, $X - ($BoundBox[2] - $BoundBox[0]) / 2, $Height - 2, $Black, $FontFile, $Text); 187 187 $LastTextEnd = $X + ($BoundBox[2] - $BoundBox[0]) / 2; 188 188 } 189 else for ($Y = 0; $Y < $Height; $Y = $Y + 3) imagesetpixel($Image, $X, $Y, $Gray);189 else for ($Y = 0; $Y < $Height; $Y = $Y + 3) imagesetpixel($Image, $X, $Y, $Gray); 190 190 } 191 191 192 192 // Popisky osy Y 193 for ($I = 1; $I <= $VerticalLinesCount; $I++)193 for ($I = 1; $I <= $VerticalLinesCount; $I++) 194 194 { 195 195 $Y = $Height - 1 - ($VerticalLinesDistance * $I); … … 199 199 $this->ValueToImageHeigthCoefficient * ($MaxValue - $MinValue) + $MinValue)), $MeasureMethod['Unit'], 3); 200 200 $BoundBox = imagettfbbox($FontSize, 0, $FontFile, $Text); 201 if (($Y - ($BoundBox[5] - $BoundBox[1]) / 2) > 10)201 if (($Y - ($BoundBox[5] - $BoundBox[1]) / 2) > 10) 202 202 imagettftext($Image, $FontSize, 0, 2, $Y - ($BoundBox[5] - $BoundBox[1]) / 2, $Black, $FontFile, $Text); 203 203 } -
trunk/Modules/TimeMeasure/Main.php
r825 r873 62 62 // Day selection 63 63 $Output .= '<select name="Day">'; 64 for ($I = 1; $I < 32; $I++)65 { 66 if ($I == $TimeParts['mday']) $Selected = ' selected="1"'; else $Selected = '';64 for ($I = 1; $I < 32; $I++) 65 { 66 if ($I == $TimeParts['mday']) $Selected = ' selected="1"'; else $Selected = ''; 67 67 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>'; 68 68 } … … 71 71 // Month selection 72 72 $Output .= '<select name="Month">'; 73 foreach ($MonthNames as $Index => $Month)74 { 75 if ($Index == $TimeParts['mon']) $Selected = ' selected="1"'; else $Selected = '';76 if ($Index > 0) $Output .= '<option value="'.$Index.'"'.$Selected.'>'.$Month.'</option>';73 foreach ($MonthNames as $Index => $Month) 74 { 75 if ($Index == $TimeParts['mon']) $Selected = ' selected="1"'; else $Selected = ''; 76 if ($Index > 0) $Output .= '<option value="'.$Index.'"'.$Selected.'>'.$Month.'</option>'; 77 77 } 78 78 $Output .= '</select>. '; … … 80 80 // Day selection 81 81 $Output .= '<select name="Year">'; 82 for ($I = 2000; $I < 2010; $I++)83 { 84 if ($I == $TimeParts['year']) $Selected = ' selected="1"'; else $Selected = '';82 for ($I = 2000; $I < 2010; $I++) 83 { 84 if ($I == $TimeParts['year']) $Selected = ' selected="1"'; else $Selected = ''; 85 85 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>'; 86 86 } … … 89 89 // Hour selection 90 90 $Output .= '<select name="Hour">'; 91 for ($I = 0; $I < 24; $I++)92 { 93 if ($I == $TimeParts['hours']) $Selected = ' selected="1"'; else $Selected = '';91 for ($I = 0; $I < 24; $I++) 92 { 93 if ($I == $TimeParts['hours']) $Selected = ' selected="1"'; else $Selected = ''; 94 94 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>'; 95 95 } … … 98 98 // Minute selection 99 99 $Output .= '<select name="Minute">'; 100 for ($I = 0; $I < 60; $I++)101 { 102 if ($I == $TimeParts['minutes']) $Selected = ' selected="1"'; else $Selected = '';100 for ($I = 0; $I < 60; $I++) 101 { 102 if ($I == $TimeParts['minutes']) $Selected = ' selected="1"'; else $Selected = ''; 103 103 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>'; 104 104 } … … 111 111 $Output .= '</form>'; 112 112 113 return ($Output);113 return ($Output); 114 114 } 115 115 … … 118 118 $Debug = 0; 119 119 120 foreach ($this->DefaultVariables as $Index => $Variable)121 { 122 if (!array_key_exists($Index, $_SESSION)) $_SESSION[$Index] = $Variable;123 if (array_key_exists($Index, $_GET)) $_SESSION[$Index] = $_GET[$Index];124 if (array_key_exists($Index, $_POST)) $_SESSION[$Index] = $_POST[$Index];120 foreach ($this->DefaultVariables as $Index => $Variable) 121 { 122 if (!array_key_exists($Index, $_SESSION)) $_SESSION[$Index] = $Variable; 123 if (array_key_exists($Index, $_GET)) $_SESSION[$Index] = $_GET[$Index]; 124 if (array_key_exists($Index, $_POST)) $_SESSION[$Index] = $_POST[$Index]; 125 125 //$$Index = $_SESSION[$Index]; 126 126 } 127 127 128 if ($_SESSION['TimeSpecify'] == 0)128 if ($_SESSION['TimeSpecify'] == 0) 129 129 { 130 130 $_SESSION['TimeEnd'] = time() - 60; … … 134 134 $Output = '<div style="text-align: center;">'; 135 135 136 if (!array_key_exists('Operation', $_GET)) $_GET['Operation'] = '';137 switch ($_GET['Operation'])136 if (!array_key_exists('Operation', $_GET)) $_GET['Operation'] = ''; 137 switch ($_GET['Operation']) 138 138 { 139 139 case 'SetTime': 140 if (array_key_exists('Time', $_GET) and array_key_exists('Month', $_POST) and array_key_exists('Day', $_POST) and140 if (array_key_exists('Time', $_GET) and array_key_exists('Month', $_POST) and array_key_exists('Day', $_POST) and 141 141 array_key_exists('Year', $_POST) and array_key_exists('Hour', $_POST) and array_key_exists('Minute', $_POST)) 142 142 { 143 if (($_GET['Time'] == 'TimeStart') or ($_GET['Time'] == 'TimeEnd'))143 if (($_GET['Time'] == 'TimeStart') or ($_GET['Time'] == 'TimeEnd')) 144 144 { 145 145 $_SESSION[$_GET['Time']] = mktime($_POST['Hour'], $_POST['Minute'], 0, $_POST['Month'], … … 150 150 break; 151 151 case 'SetTimeNow': 152 if (array_key_exists('Time', $_GET))152 if (array_key_exists('Time', $_GET)) 153 153 { 154 if (($_GET['Time'] == 'TimeStart') or ($_GET['Time'] == 'TimeEnd'))154 if (($_GET['Time'] == 'TimeStart') or ($_GET['Time'] == 'TimeEnd')) 155 155 { 156 156 $_SESSION[$_GET['Time']] = time(); … … 162 162 $Output .= '<strong>Časový úsek:</strong><br>'; 163 163 // Show graf time range menu 164 if ($_SESSION['TimeSpecify'] == 0)164 if ($_SESSION['TimeSpecify'] == 0) 165 165 { 166 166 $Output .= 'Délka úseku: '; 167 foreach ($this->GraphTimeRanges as $Index => $Item)167 foreach ($this->GraphTimeRanges as $Index => $Item) 168 168 $Output .= '<a href="?Period='.$Index.'">'.$Item['caption'].'</a> '; 169 169 $Output .= '<br/>'; … … 179 179 180 180 $Output .= '<br/>'.$this->MeasureTable(); 181 return ($Output);181 return ($Output); 182 182 } 183 183 … … 191 191 $Output .= '<a href="?Measure='.$_SESSION['Measure'].'&TimeStart='. 192 192 $_SESSION['TimeStart'].'&TimeEnd='.$_SESSION['TimeEnd'].'&TimeSpecify=1&Differential='.$_SESSION['Differential'].'">Odkaz na vybraný graf</a><br>'; 193 return ($Output);193 return ($Output); 194 194 } 195 195 … … 212 212 array('Name' => 'Description', 'Title' => 'Popis'), 213 213 ); 214 if (array_key_exists('Debug', $_GET))214 if (array_key_exists('Debug', $_GET)) 215 215 { 216 216 $TableColumns[] = array('Name' => 'ItemCount', 'Title' => 'Počet položek'); … … 221 221 222 222 $Result = $this->Database->select('Measure', '*', '`Enabled`=1 '.$Order['SQL'].$PageList['SQLLimit']); 223 while ($Measure = $Result->fetch_array())223 while ($Measure = $Result->fetch_array()) 224 224 { 225 225 $DbResult2 = $this->Database->select('MeasureMethod', '*', '`Id`='.$Measure['Method']); 226 226 $MeasureMethod = $DbResult2->fetch_assoc(); 227 227 $StopWatchStart = GetMicrotime(); 228 if (array_key_exists('Debug', $_GET))228 if (array_key_exists('Debug', $_GET)) 229 229 { 230 230 $DbResult = $this->Database->select($Measure['DataTable'], 'COUNT(*)', 'Measure='.$Measure['Id']); … … 233 233 } 234 234 $Result2 = $this->Database->select($Measure['DataTable'], 'Time, Avg', 'Measure='.$Measure['Id'].' AND Level=0 ORDER BY Time DESC LIMIT 1'); 235 if ($Result2->num_rows > 0)235 if ($Result2->num_rows > 0) 236 236 { 237 237 $Row = $Result2->fetch_array(); … … 243 243 $LastMeasureValue = ' '; 244 244 } 245 if ($Measure['Continuity'] == 1) $Interpolate = 'Ano';245 if ($Measure['Continuity'] == 1) $Interpolate = 'Ano'; 246 246 else $Interpolate = 'Ne'; 247 //if ($Measure['Description'] == '') $Measure['Description'] = ' ';247 //if ($Measure['Description'] == '') $Measure['Description'] = ' '; 248 248 $GenerationTime = floor((GetMicrotime() - $StopWatchStart) * 1000 ) / 1000; 249 249 $Output .= '<tr><td><a href="?Measure='.$Measure['Id'].'&Differential=0">'.$Measure['Name'].'</a></td><td align="center">'.$LastMeasureValue.'</td><td align="center">'.$LastMeasureTime.'</td><td align="center">'.$Interpolate.'</td><td>'.$Measure['Description'].'</td>'; 250 if (array_key_exists('Debug', $_GET)) $Output .= '<td>'.$RowCount.'</td><td>'.$GenerationTime.'</td>';250 if (array_key_exists('Debug', $_GET)) $Output .= '<td>'.$RowCount.'</td><td>'.$GenerationTime.'</td>'; 251 251 $Output .= '</tr>'; 252 252 } … … 260 260 //echo($PrefixMultiplier->Add('-0.000000071112345', 'B')); 261 261 $Output .= '</div>'; 262 return ($Output);262 return ($Output); 263 263 } 264 264 } … … 271 271 272 272 $Output = ''; 273 if (!array_key_exists('MeasureId', $_GET)) return('Nebylo zadáno Id měření.');274 if (!array_key_exists('Value', $_GET)) return('Nebyla zadána hodnota.');273 if (!array_key_exists('MeasureId', $_GET)) return ('Nebylo zadáno Id měření.'); 274 if (!array_key_exists('Value', $_GET)) return ('Nebyla zadána hodnota.'); 275 275 $Measure = new Measure($this->System); 276 276 $Measure->Load($_GET['MeasureId']); 277 if (!isset($Measure->Data['Id'])) return('Měření s Id '.$_GET['MeasureId'].' nenalezeno.');277 if (!isset($Measure->Data['Id'])) return ('Měření s Id '.$_GET['MeasureId'].' nenalezeno.'); 278 278 $Measure->AddValue(array('Min' => $_GET['Value'], 'Avg' => $_GET['Value'], 'Max' => $_GET['Value'])); 279 return ($Output);279 return ($Output); 280 280 } 281 281 } -
trunk/Modules/TimeMeasure/Measure.php
r790 r873 15 15 { 16 16 $Result = $this->Database->select('Measure', '*', 'Id='.$Id); 17 if ($Result->num_rows > 0)17 if ($Result->num_rows > 0) 18 18 { 19 19 $this->Data = $Result->fetch_assoc(); 20 if ($this->Data['Continuity'] == 0) $this->Data['ContinuityEnabled'] = 0; // non continuous20 if ($this->Data['Continuity'] == 0) $this->Data['ContinuityEnabled'] = 0; // non continuous 21 21 else $this->Data['ContinuityEnabled'] = 2; // continuous graph 22 22 } else throw new Exception('Measure not found'); … … 25 25 function TimeSegment($Base, $Level) 26 26 { 27 return (pow($this->LevelReducing, $Level) * $Base);27 return (pow($this->LevelReducing, $Level) * $Base); 28 28 } 29 29 30 30 function StatTableName($Level) 31 31 { 32 if ($Level == 0) return('Data');33 else return ('DataCache');32 if ($Level == 0) return ('Data'); 33 else return ('DataCache'); 34 34 } 35 35 36 36 function AlignTime($Time, $TimeSegment) 37 37 { 38 return (round(($Time - $this->ReferenceTime) / $TimeSegment) * $TimeSegment + $this->ReferenceTime);38 return (round(($Time - $this->ReferenceTime) / $TimeSegment) * $TimeSegment + $this->ReferenceTime); 39 39 } 40 40 41 41 function AddValue($Value = array('Min' => 0, 'Avg' => 0, 'Max' => 0), $Level = 0, $Time = 0) 42 42 { 43 if ($Time == 0) $Time = time();43 if ($Time == 0) $Time = time(); 44 44 45 45 $Result = $this->Database->select($this->Data['DataTable'], '*', 'Measure='. 46 46 $this->Data['Id'].' AND Level='.$Level.' ORDER BY Time DESC LIMIT 2'); 47 if ($Result->num_rows == 0)47 if ($Result->num_rows == 0) 48 48 { 49 49 $this->Database->insert($this->Data['DataTable'], array('Min' => $Value['Min'], 50 50 'Avg' => $Value['Avg'], 'Max' => $Value['Max'], 'Level' => $Level, 51 51 'Measure' => $this->Data['Id'], 'Time' => TimeToMysqlDateTime($Time), 'Continuity' => 0)); 52 } else if ($Result->num_rows == 1)52 } else if ($Result->num_rows == 1) 53 53 { 54 54 $this->Database->insert($this->Data['DataTable'], array('Min' => $Value['Min'], … … 59 59 $LastValue = $Result->fetch_assoc(); 60 60 $NextToLastValue = $Result->fetch_assoc(); 61 if ((($Time - MysqlDateTimeToTime($LastValue['Time'])) < 0.75 * $this->Data['Period']) and ($Level == 0))61 if ((($Time - MysqlDateTimeToTime($LastValue['Time'])) < 0.75 * $this->Data['Period']) and ($Level == 0)) 62 62 { 63 63 echo('Too short period. Minimal period is '.(0.75 * $this->Data['Period'])." seconds\n"); 64 64 } else 65 65 { 66 if (($Time - MysqlDateTimeToTime($LastValue['Time'])) < 1.25 * $this->Data['Period']) $Continuity = 1;66 if (($Time - MysqlDateTimeToTime($LastValue['Time'])) < 1.25 * $this->Data['Period']) $Continuity = 1; 67 67 else $Continuity = 0; 68 if (($LastValue['Min'] == $NextToLastValue['Min']) and ($LastValue['Min'] ==68 if (($LastValue['Min'] == $NextToLastValue['Min']) and ($LastValue['Min'] == 69 69 $Value['Min']) and ($LastValue['Avg'] == $NextToLastValue['Avg']) and 70 70 ($LastValue['Avg'] == $Value['Avg']) and ($LastValue['Max'] == $NextToLastValue['Max']) … … 82 82 83 83 // Update next level 84 if ($Level < $this->MaxLevel)84 if ($Level < $this->MaxLevel) 85 85 { 86 86 $Level = $Level + 1; 87 87 $TimeSegment = $this->TimeSegment($this->Data['Period'], 1); 88 88 $EndTime = $this->AlignTime($Time, $TimeSegment); 89 //if ($EndTime < $Time) $EndTime = $EndTime + $TimeSegment;89 //if ($EndTime < $Time) $EndTime = $EndTime + $TimeSegment; 90 90 $StartTime = $EndTime - $TimeSegment; 91 91 … … 96 96 TimeToMysqlDateTime($StartTime).'") AND (Time < "'.TimeToMysqlDateTime($EndTime). 97 97 '") AND (Measure='.$this->Data['Id'].') AND (Level='.($Level - 1).') ORDER BY Time'); 98 while ($Row = $Result->fetch_assoc())98 while ($Row = $Result->fetch_assoc()) 99 99 { 100 100 $Row['Time'] = MysqlDateTimeToTime($Row['Time']); 101 101 $Values[] = $Row; 102 102 } 103 //if (count($Values) > 2)103 //if (count($Values) > 2) 104 104 { 105 105 //array_pop($Values); … … 124 124 { 125 125 $Y = ($Y2 - $Y1) / ($X2 - $X1) * ($X - $X1) + $Y1; 126 return ($Y);126 return ($Y); 127 127 } 128 128 … … 132 132 133 133 // Trim outside parts 134 foreach ($this->ValueTypes as $ValueType)134 foreach ($this->ValueTypes as $ValueType) 135 135 { 136 136 $Values[0][$ValueType] = $this->Interpolation($Values[0]['Time'], $Values[0][$ValueType], $Values[1]['Time'], $Values[1][$ValueType], $LeftTime); 137 137 } 138 138 $Values[0]['Time'] = $LeftTime; 139 foreach ($this->ValueTypes as $ValueType)139 foreach ($this->ValueTypes as $ValueType) 140 140 { 141 141 $Values[count($Values) - 1][$ValueType] = $this->Interpolation($Values[count($Values) - 2]['Time'], $Values[count($Values) - 2][$ValueType], … … 145 145 146 146 // Perform computation 147 foreach ($this->ValueTypes as $ValueType)147 foreach ($this->ValueTypes as $ValueType) 148 148 { 149 149 // Compute new value 150 for ($I = 0; $I < (count($Values) - 1); $I++)151 { 152 if ($ValueType == 'Avg')153 { 154 if ($Values[$I + 1]['Continuity'] == $this->Data['ContinuityEnabled']);155 else if ($this->Differential == 0)150 for ($I = 0; $I < (count($Values) - 1); $I++) 151 { 152 if ($ValueType == 'Avg') 153 { 154 if ($Values[$I + 1]['Continuity'] == $this->Data['ContinuityEnabled']); 155 else if ($this->Differential == 0) 156 156 { 157 157 $NewValue[$ValueType] = $NewValue[$ValueType] + ($Values[$I + 1]['Time'] - $Values[$I]['Time']) * … … 163 163 } 164 164 } 165 else if ($ValueType == 'Max')166 { 167 if ($Values[$I + 1]['Continuity'] == $this->Data['ContinuityEnabled'])168 { 169 if (0 > $NewValue[$ValueType]) $NewValue[$ValueType] = 0;165 else if ($ValueType == 'Max') 166 { 167 if ($Values[$I + 1]['Continuity'] == $this->Data['ContinuityEnabled']) 168 { 169 if (0 > $NewValue[$ValueType]) $NewValue[$ValueType] = 0; 170 170 } else 171 171 { 172 if ($this->Differential == 0)172 if ($this->Differential == 0) 173 173 { 174 if ($Values[$I + 1][$ValueType] > $NewValue[$ValueType]) $NewValue[$ValueType] = $Values[$I + 1][$ValueType];174 if ($Values[$I + 1][$ValueType] > $NewValue[$ValueType]) $NewValue[$ValueType] = $Values[$I + 1][$ValueType]; 175 175 } else { 176 176 $Difference = $Values[$I + 1][$ValueType] - $Values[$I][$ValueType]; 177 if ($Difference > $NewValue[$ValueType]) $NewValue[$ValueType] = $Difference;177 if ($Difference > $NewValue[$ValueType]) $NewValue[$ValueType] = $Difference; 178 178 } 179 179 } 180 180 } 181 else if ($ValueType == 'Min')182 { 183 if ($Values[$I + 1]['Continuity'] == $this->Data['ContinuityEnabled'])184 { 185 if (0 < $NewValue[$ValueType]) $NewValue[$ValueType] = 0;181 else if ($ValueType == 'Min') 182 { 183 if ($Values[$I + 1]['Continuity'] == $this->Data['ContinuityEnabled']) 184 { 185 if (0 < $NewValue[$ValueType]) $NewValue[$ValueType] = 0; 186 186 } else 187 187 { 188 if ($this->Differential == 0)188 if ($this->Differential == 0) 189 189 { 190 if ($Values[$I + 1][$ValueType] < $NewValue[$ValueType]) $NewValue[$ValueType] = $Values[$I + 1][$ValueType];190 if ($Values[$I + 1][$ValueType] < $NewValue[$ValueType]) $NewValue[$ValueType] = $Values[$I + 1][$ValueType]; 191 191 } else { 192 192 $Difference = $Values[$I + 1][$ValueType] - $Values[$I][$ValueType]; 193 if ($Difference < $NewValue[$ValueType]) $NewValue[$ValueType] = $Difference;193 if ($Difference < $NewValue[$ValueType]) $NewValue[$ValueType] = $Difference; 194 194 } 195 195 } … … 198 198 $NewValue[$ValueType] = $NewValue[$ValueType]; 199 199 } 200 //if (($RightTime - $LeftTime) > 0)201 if ($this->Data['Cumulative'] == 0)200 //if (($RightTime - $LeftTime) > 0) 201 if ($this->Data['Cumulative'] == 0) 202 202 { 203 203 $NewValue['Avg'] = $NewValue['Avg'] / ($RightTime - $LeftTime); 204 204 } 205 return ($NewValue);205 return ($NewValue); 206 206 } 207 207 … … 210 210 // Get first and last time 211 211 $Result = $this->Database->select($this->Data['DataTable'], '*', 'Measure='.$this->Data['Id'].' AND Level='.$Level.' ORDER BY Time LIMIT 1'); 212 if ($Result->num_rows > 0)212 if ($Result->num_rows > 0) 213 213 { 214 214 $Row = $Result->fetch_assoc(); … … 217 217 218 218 $Result = $this->Database->select($this->Data['DataTable'], '*', 'Measure='.$this->Data['Id'].' AND Level='.$Level.' ORDER BY Time DESC LIMIT 1'); 219 if ($Result->num_rows > 0)219 if ($Result->num_rows > 0) 220 220 { 221 221 $Row = $Result->fetch_assoc(); … … 223 223 } else $AbsoluteRightTime = 0; 224 224 225 if ($this->Debug)225 if ($this->Debug) 226 226 { 227 227 echo('AbsoluteLeftTime: '.$AbsoluteLeftTime.'('.TimeToMysqlDateTime($AbsoluteLeftTime).')<br>'); 228 228 echo('AbsoluteRightTime: '.$AbsoluteRightTime.'('.TimeToMysqlDateTime($AbsoluteRightTime).')<br>'); 229 229 } 230 return (array('Left' => $AbsoluteLeftTime, 'Right' => $AbsoluteRightTime));230 return (array('Left' => $AbsoluteLeftTime, 'Right' => $AbsoluteRightTime)); 231 231 } 232 232 … … 235 235 $Result = array(); 236 236 $DbResult = $this->Database->select($this->Data['DataTable'], '*', 'Time > "'.TimeToMysqlDateTime($Time).'" AND Measure='.$this->Data['Id'].' AND Level='.$Level.' ORDER BY Time ASC LIMIT 1'); 237 if ($DbResult->num_rows > 0)237 if ($DbResult->num_rows > 0) 238 238 { 239 239 $Row = $DbResult->fetch_assoc(); 240 240 $Row['Time'] = MysqlDateTimeToTime($Row['Time']); 241 return (array($Row));241 return (array($Row)); 242 242 } else 243 243 { … … 247 247 $DbResult = $this->Database->select($this->Data['DataTable'], '*', 'Time < "'. 248 248 TimeToMysqlDateTime($Time).'" AND Measure='.$this->Data['Id'].' AND Level='.$Level.' ORDER BY Time DESC LIMIT 1'); 249 if ($DbResult->num_rows > 0)249 if ($DbResult->num_rows > 0) 250 250 { 251 251 $Row = $DbResult->fetch_assoc(); 252 252 array_unshift($Result, array('Time' => (MysqlDateTimeToTime($Row['Time']) + 10), 'Min' => 0, 'Avg' => 0, 'Max' => 0, 'Continuity' => 0)); 253 253 } 254 // if ($Debug) print_r($Result);255 return ($Result);254 // if ($Debug) print_r($Result); 255 return ($Result); 256 256 } 257 257 } … … 262 262 $DbResult = $this->Database->select($this->Data['DataTable'], '*', '(Time < "'. 263 263 TimeToMysqlDateTime($Time).'") AND (Measure='.$this->Data['Id'].') AND (Level='.$Level.') ORDER BY Time DESC LIMIT 1'); 264 if ($DbResult->num_rows > 0)264 if ($DbResult->num_rows > 0) 265 265 { 266 266 $Row = $DbResult->fetch_assoc(); 267 267 $Row['Time'] = MysqlDateTimeToTime($Row['Time']); 268 return (array($Row));268 return (array($Row)); 269 269 } else 270 270 { 271 271 //$Time = $Values[0]['Time'] - 60; 272 272 //array_unshift($Values, array('Time' => $Time, 'Min' => 0, 'Avg' => 0, 'Max' => 0, 'Continuity' => 0)); 273 if ($this->Debug) echo($this->TimeSegment($this->Data['Period'], $Level));273 if ($this->Debug) echo($this->TimeSegment($this->Data['Period'], $Level)); 274 274 $Result[] = array('Time' => ($Time - $this->TimeSegment($this->Data['Period'], $Level)), 'Min' => 0, 'Avg' => 0, 'Max' => 0, 'Continuity' => 0); 275 275 276 276 $DbResult = $this->Database->select($this->Data['DataTable'], '*', 'Time > "'.TimeToMysqlDateTime($Time).'" AND Measure='.$this->Data['Id'].' AND Level='.$Level.' ORDER BY Time ASC LIMIT 1'); 277 if ($DbResult->num_rows > 0)277 if ($DbResult->num_rows > 0) 278 278 { 279 279 $Row = $DbResult->fetch_assoc(); 280 280 array_push($Result, array('Time' => (MysqlDateTimeToTime($Row['Time']) - 10), 'Min' => 0, 'Avg' => 0, 'Max' => 0, 'Continuity' => 0)); 281 281 } 282 return ($Result);282 return ($Result); 283 283 } 284 284 } … … 286 286 function GetValues($TimeFrom, $TimeTo, $Level) 287 287 { 288 if ($this->Debug) echo('TimeFrom: '.$TimeFrom.'('.TimeToMysqlDateTime($TimeFrom).')<br>');289 if ($this->Debug) echo('TimeTo: '.$TimeTo.'('.TimeToMysqlDateTime($TimeTo).')<br>');288 if ($this->Debug) echo('TimeFrom: '.$TimeFrom.'('.TimeToMysqlDateTime($TimeFrom).')<br>'); 289 if ($this->Debug) echo('TimeTo: '.$TimeTo.'('.TimeToMysqlDateTime($TimeTo).')<br>'); 290 290 291 291 //$AbsoluteTime = GetTimeRange($MeasureId); 292 292 293 // if (($TimeFrom > $AbsoluteLeftTime) and ($TimeStart < $AbsoluteRightTime) and293 // if (($TimeFrom > $AbsoluteLeftTime) and ($TimeStart < $AbsoluteRightTime) and 294 294 // ($TimeTo > $AbsoluteLeftTime) and ($TimeTo < $AbsoluteRightTime)) 295 295 // { … … 304 304 // echo(DB_NumRows()); 305 305 // $III = 0; 306 while ($Row = $Result->fetch_assoc())306 while ($Row = $Result->fetch_assoc()) 307 307 { 308 308 // echo($III.' '.$Row['Time'].' '.memory_get_usage().','); … … 314 314 // echo('abc'); 315 315 // die(); 316 if ($this->Debug) echo('Item count: '.count($Values));316 if ($this->Debug) echo('Item count: '.count($Values)); 317 317 318 318 $Points = array(); 319 if (count($Values) > 0)319 if (count($Values) > 0) 320 320 { 321 321 $Values = array_merge($this->LoadLeftSideValue($Level, $TimeFrom), $Values, $this->LoadRightSideValue($Level, $TimeTo)); 322 322 $StartIndex = 0; 323 323 $Points = array(); 324 if ($this->Debug) print_r($Values);325 for ($I = 0; $I < $this->DivisionCount; $I++)324 if ($this->Debug) print_r($Values); 325 for ($I = 0; $I < $this->DivisionCount; $I++) 326 326 { 327 327 $TimeStart = $TimeFrom + (($TimeTo - $TimeFrom) / $this->DivisionCount) * $I; 328 328 $TimeEnd = $TimeFrom + (($TimeTo - $TimeFrom) / $this->DivisionCount) * ($I + 1); 329 if ($this->Debug) echo('TimeEnd '.$I.': '.$TimeEnd.'('.TimeToMysqlDateTime($TimeEnd).')<br>');329 if ($this->Debug) echo('TimeEnd '.$I.': '.$TimeEnd.'('.TimeToMysqlDateTime($TimeEnd).')<br>'); 330 330 331 331 $EndIndex = $StartIndex; 332 while (($Values[$EndIndex]['Time'] < $TimeEnd) and ($EndIndex < count($Values))) $EndIndex = $EndIndex + 1;333 //while (($Values[$EndIndex]['Time'] < $TimeEnd)) $EndIndex = $EndIndex + 1;332 while (($Values[$EndIndex]['Time'] < $TimeEnd) and ($EndIndex < count($Values))) $EndIndex = $EndIndex + 1; 333 //while (($Values[$EndIndex]['Time'] < $TimeEnd)) $EndIndex = $EndIndex + 1; 334 334 $SubValues = array_slice($Values, $StartIndex, $EndIndex - $StartIndex + 1); 335 335 $Points[] = $this->ComputeOneValue($TimeStart, $TimeEnd, $SubValues, $Level); 336 336 $StartIndex = $EndIndex - 1; 337 337 } 338 if ($this->Debug) print_r($Points);338 if ($this->Debug) print_r($Points); 339 339 } else $Points[] = array('Min' => 0, 'Avg' => 0, 'Max' => 0); 340 return ($Points);340 return ($Points); 341 341 } 342 342 … … 344 344 { 345 345 echo('Veličina '.$this->Data['Name']."<br>\n"); 346 if ($this->Data['Continuity'] == 0) $this->Data['ContinuityEnabled'] = 0; // non continuous346 if ($this->Data['Continuity'] == 0) $this->Data['ContinuityEnabled'] = 0; // non continuous 347 347 else $this->Data['ContinuityEnabled'] = 2; // continuous graph 348 348 … … 354 354 echo("<br>\n"); 355 355 356 for ($Level = 1; $Level <= $this->MaxLevel; $Level++)356 for ($Level = 1; $Level <= $this->MaxLevel; $Level++) 357 357 { 358 358 echo('Uroven '.$Level."<br>\n"); … … 363 363 $BurstCount = 500; 364 364 echo('For 0 to '.round(($EndTime - $StartTime) / $TimeSegment / $BurstCount)."<br>\n"); 365 for ($I = 0; $I <= round(($EndTime - $StartTime) / $TimeSegment / $BurstCount); $I++)365 for ($I = 0; $I <= round(($EndTime - $StartTime) / $TimeSegment / $BurstCount); $I++) 366 366 { 367 367 echo($I.' '); … … 371 371 $DbResult = $this->Database->select($this->Data['DataTable'], '*', 'Time > "'. 372 372 TimeToMysqlDateTime($StartTime2).'" AND Time < "'.TimeToMysqlDateTime($EndTime2).'" AND Measure='.$this->Data['Id'].' AND Level='.($Level - 1).' ORDER BY Time'); 373 while ($Row = $DbResult->fetch_assoc())373 while ($Row = $DbResult->fetch_assoc()) 374 374 { 375 375 $Row['Time'] = MysqlDateTimeToTime($Row['Time']); … … 377 377 } 378 378 379 if (count($Values) > 0)379 if (count($Values) > 0) 380 380 { 381 381 $Values = array_merge($this->LoadLeftSideValue($Level - 1, $StartTime2), … … 383 383 384 384 $StartIndex = 0; 385 for ($B = 0; $B < $BurstCount; $B++)385 for ($B = 0; $B < $BurstCount; $B++) 386 386 { 387 387 echo('.'); … … 390 390 391 391 $EndIndex = $StartIndex; 392 while ($Values[$EndIndex]['Time'] < $EndTime3) $EndIndex = $EndIndex + 1;392 while ($Values[$EndIndex]['Time'] < $EndTime3) $EndIndex = $EndIndex + 1; 393 393 $SubValues = array_slice($Values, $StartIndex, $EndIndex - $StartIndex + 1); 394 if (count($SubValues) > 2)394 if (count($SubValues) > 2) 395 395 { 396 396 $Point = $this->ComputeOneValue($StartTime3, $EndTime3, $SubValues, $Level); … … 420 420 $Measures = array(); 421 421 $Result = $Database->select('Measure', '*'); 422 while ($Row = $Result->fetch_assoc())422 while ($Row = $Result->fetch_assoc()) 423 423 { 424 424 $Measures = new Measure(); … … 426 426 } 427 427 428 foreach ($Measures as $Measure)428 foreach ($Measures as $Measure) 429 429 { 430 430 $Measure->RebuildMeasureCache(); -
trunk/Modules/TimeMeasure/Measurement/MeasureClient.php
r738 r873 8 8 { 9 9 $DbResult = $this->Database->select('MeasureClient', '*'); 10 while ($MeasureClient = $DbResult->fetch_assoc())10 while ($MeasureClient = $DbResult->fetch_assoc()) 11 11 { 12 12 $DbResult2 = $this->Database->select('MeasureMethod', '*', 'Id='.$MeasureClient['Method']); … … 15 15 include_once(dirname(__FILE__).'/'.$MeasureMethod['MeasureClass'].'.php'); 16 16 $MeasureMethod['MeasureClass'] .= 'Measurement'; 17 if (class_exists($MeasureMethod['MeasureClass']))17 if (class_exists($MeasureMethod['MeasureClass'])) 18 18 { 19 19 $MeasureClass = new $MeasureMethod['MeasureClass']($this->System); 20 if (method_exists($MeasureClass, $MeasureMethod['Method']))20 if (method_exists($MeasureClass, $MeasureMethod['Method'])) 21 21 { 22 if ($MeasureClient['Parameter'] != '') $Value = $Measure->$MeasureMethod['Method']($MeasureClient['Parameter']);22 if ($MeasureClient['Parameter'] != '') $Value = $Measure->$MeasureMethod['Method']($MeasureClient['Parameter']); 23 23 else $Value = $MeasureClass->$MeasureMethod['Method'](); 24 24 echo(file_get_contents('http://'.$MeasureClient['Host'].$MeasureClient['Path'].'/?M=Add&MeasureId='.$MeasureClient['MeasureId'].'&Value='.addslashes($Value))); -
trunk/Modules/TimeMeasure/Measurement/System.php
r660 r873 11 11 set_error_handler('ErrorHandler'); 12 12 //error_reporting(0); 13 if ($Fp1 = fsockopen($Ip, $Port, $ERROR_NO, $ERROR_STR, (float)$Timeout))13 if ($Fp1 = fsockopen($Ip, $Port, $ERROR_NO, $ERROR_STR, (float)$Timeout)) 14 14 { 15 15 fclose($Fp1); 16 return (TRUE);16 return (TRUE); 17 17 } else 18 18 { 19 19 //echo($ERROR_NO.','.$ERROR_STR); 20 return (FALSE);20 return (FALSE); 21 21 } 22 22 restore_error_handler(); … … 30 30 // c - ping count 31 31 $Parts = explode(' ', $Row[0]); 32 if (count($Parts) > 6)32 if (count($Parts) > 6) 33 33 { 34 34 $Time = $Parts[7]; 35 35 $TimeParts = explode('=', $Time); 36 return ($TimeParts[1]);37 } else return (0);36 return ($TimeParts[1]); 37 } else return (0); 38 38 } 39 39 … … 43 43 exec('free -b', $Output); 44 44 $Row = $Output[2]; 45 while (strpos($Row, ' ') !== false) $Row = str_replace(' ', ' ', $Row);45 while (strpos($Row, ' ') !== false) $Row = str_replace(' ', ' ', $Row); 46 46 $RowParts = explode(' ', $Row); 47 47 $Row = $Output[3]; 48 while (strpos($Row, ' ') !== false) $Row = str_replace(' ', ' ', $Row);48 while (strpos($Row, ' ') !== false) $Row = str_replace(' ', ' ', $Row); 49 49 $RowParts2 = explode(' ', $Row); 50 return ($RowParts[2] + $RowParts2[2]);50 return ($RowParts[2] + $RowParts2[2]); 51 51 } 52 52 … … 81 81 } 82 82 file_put_contents($CpuStateFileName, serialize($CpuUsage)); 83 return (100 - round($CpuUsagePercent['Idle'], 2));83 return (100 - round($CpuUsagePercent['Idle'], 2)); 84 84 } 85 85 … … 93 93 array_shift($Output); // Skip header 94 94 array_shift($Output); // Skip header 95 foreach ($Output as $Item)95 foreach ($Output as $Item) 96 96 { 97 while (strpos($Item, ' ') !== false) $Item = str_replace(' ', ' ', $Item); // Rrmove multiple spaces97 while (strpos($Item, ' ') !== false) $Item = str_replace(' ', ' ', $Item); // Rrmove multiple spaces 98 98 $Item = explode(':', $Item); 99 99 $Interface = trim($Item[0]); 100 100 $Item = explode(' ', trim($Item[1])); 101 101 $NetworkState[$Interface] = array('Down' => $Item[0], 'Up' => $Item[8]); 102 if (array_key_exists($Interface, $LastNetworkState))102 if (array_key_exists($Interface, $LastNetworkState)) 103 103 { 104 104 $Period = time() - $LastNetworkState['Time']; … … 110 110 $NetworkState[$Interface]['UpAverage'] = 0; 111 111 } 112 if ($NetworkState[$Interface]['DownAverage'] < 0) $NetworkState[$Interface]['DownAverage'] = 0;113 if ($NetworkState[$Interface]['UpAverage'] < 0) $NetworkState[$Interface]['UpAverage'] = 0;112 if ($NetworkState[$Interface]['DownAverage'] < 0) $NetworkState[$Interface]['DownAverage'] = 0; 113 if ($NetworkState[$Interface]['UpAverage'] < 0) $NetworkState[$Interface]['UpAverage'] = 0; 114 114 } 115 115 file_put_contents($NetworkStateFile, serialize($NetworkState)); 116 return ($NetworkState);116 return ($NetworkState); 117 117 } 118 118 … … 120 120 { 121 121 $NetworkState = $this->GetNetworkState(); 122 return ($NetworkState['Interface']['DownAverage']);122 return ($NetworkState['Interface']['DownAverage']); 123 123 } 124 124 … … 126 126 { 127 127 $NetworkState = $this->GetNetworkState(); 128 return ($NetworkState['Interface']['UpAverage']);128 return ($NetworkState['Interface']['UpAverage']); 129 129 } 130 130 … … 134 134 $Output = array(); 135 135 exec('cat /proc/net/nf_conntrack|grep "dst='.$HostIP.' "|grep "dport='.$Port.' "|grep "ASSURED"', $Output); 136 return (count($Output));136 return (count($Output)); 137 137 } 138 138 … … 142 142 exec('iostat -d '.$Device.' -x -m 2 2', $Output); // 2 second measure delay 143 143 $Row = $Output[6]; 144 while (strpos($Row, ' ') !== false) $Row = str_replace(' ', ' ', $Row);144 while (strpos($Row, ' ') !== false) $Row = str_replace(' ', ' ', $Row); 145 145 $Parts = explode(' ', $Row); 146 146 $Value = str_replace(',', '.', $Parts[11]); 147 return ($Value);147 return ($Value); 148 148 } 149 149 150 150 function DiskFree($Path) 151 151 { 152 return (disk_free_space($Path));152 return (disk_free_space($Path)); 153 153 } 154 154 … … 157 157 $Output = array(); 158 158 exec('/usr/bin/sensors', $Output); 159 foreach ($Output as $Line)159 foreach ($Output as $Line) 160 160 { 161 if (substr($Line, 0, strlen($Sensor)) == $Sensor)161 if (substr($Line, 0, strlen($Sensor)) == $Sensor) 162 162 { 163 163 $Line = substr($Line, strpos($Line, '+') + 1); 164 164 $Line = substr($Line, 0, strpos($Line, '°')); 165 return ($Line);165 return ($Line); 166 166 } 167 167 } 168 return (0);168 return (0); 169 169 } 170 170 … … 175 175 fclose($File); 176 176 $UptimeParts = explode(' ', $Uptime); 177 return ($UptimeParts[0]);177 return ($UptimeParts[0]); 178 178 } 179 179 } -
trunk/Modules/TimeMeasure/Measurement/WoW.php
r738 r873 12 12 $DbResult = $Database->query('SELECT COUNT(*) FROM account WHERE online=1'); 13 13 $Row = $DbResult->fetch_array(); 14 return ($Row[0]);14 return ($Row[0]); 15 15 } 16 16 … … 20 20 $DbResult = $Database->query('SELECT COUNT(*) FROM account WHERE online=1 AND gmlevel > 0'); 21 21 $Row = $DbResult->fetch_array(); 22 return ($Row[0]);22 return ($Row[0]); 23 23 } 24 24 … … 28 28 $DbResult = $Database->query('SELECT COUNT(*) FROM account'); 29 29 $Row = $DbResult->fetch_array(); 30 return ($Row[0]);30 return ($Row[0]); 31 31 } 32 32 … … 36 36 $DbResult = $Database->query('SELECT COUNT(*) FROM guild'); 37 37 $Row = $DbResult->fetch_array(); 38 return ($Row[0]);38 return ($Row[0]); 39 39 } 40 40 … … 44 44 $DbResult = $Database->query('SELECT COUNT(*) FROM `characters`'); 45 45 $Row = $DbResult->fetch_array(); 46 return ($Row[0]);46 return ($Row[0]); 47 47 } 48 48 … … 52 52 $DbResult = $Database->query('SELECT COUNT(*) FROM uptime'); 53 53 $Row = $DbResult->fetch_array(); 54 return ($Row[0]);54 return ($Row[0]); 55 55 } 56 56 57 57 function WoWEmulatorAvailability() 58 58 { 59 if (CheckPortStatus('localhost', 8085)) return(100); else return(0);59 if (CheckPortStatus('localhost', 8085)) return (100); else return (0); 60 60 } 61 61 … … 69 69 $Row = $DbResult->fetch_array(); 70 70 $Value = $Row[0]; 71 return ($Value);71 return ($Value); 72 72 } 73 73 }
Note:
See TracChangeset
for help on using the changeset viewer.