1 | <?php
|
---|
2 |
|
---|
3 | include('global.php');
|
---|
4 |
|
---|
5 | function TimeToHumanTime($Value)
|
---|
6 | {
|
---|
7 | return(floor($Value / 3600 / 24).' days, '.date('H:i:s', $Value - 3600));
|
---|
8 | }
|
---|
9 |
|
---|
10 | echo('<table width="100%"><tr><td width="10%" valign="top" style="">');
|
---|
11 | echo('<strong>Restart history:</strong><br>');
|
---|
12 |
|
---|
13 | if(array_key_exists('Id', $_GET)) $Id = addslashes($_GET['Id']);
|
---|
14 | else $Id = 0;
|
---|
15 | if(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);
|
---|
23 | while($DbRow = $DbResult->fetch_array())
|
---|
24 | {
|
---|
25 | if($DbRow['Id'] == $Id) echo('<strong>');
|
---|
26 | echo('<a href="?Id='.$DbRow['Id'].'&Page='.$Page.'&Show=Backtrace">'.str_replace(" ", " ", $DbRow['Time']).'</a>');
|
---|
27 | if($DbRow['Id'] == $Id) echo('</strong>');
|
---|
28 | echo('<br>');
|
---|
29 | }
|
---|
30 | echo(PagesList('?Page=', $Page, $Total, $ItemPerPage, 2));
|
---|
31 |
|
---|
32 | echo('</td><td valign="top" width="90%">');
|
---|
33 |
|
---|
34 | if($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.'&Page='.$Page.'&Show=Backtrace">Backtrace</a>'.
|
---|
46 | ' <a href="?Id='.$Id.'&Page='.$Page.'&Show=Log">Mangos log</a>'.
|
---|
47 | ' <a href="?Id='.$Id.'&Page='.$Page.'&Show=Error">Console error log</a>'.
|
---|
48 | ' <a href="?Id='.$Id.'&Page='.$Page.'&Show=DbErrors">Database error log</a>'.
|
---|
49 | ' <a href="?Id='.$Id.'&Page='.$Page.'&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 |
|
---|
82 | echo('</td></tr></table>');
|
---|
83 |
|
---|
84 | ?>
|
---|