Exemplo n.º 1
0
 */
$relpa = ($relpa0 = preg_replace("/[\\/]+/", "/", $_SERVER['DOCUMENT_ROOT'] . '/')) ? $relpa0 : '';
ob_start();
$a_inc = array('inc/regional.inc', 'inc/adminauth.inc', 'lib/swamper.class.php');
foreach ($a_inc as $v) {
    require_once $relpa . $v;
}
class ErrorLogParser extends Swamper
{
    function __construct()
    {
        parent::__construct();
    }
}
if (!isset($ErrorLogParser) || empty($ErrorLogParser)) {
    $ErrorLogParser = new ErrorLogParser();
}
$error_log = '';
switch (str_replace('www.', '', $_SERVER['HTTP_HOST'])) {
    case 'localhost':
        $error_log = 'D:/server/logs/error.log';
        break;
    case 'shimansky.biz':
        $error_log = '/usr/home/23954/shimansky.biz/log/' . date("Y-m-d") . '.error.log';
        break;
}
if (!file_exists($error_log)) {
    die('<p>Please specify log file path once again.<br />in /etc/php.ini uncomment and write error_log=/etc/httpd/error_log<br /><br />su<br />cd /etc/httpd<br />touch error_log<br />httpd -k stop<br />httpd</p>');
}
if (!empty($_REQUEST['clear'])) {
    $ErrorLogParser->write_file($error_log, '', "w+");
 /**
  * Test for parseLine().
  *
  * @param string $line
  * @param array  $expectedResult
  *
  * @dataProvider getTestParseLineData()
  */
 public function testParseLine($line, array $expectedResult)
 {
     $parser = new ErrorLogParser();
     $result = $parser->parseLine($line);
     $this->assertEquals($expectedResult, $result);
 }