source: branches/old/administrace/debug_list.php

Last change on this file was 371, checked in by george, 16 years ago
  • Opraveno: Stránkování seznamu ladících logů.
File size: 3.3 KB
Line 
1<?php
2
3include('global.php');
4
5function TimeToHumanTime($Value)
6{
7 return(floor($Value / 3600 / 24).' days, '.date('H:i:s', $Value - 3600));
8}
9
10echo('<table width="100%"><tr><td width="10%" valign="top" style="">');
11echo('<strong>Restart history:</strong><br>');
12
13if(array_key_exists('Id', $_GET)) $Id = addslashes($_GET['Id']);
14 else $Id = 0;
15if(array_key_exists('Page', $_GET)) $Page = addslashes($_GET['Page']);
16 else $Page = 0;
17
18$DbResult = $Database->query('SELECT COUNT(*) FROM debug');
19$DbRow = $DbResult->fetch_array();
20$Total = $DbRow[0];
21
22$DbResult = $Database->query('SELECT Id, Time FROM debug WHERE 1 ORDER BY Time DESC LIMIT '.($Page * $ItemPerPage).','.$ItemPerPage);
23while($DbRow = $DbResult->fetch_array())
24{
25 if($DbRow['Id'] == $Id) echo('<strong>');
26 echo('<a href="?Id='.$DbRow['Id'].'&amp;Page='.$Page.'&amp;Show=Backtrace">'.str_replace(" ", "&nbsp;", $DbRow['Time']).'</a>');
27 if($DbRow['Id'] == $Id) echo('</strong>');
28 echo('<br>');
29}
30echo(PagesList('?Page=', $Page, $Total, $ItemPerPage, 2));
31
32echo('</td><td valign="top" width="90%">');
33
34if($Id > 0)
35{
36 $DbResult = $Database->query('SELECT * FROM debug WHERE Id="'.$Id.'" ORDER BY Time');
37 if($DbResult->num_rows > 0)
38 {
39 $DbRow = $DbResult->fetch_array();
40 echo('<strong>Time:</strong> '.$DbRow['Time'].'<br>');
41 echo('<strong>MaNGOS version:</strong> '.$DbRow['MangosVersion'].'<br>');
42 echo('<strong>Database version:</strong> '.$DbRow['DbVersion'].'<br>');
43 echo('<strong>Uptime:</strong> '.TimeToHumanTime($DbRow['Uptime']).'<br>');
44 echo('<strong>MaxPlayerCount:</strong> '.$DbRow['MaxPlayerCount'].'<br><br>');
45 echo('<a href="?Id='.$Id.'&amp;Page='.$Page.'&amp;Show=Backtrace">Backtrace</a>'.
46 ' <a href="?Id='.$Id.'&amp;Page='.$Page.'&amp;Show=Log">Mangos log</a>'.
47 ' <a href="?Id='.$Id.'&amp;Page='.$Page.'&amp;Show=Error">Console error log</a>'.
48 ' <a href="?Id='.$Id.'&amp;Page='.$Page.'&amp;Show=DbErrors">Database error log</a>'.
49 ' <a href="?Id='.$Id.'&amp;Page='.$Page.'&amp;Show=Configuration">Mangos configuration</a>'.
50 '<hr>');
51 if(array_key_exists('Show', $_GET))
52 {
53 $Show = addslashes($_GET['Show']);
54 switch($Show)
55 {
56 case 'Backtrace':
57 $Content = htmlspecialchars($DbRow['Backtrace']);
58 for($I = 1; $I < 8; $I++)
59 {
60 $Content = str_replace('Thread '.$I.' ', '<hr><strong id="'.$I.'">Thread '.$I.'</strong>', $Content);
61 $Content = str_replace($I.' Thread ', '<a href="#'.$I.'"">'.$I.' Thread</a>', $Content);
62 }
63 echo('<strong>Backtrace:</strong> <br><pre>'.$Content.'</pre>');
64 break;
65 case 'Log':
66 echo('<strong>Console standard output log:</strong> <br><pre>'.htmlspecialchars($DbRow['Log']).'</pre>');
67 break;
68 case 'Error':
69 echo('<strong>Console error log:</strong> <br><pre>'.htmlspecialchars($DbRow['ErrorLog']).'</pre>');
70 break;
71 case 'DbErrors':
72 echo('<strong>Database error log:</strong> <br><pre>'.htmlspecialchars($DbRow['DbErrors']).'</pre>');
73 break;
74 case 'Configuration':
75 echo('<strong>Mangos configuration:</strong> <br><pre>'.htmlspecialchars($DbRow['Configuration']).'</pre>');
76 break;
77 }
78 }
79 }
80}
81
82echo('</td></tr></table>');
83
84?>
Note: See TracBrowser for help on using the repository browser.