Changeset 24 for trunk/www/mangos_debug.php
- Timestamp:
- Jun 12, 2009, 11:40:00 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/www/mangos_debug.php
r21 r24 13 13 function Show($ServerId) 14 14 { 15 $Output = '<table width="100%"><tr><td width="10%" valign="top" style="">'. 16 '<strong>Restart history:</strong><br />'; 17 18 if(array_key_exists('Id', $_GET)) $Id = addslashes($_GET['Id']); 19 else $Id = 0; 20 if(array_key_exists('Page', $_GET)) $Page = addslashes($_GET['Page']); 21 else $Page = 0; 22 23 $DbResult = $this->Database->query('SELECT COUNT(*) FROM Debug WHERE Server='.$ServerId); 24 $DbRow = $DbResult->fetch_array(); 25 $Total = $DbRow[0]; 26 27 $DbResult = $this->Database->query('SELECT Id, Time FROM Debug WHERE Server='.$ServerId.' ORDER BY Time DESC LIMIT '.($Page * $this->ItemPerPage).','.$this->ItemPerPage); 28 while($DbRow = $DbResult->fetch_array()) 15 global $System; 16 17 $Output = ''; 18 $Form = new Form('DebugItem'); 19 if($Form->LoadValuesFromDatabase($_GET['Id'])) 29 20 { 30 if($DbRow['Id'] == $Id) $Output .= '<strong>'; 31 $Output .= '<a href="?Action=ServerDebug&Id='.$DbRow['Id'].'&Page='.$Page.'&Show=Backtrace">'.str_replace(' ', ' ', $DbRow['Time']).'</a>'; 32 if($DbRow['Id'] == $Id) $Output .= '</strong>'; 33 $Output .= '<br />'; 34 } 35 $Output .= PageList('Page', $Page, $Total, $this->ItemPerPage, 2); 36 37 $Output .= '</td><td valign="top" width="90%">'; 38 39 if($Id > 0) 40 { 41 $DbResult = $this->Database->query('SELECT * FROM Debug WHERE Id="'.$Id.'" ORDER BY Time'); 42 if($DbResult->num_rows > 0) 43 { 44 $DbRow = $DbResult->fetch_array(); 45 $Output .= '<strong>Čas záznamu:</strong> '.$DbRow['Time'].'<br />'; 46 $Output .= '<strong>Verze MaNGOSu:</strong> '.$DbRow['MangosVersion'].'<br />'; 47 $Output .= '<strong>Verze databáze:</strong> '.$DbRow['DbVersion'].'<br />'; 48 $Output .= '<strong>Doba běhu:</strong> '.TimeToHumanTime($DbRow['Uptime']).'<br />'; 49 $Output .= '<strong>Maximum hráčů:</strong> '.$DbRow['MaxPlayerCount'].'<br /><br />'; 50 $Output .= '<a href="?Action=ServerDebug&Id='.$Id.'&Page='.$Page.'&Show=Backtrace">Backtrace</a>'. 51 ' <a href="?Action=ServerDebug&Id='.$Id.'&Page='.$Page.'&Show=Log">Mangos log</a>'. 52 ' <a href="?Action=ServerDebug&Id='.$Id.'&Page='.$Page.'&Show=Error">Console error log</a>'. 53 ' <a href="?Action=ServerDebug&Id='.$Id.'&Page='.$Page.'&Show=DbErrors">Database error log</a>'. 54 ' <a href="?Action=ServerDebug&Id='.$Id.'&Page='.$Page.'&Show=Configuration">Mangos configuration</a>'. 21 $Form->Values['Uptime'] = TimeToHumanTime($Form->Values['Uptime']); 22 $Output .= $Form->ShowTable(); 23 24 $Output .= '<a href="?Action=ServerDebug&Id='.$_GET['Id'].'&Show=Backtrace">Backtrace</a>'. 25 ' <a href="?Action=ServerDebug&Id='.$_GET['Id'].'&Show=Log">Mangos log</a>'. 26 ' <a href="?Action=ServerDebug&Id='.$_GET['Id'].'&Show=Error">Console error log</a>'. 27 ' <a href="?Action=ServerDebug&Id='.$_GET['Id'].'&Show=DbErrors">Database error log</a>'. 28 ' <a href="?Action=ServerDebug&Id='.$_GET['Id'].'&Show=Configuration">Mangos configuration</a>'. 55 29 '<hr>'; 56 30 if(array_key_exists('Show', $_GET)) … … 60 34 { 61 35 case 'Backtrace': 36 $DbResult = $this->Database->select('Debug', 'Backtrace', 'Id='.$_GET['Id']); 37 $DbRow = $DbResult->fetch_assoc(); 62 38 $Content = htmlspecialchars($DbRow['Backtrace']); 63 39 for($I = 1; $I < $this->MaxMangosThreadCount; $I++) … … 69 45 break; 70 46 case 'Log': 47 $DbResult = $this->Database->select('Debug', 'Log', 'Id='.$_GET['Id']); 48 $DbRow = $DbResult->fetch_assoc(); 71 49 $Output .= '<strong>Console standard output log:</strong> <br><pre>'.htmlspecialchars($DbRow['Log']).'</pre>'; 72 50 break; 73 51 case 'Error': 52 $DbResult = $this->Database->select('Debug', 'ErrorLog', 'Id='.$_GET['Id']); 53 $DbRow = $DbResult->fetch_assoc(); 74 54 $Output .= '<strong>Console error log:</strong> <br><pre>'.htmlspecialchars($DbRow['ErrorLog']).'</pre>'; 75 55 break; 76 56 case 'DbErrors': 57 $DbResult = $this->Database->select('Debug', 'DbErrors', 'Id='.$_GET['Id']); 58 $DbRow = $DbResult->fetch_assoc(); 77 59 $Output .= '<strong>Database error log:</strong> <br><pre>'.htmlspecialchars($DbRow['DbErrors']).'</pre>'; 78 60 break; 79 61 case 'Configuration': 62 $DbResult = $this->Database->select('Debug', 'Configuration', 'Id='.$_GET['Id']); 63 $DbRow = $DbResult->fetch_assoc(); 80 64 $Output .= '<strong>Mangos configuration:</strong> <br><pre>'.htmlspecialchars($DbRow['Configuration']).'</pre>'; 81 65 break; 82 66 } 83 67 } 84 } 85 } 86 $Output .= '</td></tr></table>'; 68 } else $Output = 'Položka nenalezena'; 87 69 return($Output); 88 70 }
Note:
See TracChangeset
for help on using the changeset viewer.