Finished top crashers stat page
This commit is contained in:
@@ -83,7 +83,7 @@ class CrashReport
|
||||
}
|
||||
}
|
||||
|
||||
function getReports($filter, $fields = "id, reported, client_version, client_channel, os, gpu, grid, region")
|
||||
function getReports($filter, $fields = "id, reported, client_version, client_channel, os, gpu, grid, region, signature_id")
|
||||
{
|
||||
$ret = array();
|
||||
$q = "select $fields from reports " . $filter->getWhere() . kl_str_sql(" order by id desc limit !i offset !i", $filter->limit, $filter->offset);
|
||||
@@ -305,7 +305,15 @@ class CrashReport
|
||||
}
|
||||
}
|
||||
|
||||
if ($function == $singu_function) $function = "";
|
||||
if ($function == $singu_function)
|
||||
{
|
||||
$function = "";
|
||||
}
|
||||
if (!$singu_function && strpos($function, "LL") !== false)
|
||||
{
|
||||
$singu_function = $function;
|
||||
$function = "";
|
||||
}
|
||||
$this->signature_text = "$module|$function|$singu_function";
|
||||
$this->signature = md5($this->signature_text);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,14 @@ class CrashStats
|
||||
|
||||
function __construct($filter = null)
|
||||
{
|
||||
$this->filter = $filter;
|
||||
if ($filter)
|
||||
{
|
||||
$this->filter = $filter;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->filter = new SearchFilter;
|
||||
}
|
||||
}
|
||||
|
||||
function setFilter($filter)
|
||||
@@ -14,6 +21,49 @@ class CrashStats
|
||||
$this->filter = $filter;
|
||||
}
|
||||
|
||||
function getTopCrashers()
|
||||
{
|
||||
$ret = array();
|
||||
$where = $this->filter->getWhere();
|
||||
$q = "select count(r.id) as nr, s.id as signature_id, s.signature as signature_text from reports r join signature s on r.signature_id = s.id $where group by signature_id order by nr desc";
|
||||
$q .= kl_str_sql(" limit !i", 100);
|
||||
if (false !== $cached = Memc::getq($q)) return $cached;
|
||||
|
||||
if (!$res = DBH::$db->query($q))
|
||||
{
|
||||
return $ret;
|
||||
}
|
||||
|
||||
while ($row = DBH::$db->fetchRow($res))
|
||||
{
|
||||
$r = new stdClass;
|
||||
DBH::$db->loadFromDbRow($r, $res, $row);
|
||||
$ret[] = $r;
|
||||
}
|
||||
|
||||
Memc::setq($q, $ret);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
function getSignature($id)
|
||||
{
|
||||
$ret = new stdClass;
|
||||
$q = kl_str_sql("select * from signature where id=!i", $id);
|
||||
|
||||
if (!$res = DBH::$db->query($q))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($row = DBH::$db->fetchRow($res))
|
||||
{
|
||||
DBH::$db->loadFromDbRow($ret, $res, $row);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function getGPUStats()
|
||||
{
|
||||
$ret = array();
|
||||
|
||||
@@ -9,6 +9,7 @@ class SearchFilter
|
||||
public $region;
|
||||
public $gpu;
|
||||
public $stacktrace;
|
||||
public $signature_id;
|
||||
|
||||
public $sort_by;
|
||||
public $sort_order;
|
||||
@@ -18,7 +19,7 @@ class SearchFilter
|
||||
public $offset = 0;
|
||||
public $page = 0;
|
||||
|
||||
var $fields = array("os", "chan", "version", "grid", "region", "gpu", "stacktrace");
|
||||
var $fields = array("os", "chan", "version", "grid", "region", "gpu", "stacktrace", "signature_id");
|
||||
|
||||
function __construct()
|
||||
{
|
||||
@@ -76,6 +77,7 @@ class SearchFilter
|
||||
if ($this->grid) $cond[] = kl_str_sql("grid=!s", $this->grid);
|
||||
if ($this->region) $cond[] = kl_str_sql("region=!s", $this->region);
|
||||
if ($this->gpu) $cond[] = kl_str_sql("gpu=!s", $this->gpu);
|
||||
if ($this->signature_id) $cond[] = kl_str_sql("signature_id=!s", $this->signature_id);
|
||||
|
||||
if ($this->stacktrace)
|
||||
{
|
||||
@@ -213,6 +215,10 @@ for($i = 0; $i < count($grids); $i++)
|
||||
<input type="hidden" name="gpu" value="<?php echo htmlentities($this->gpu) ?>" />
|
||||
<?php endif ?>
|
||||
|
||||
<?php if ($this->signature_id): ?>
|
||||
<input type="hidden" name="signature_id" value="<?php echo htmlentities($this->signature_id) ?>" />
|
||||
<?php endif ?>
|
||||
|
||||
</form>
|
||||
|
||||
<?php
|
||||
|
||||
4
htdocs/lib/update_signatures.php
Executable file → Normal file
4
htdocs/lib/update_signatures.php
Executable file → Normal file
@@ -17,8 +17,8 @@ while ($row = DBH::$db->fetchRow($res))
|
||||
DBH::$db->loadFromDbRow($r, $res, $row);
|
||||
$r->parseStackTrace();
|
||||
$r->updateSignature();
|
||||
var_dump($r);
|
||||
print "Updating signature for {$r->id}\n";
|
||||
$r->saveSignature();
|
||||
}
|
||||
DBH::$db->commit();
|
||||
DBH::$db->commit();
|
||||
Memc::flush();
|
||||
Reference in New Issue
Block a user