Crash listing done

This commit is contained in:
Latif Khalifa
2013-10-04 04:28:16 +02:00
parent a7d294b3c0
commit f5206f7580
3 changed files with 56 additions and 3 deletions

View File

@@ -4,11 +4,31 @@ define("SITE_ROOT", realpath(dirname(__file__)));
require_once SITE_ROOT . "/lib/init.php";
$S->requireUser();
$total = CrashReport::getTotal();
$reports = CrashReport::getReports();
Layout::header();
?>
<strong>Not implemented</strong>
<p>Reports <strong><?php echo $total ?></strong></p>
<table>
<tr>
<th>ID</th>
<th>Version</th>
<th>Operating System</th>
<th>GPU</th>
<th>Grid (region)</th>
</tr>
<?php for ($i=0; $i<count($reports); $i++): ?>
<tr class="rowhighlight">
<td><?php echo (int)$reports[$i]->id ?></td>
<td><?php echo htmlspecialchars($reports[$i]->client_channel . " " . $reports[$i]->client_version) ?></td>
<td><?php echo htmlspecialchars($reports[$i]->os) ?></td>
<td><?php echo htmlspecialchars($reports[$i]->gpu) ?></td>
<td><?php echo htmlspecialchars($reports[$i]->grid . " (" . $reports[$i]->region . ")") ?></td>
</tr>
<?php endfor ?>
</table>
<?php
Layout::footer();

View File

@@ -22,6 +22,41 @@ class CrashReport
public $threads = array();
public $raw_stacktrace;
function getTotal()
{
global $DB;
if (!$res = $DB->query("select count(id) as total from reports") OR !$row = $DB->fetchRow($res))
{
return 0;
}
else
{
return $row["total"];
}
}
function getReports($offset = 0, $limit = 100)
{
global $DB;
$ret = array();
if (!$res = $DB->query(kl_str_sql("select * from reports order by id desc limit !i offset !i", $limit, $offset)))
{
return $ret;
}
while ($row = $DB->fetchRow($res))
{
$r = new CrashReport;
$DB->loadFromDbRow($r, $res, $row);
$r->parseStackTrace($r->raw_stacktrace);
$ret[] = $r;
}
return $ret;
}
function delete()
{
global $DB;

View File

@@ -1,6 +1,4 @@
<?php
/* $Id$ */
class DBH
{