Added operating system stats
This commit is contained in:
@@ -13,6 +13,36 @@ class CrashStats
|
|||||||
{
|
{
|
||||||
$this->filter = $filter;
|
$this->filter = $filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getOSStats()
|
||||||
|
{
|
||||||
|
$ret = array();
|
||||||
|
$where = $this->filter->getWhere();
|
||||||
|
if ($where)
|
||||||
|
{
|
||||||
|
$where .= " and ";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$where = "where ";
|
||||||
|
}
|
||||||
|
$where .= "os_type is not null";
|
||||||
|
$q = "select count(id) as nr, os_type from reports $where group by os_type order by nr desc";
|
||||||
|
$q .= kl_str_sql(" limit !i", $this->filter->limit);
|
||||||
|
if (false !== $cached = Memc::getq($q)) return $cached;
|
||||||
|
|
||||||
|
if (!$res = DBH::$db->query($q)) return $ret;
|
||||||
|
|
||||||
|
while ($row = DBH::$db->fetchRow($res))
|
||||||
|
{
|
||||||
|
$o = new stdClass;
|
||||||
|
DBH::$db->loadFromDbRow($o, $res, $row);
|
||||||
|
$ret[] = $o;
|
||||||
|
}
|
||||||
|
|
||||||
|
Memc::setq($q, $ret);
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
function getRegionStats()
|
function getRegionStats()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -40,6 +40,30 @@ $filter->render();
|
|||||||
|
|
||||||
<!-- os tab -->
|
<!-- os tab -->
|
||||||
<div id="tab-3">
|
<div id="tab-3">
|
||||||
|
<?php
|
||||||
|
function rl_o($r)
|
||||||
|
{
|
||||||
|
global $filter;
|
||||||
|
return URL_ROOT . "/crashes.php?" . $filter->getURLArgs() . "&os=" . urlencode($r->os_type);
|
||||||
|
}
|
||||||
|
$oses = $stats->getOSStats();
|
||||||
|
$c = count($oses);
|
||||||
|
if ($c) :
|
||||||
|
?>
|
||||||
|
<table class="jtable">
|
||||||
|
<tr>
|
||||||
|
<th>Nr. reports</th>
|
||||||
|
<th>Operating System Type</th>
|
||||||
|
</tr>
|
||||||
|
<?php foreach($oses as $r): ?>
|
||||||
|
<tr class="rowhighlight">
|
||||||
|
<td style="text-align: right"><a href="<?php echo rl_o($r) ?>"><?php echo htmlentities($r->nr) ?></a></td>
|
||||||
|
<td><a href="<?php echo rl_o($r) ?>"><?php echo htmlentities($r->os_type) ?></a></td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<?php endif ?>
|
||||||
</div>
|
</div>
|
||||||
<!-- /os tab -->
|
<!-- /os tab -->
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user