IRC notifier
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -4,5 +4,6 @@ dumps
|
||||
incoming_symbols
|
||||
logs
|
||||
htdocs/lib/logs
|
||||
htdocs/lib/irc_passwd
|
||||
.hg*
|
||||
|
||||
|
||||
@@ -28,6 +28,8 @@ print "Working dir set to " . ReportParser::getWorkPath() . "\n";
|
||||
mkdir(ReportParser::getWorkPath());
|
||||
chdir(ReportParser::getWorkPath());
|
||||
|
||||
$nr = 0;
|
||||
|
||||
foreach($reports as $id)
|
||||
{
|
||||
print "Processing report {$id} \n";
|
||||
@@ -50,9 +52,14 @@ foreach($reports as $id)
|
||||
$crash->init($id, $r, $stacktrace);
|
||||
if ($crash->save())
|
||||
{
|
||||
$nr++;
|
||||
ReportParser::setProcessed($id, 1);
|
||||
}
|
||||
}
|
||||
|
||||
rrmdir(ReportParser::getWorkPath());
|
||||
|
||||
if ($nr)
|
||||
{
|
||||
IRCNotify::send("#SingularityViewer", "[CrashProcessor] $nr new crash reports. http://crash.singularityviewer.org/crashes.php ");
|
||||
}
|
||||
@@ -12,7 +12,7 @@ class DBH
|
||||
|
||||
function log($line)
|
||||
{
|
||||
//return;
|
||||
return;
|
||||
static $f = false;
|
||||
static $failed = false;
|
||||
|
||||
@@ -54,8 +54,8 @@ class DBH
|
||||
}
|
||||
|
||||
|
||||
$this->query("SET SQL_MODE='TRADITIONAL'");
|
||||
$this->query("SET NAMES 'utf8'");
|
||||
//$this->query("SET SQL_MODE='TRADITIONAL'");
|
||||
$this->query("SET NAMES 'utf8'");
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
27
htdocs/lib/IRCNotify.php
Normal file
27
htdocs/lib/IRCNotify.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
class IRCNotify
|
||||
{
|
||||
function http_post($url, $fields)
|
||||
{
|
||||
$ch = curl_init($url);
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
|
||||
$res = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
function send($chan, $msg)
|
||||
{
|
||||
$fields = array(
|
||||
"chan" => $chan,
|
||||
"auth" => file_get_contents(SITE_ROOT . '/lib/irc_passwd'),
|
||||
"msg" => $msg
|
||||
);
|
||||
|
||||
self::http_post("http://messi.streamgrid.net/~lkalif/lolabot.php", $fields);
|
||||
}
|
||||
}
|
||||
@@ -52,5 +52,5 @@ create table reports(
|
||||
crash_reason varchar(128),
|
||||
crash_address varchar(16),
|
||||
crash_thread integer,
|
||||
raw_stacktrace text
|
||||
raw_stacktrace longtext
|
||||
);
|
||||
Reference in New Issue
Block a user