Changeset 329


Ignore:
Timestamp:
Apr 9, 2008, 4:48:09 PM (16 years ago)
Author:
george
Message:

Upraveno: Optimalizace a opravy systému zaznamenávání ladících informací o pádech serveru.

Location:
administrace
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • administrace/debug_list.php

    r320 r329  
    88}
    99
    10 echo('<table><tr><td width="150px" valign="top">');
     10echo('<table width="100%"><tr><td width="150px" valign="top">');
     11echo('<strong>Restart list</strong><br>');
    1112
    1213$DbResult = $Database->query('SELECT Id, Time FROM debug WHERE 1 ORDER BY Time DESC');
    1314while($DbRow = $DbResult->fetch_array())
    1415{
    15   echo('<a href="?Id='.$DbRow['Id'].'&amp;Show=Backtrace">'.$DbRow['Time'].'</a><br>');
     16  echo('<a href="?Id='.$DbRow['Id'].'">'.str_replace(" ", "&nbsp;", $DbRow['Time']).'</a><br>');
    1617}
    1718
     
    3132    echo('<strong>MaxPlayerCount:</strong> '.$DbRow['MaxPlayerCount'].'<br><br>');
    3233    echo('<a href="?Id='.$Id.'&amp;Show=Backtrace">Backtrace</a>'.
    33       '  <a href="?Id='.$Id.'&amp;Show=Log">Console standard output log</a>'.
    34       '  <a href="?Id='.$Id.'&amp;Show=Error">Console error log</a><hr>');
     34      '  <a href="?Id='.$Id.'&amp;Show=Log">Mangos log</a>'.
     35      '  <a href="?Id='.$Id.'&amp;Show=Error">Console error log</a>'.
     36      '  <a href="?Id='.$Id.'&amp;Show=DbErrors">Database error log</a><hr>');
    3537    if(array_key_exists('Show', $_GET))
    3638    {
     
    3941      {
    4042        case 'Backtrace':
    41           echo('<strong>Backtrace:</strong> <br><pre>'.str_replace("\n", '<br>', $DbRow['Backtrace']).'</pre>');
     43          echo('<strong>Backtrace:</strong> <br><pre>'.htmlspecialchars($DbRow['Backtrace']).'</pre>');
    4244          break;
    4345        case 'Log':
    44           echo('<strong>Console standard output log:</strong> <br><pre>'.str_replace("\n", '<br>', $DbRow['Log']).'</pre>');
     46          echo('<strong>Console standard output log:</strong> <br><pre>'.htmlspecialchars($DbRow['Log']).'</pre>');
    4547          break;
    4648        case 'Error':
    47           echo('<strong>Console error log:</strong> <br><pre>'.str_replace("\n", '<br>', $DbRow['ErrorLog']).'</pre>');
     49          echo('<strong>Console error log:</strong> <br><pre>'.htmlspecialchars($DbRow['ErrorLog']).'</pre>');
     50          break;
     51        case 'DbErrors':
     52          echo('<strong>Database error log:</strong> <br><pre>'.htmlspecialchars($DbRow['DbErrors']).'</pre>');
    4853          break;
    4954      }
  • administrace/global.php

    r320 r329  
    66$StdOutLogFile = '/a/log/mangos/mangos-worldd.log';
    77$ErrOutLogFile = '/a/log/mangos/mangos-worldd.err';
     8$MangosLogFile = '/a/log/mangos/Server.log';
     9$MangosDbErrorsLogFile = '/a/log/mangos/DBErrors.log';
     10
    811//$DatabaseHost = $Config['Database']['Host'];
    912//$DatabaseUser = '$Config['Database']['User'];
  • administrace/process_log.php

    r320 r329  
    11<?php
    22
     3chdir('/var/www/wow/administrace/');
    34include('global.php');
    45
    56$Content = file_get_contents($StdOutLogFile);
    67$Lines = explode("\n", $Content);
     8$Content = ''; // Free unused memory
    79
    810// Separate information from log file
     
    1517$Backtrace = array_slice($Lines, $Line, count($Lines) - $Line);   // Assume rest of file to be backtrace
    1618$Backtrace = addslashes(implode("\n", $Backtrace));
     19$Lines = '';
    1720
    18 $Log = array_slice($Lines, 0, $Line);
    19 $Log = addslashes(implode("\n", $Log));
    20 
    21 $ErrorLog = addslashes(file_get_contents($ErrOutLogFile));
     21//$Log = array_slice($Lines, 0, $Line);
     22//$Log = addslashes(implode("\n", $Log));
    2223
    2324// Get used database version from database
     
    4041// Insert data in separate query to partly avoid too long query packet error
    4142$Database->query('UPDATE `debug` SET Backtrace="'.$Backtrace.'" WHERE Id='.$InsertId);
    42 echo($Database->error);
     43$Backtrace = '';
     44//echo($Database->error);
     45$Log = addslashes(file_get_contents($MangosLogFile));
    4346$Database->query('UPDATE `debug` SET Log="'.$Log.'" WHERE Id='.$InsertId);
    44 echo($Database->error);
    45 $Database->query('UPDATE `debug` SET ErrorLog="'.$ErrorLog.'" WHERE Id='.$InsertId);
    46 echo($Database->error);
     47//echo($Database->error);
     48$Log = addslashes(file_get_contents($ErrOutLogFile));
     49$Database->query('UPDATE `debug` SET ErrorLog="'.$Log.'" WHERE Id='.$InsertId);
     50//echo($Database->error);
     51$Log = addslashes(file_get_contents($MangosDbErrorsLogFile));
     52$Database->query('UPDATE `debug` SET DbErrors="'.$Log.'" WHERE Id='.$InsertId);
     53//echo($Database->error);
    4754
    4855// Clear log files
     56unlink($MangosLogFile);
    4957unlink($StdOutLogFile);
    5058unlink($ErrOutLogFile);
     59unlink($MangosDbErrorsLogFile);
    5160
    5261?>
Note: See TracChangeset for help on using the changeset viewer.