Added the ability to download minidimps

This commit is contained in:
Latif Khalifa
2013-10-04 23:42:20 +02:00
parent 1000c4d743
commit dc57f4e5ae
4 changed files with 23 additions and 2 deletions

View File

@@ -61,5 +61,5 @@ rrmdir(ReportParser::getWorkPath());
if ($nr)
{
IRCNotify::send("#SingularityViewer", "[CrashProcessor] $nr new crash reports. http://crash.singularityviewer.org/crashes.php ");
IRCNotify::send("#SingularityViewer", "[CrashProcessor] $nr new reports. http://crash.singularityviewer.org/crashes.php ");
}

17
htdocs/download.php Normal file
View File

@@ -0,0 +1,17 @@
<?php
define("SITE_ROOT", realpath(dirname(__file__)));
require_once SITE_ROOT . "/lib/init.php";
$S->requireUser();
$r = ReportParser::parse((int)$_GET["report_id"]);
$miniDump = $r["Minidump"];
if (!$miniDump || !($miniDump->getData()))
{
Layout::header();
print "<h2>Minidump Download</h2><p>No such report</p>";
Layout::footer();
return;
}
http::sendDownload("singularity" . ((int)$_GET["report_id"]) . ".dmp", $miniDump->getData());

View File

@@ -41,7 +41,7 @@ class ReportParser
$q = kl_str_sql("select * from raw_reports where report_id=!i", $id);
if (!$res = $DB->query($q) OR !$row = $DB->fetchRow($res))
{
return new stdClass;
return array();
}
$data = new stdClass;
$DB->loadFromDbRow($data, $res, $row);

View File

@@ -69,6 +69,10 @@ Layout::header();
<th>Crash Reason</th>
<td><?php echo htmlentities($report->crash_reason . " at " . $report->crash_address . " thread " . $report->crash_thread) ?></td>
</tr>
<tr>
<th>Minidump</th>
<td><a href="download.php/singularity<?php echo (int)$report->id ?>.dmp?report_id=<?php echo (int)$report->id ?>">Download</a></td>
</tr>
</table>