Changeset 47 for trunk/Application/Model
- Timestamp:
- Jul 27, 2014, 9:14:56 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:ignore
-
old new 1 2 1 config.php 2 .project
-
- Property svn:ignore
-
trunk/Application/Model/Measure.php
r46 r47 467 467 } 468 468 } 469 470 ?> -
trunk/Application/Model/Measurement/MeasureClient.php
r44 r47 26 26 } else echo('Třída '.$MeasureMethod['MeasureClass'].' neexistuje.'); 27 27 } 28 } 28 } 29 29 } 30 31 ?> -
trunk/Application/Model/Measurement/Measurement.php
r43 r47 6 6 { 7 7 } 8 9 ?> -
trunk/Application/Model/Measurement/System.php
r44 r47 24 24 25 25 function Ping($Host = 'nix.cz') 26 { 26 { 27 $Row = array(); 27 28 exec('ping '.$Host.' -c 1 -W 1|grep time=', $Row); 28 29 // W - timeout in seconds … … 55 56 $LastCpuUsage = unserialize(file_get_contents($CpuStateFileName)); 56 57 //$cpuIDLEprev, $cpuSYSTprev, $cpuUSERprev; 57 58 58 59 // get processor usage seconds for pct stats ### 59 60 $File = fopen('/proc/stat', 'r'); … … 69 70 $CpuUsageDiffTotal = (($CpuUsageDiff['User'] + $CpuUsageDiff['System']) + $CpuUsageDiff['Idle']); 70 71 if ($CpuUsageDiffTotal > 0) 71 { 72 { 72 73 $CpuUsagePercent['User'] = ($CpuUsageDiff['User'] / $CpuUsageDiffTotal) * 100; 73 74 $CpuUsagePercent['System'] = ($CpuUsageDiff['System'] / $CpuUsageDiffTotal) * 100; … … 93 94 array_shift($Output); // Skip header 94 95 foreach($Output as $Item) 95 { 96 { 96 97 while(strpos($Item, ' ') !== false) $Item = str_replace(' ', ' ', $Item); // Rrmove multiple spaces 97 98 $Item = explode(':', $Item); … … 108 109 $NetworkState[$Interface]['DownAverage'] = 0; 109 110 $NetworkState[$Interface]['UpAverage'] = 0; 110 } 111 } 111 112 if($NetworkState[$Interface]['DownAverage'] < 0) $NetworkState[$Interface]['DownAverage'] = 0; 112 113 if($NetworkState[$Interface]['UpAverage'] < 0) $NetworkState[$Interface]['UpAverage'] = 0; … … 121 122 return($NetworkState['Interface']['DownAverage']); 122 123 } 123 124 124 125 function NetworkSpeedUpload($Interface) 125 126 { … … 177 178 } 178 179 } 179 180 ?> -
trunk/Application/Model/Permission.php
r40 r47 11 11 if($DbRow['SubGroup'] > 0) $Result = array_merge($Result, $this->LoadForGroup($DbRow['SubGroup'])); 12 12 if($DbRow['Operation'] > 0) 13 { 13 { 14 14 $DbResult2 = $this->Database->query('SELECT `PermissionOperation`.*, `Module`.`Name` FROM `PermissionOperation` JOIN `Module` ON `Module`.`Id` = `PermissionOperation`.`Module` WHERE `PermissionOperation`.`Id`='.$DbRow['Operation']); 15 15 $DbRow2 = $DbResult2->fetch_assoc(); … … 19 19 $this->Data = $Result; 20 20 } 21 21 22 22 function LoadForGroup($Group) 23 23 { … … 28 28 if($DbRow['SubGroup'] > 0) $Result = array_merge($Result, $this->LoadForGroup($DbRow['SubGroup'])); 29 29 if($DbRow['Operation'] > 0) 30 { 30 { 31 31 $DbResult2 = $this->Database->query('SELECT `PermissionOperation`.*, `Module`.`Name` FROM `PermissionOperation` JOIN `Module` ON `Module`.`Id` = `PermissionOperation`.`Module` WHERE `PermissionOperation`.`Id`='.$DbRow['Operation']); 32 32 $DbRow2 = $DbResult2->fetch_assoc(); … … 36 36 return($Result); 37 37 } 38 38 39 39 function Check($Module, $Action, $Item = 0) 40 40 { … … 44 44 } 45 45 } 46 47 ?> -
trunk/Application/Model/User.php
r46 r47 267 267 } 268 268 } 269 270 ?> -
trunk/Application/Model/stat_functions.php
r43 r47 43 43 if($Unit == '') return(TruncateDigits($Value, $Digits)); 44 44 $I = 8; 45 if($Value > 0) $II = 1; 45 if($Value > 0) $II = 1; 46 46 else if($Value < 0) $II = -1; 47 47 else $II = 0; … … 99 99 $Result = $Database->select($Measure['DataTable'], '*', 'measure='.$Measure['Id'].' AND level='.$Level.' ORDER BY time DESC LIMIT 2'); 100 100 //echo($Database->LastQuery."\n"); 101 if($Result->num_rows == 0) 102 { 103 $Database->insert($Measure['DataTable'], array('min' => $Value['min'], 'avg' => $Value['avg'], 'max' => $Value['max'], 'level' => $Level, 'measure' => $Measure['Id'], 'time' => TimeToMysqlDateTime($Time), 'continuity' => 0)); 101 if($Result->num_rows == 0) 102 { 103 $Database->insert($Measure['DataTable'], array('min' => $Value['min'], 'avg' => $Value['avg'], 'max' => $Value['max'], 'level' => $Level, 'measure' => $Measure['Id'], 'time' => TimeToMysqlDateTime($Time), 'continuity' => 0)); 104 104 //echo($Database->LastQuery."\n"); 105 105 } else if($Result->num_rows == 1) … … 237 237 } 238 238 } 239 else if($ValueType == 'min') 240 { 241 //echo($Values[$I+1]['continuity'].'=='.$Measure['ContinuityEnabled'].'<br>'); 239 else if($ValueType == 'min') 240 { 241 //echo($Values[$I+1]['continuity'].'=='.$Measure['ContinuityEnabled'].'<br>'); 242 242 if($Values[$I + 1]['continuity'] == $Measure['ContinuityEnabled']) 243 243 { … … 258 258 $NewValue[$ValueType] = $NewValue[$ValueType]; 259 259 } 260 //if(($RightTime - $LeftTime) > 0) 261 if($Measure['Cumulative'] == 0) 260 //if(($RightTime - $LeftTime) > 0) 261 if($Measure['Cumulative'] == 0) 262 262 { 263 263 $NewValue['avg'] = $NewValue['avg'] / ($RightTime - $LeftTime); … … 273 273 274 274 // Get first and last time 275 //echo($Measure['Id'].','.$Level.','.StatTableName($Level)."\n"); 275 //echo($Measure['Id'].','.$Level.','.StatTableName($Level)."\n"); 276 276 $Result = $Database->select($Measure['DataTable'], '*', 'measure='.$Measure['Id'].' AND level='.$Level.' ORDER BY time LIMIT 1'); 277 277 if($Result->num_rows > 0) … … 288 288 } else $AbsoluteRightTime = 0; 289 289 290 if($Debug) 290 if($Debug) 291 291 { 292 292 echo('AbsoluteLeftTime: '.$AbsoluteLeftTime.'('.TimeToMysqlDateTime($AbsoluteLeftTime).')<br>'); … … 297 297 298 298 function LoadRightSideValue($Level, $Measure, $Time) 299 { 299 { 300 300 global $Debug, $Database; 301 301 $Result = array(); … … 362 362 //$AbsoluteTime = GetTimeRange($MeasureId); 363 363 364 // if(($TimeFrom > $AbsoluteLeftTime) and ($TimeStart < $AbsoluteRightTime) and 364 // if(($TimeFrom > $AbsoluteLeftTime) and ($TimeStart < $AbsoluteRightTime) and 365 365 // ($TimeTo > $AbsoluteLeftTime) and ($TimeTo < $AbsoluteRightTime)) 366 366 // { … … 480 480 // Load values in time range 481 481 //array_pop($NextValues); 482 } 482 } 483 483 echo("Uroven dokoncena<br>\n"); 484 484 $DbResult = $Database->select($Measure['DataTable'], 'COUNT(*)', 'level='.$Level.' AND measure='.$Measure['Id']); … … 525 525 ) ENGINE = MYISAM ;'); 526 526 } 527 528 ?>
Note:
See TracChangeset
for help on using the changeset viewer.