Sync build infro from the alpha site
This commit is contained in:
@@ -64,5 +64,6 @@ rrmdir(ReportParser::getWorkPath());
|
||||
if ($nr)
|
||||
{
|
||||
Memc::flush();
|
||||
IRCNotify::send("#SingularityViewer", "[CrashProcessor] $nr new reports. http://crash.singularityviewer.org/crashes.php ");
|
||||
$rp = $nr != 1 ? "reports" : "report";
|
||||
IRCNotify::send("#SingularityViewer", "[CrashProcessor] $nr new $rp. http://crash.singularityviewer.org/");
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ $filter->render();
|
||||
setDialog($link.data("id"));
|
||||
$dialog.dialog("option","position", getPos(e));
|
||||
$dialog.dialog("option","title", "Crash signature " + signature_id);
|
||||
$link.delay(300).queue(function() {
|
||||
$link.delay(1000).queue(function() {
|
||||
if (!$dialog.dialog("isOpen"))
|
||||
{
|
||||
$dialog.dialog("open");
|
||||
|
||||
@@ -380,4 +380,27 @@ class CrashReport
|
||||
$this->raw_stacktrace = $stacktrace;
|
||||
$this->parseStackTrace($this->raw_stacktrace);
|
||||
}
|
||||
|
||||
static function getBuildsMap()
|
||||
{
|
||||
$ret = array();
|
||||
$q = "select * from builds order by chan asc, build_nr desc";
|
||||
if (false !== $cached = Memc::getq($q)) return $cached;
|
||||
|
||||
if (!$res = DBH::$db->query($q)) return;
|
||||
|
||||
while ($row = DBH::$db->fetchRow($res))
|
||||
{
|
||||
$build = new stdClass;
|
||||
DBH::$db->loadFromDbRow($build, $res, $row);
|
||||
if (!$ret[$build->chan])
|
||||
{
|
||||
$ret[$build->chan] = array();
|
||||
}
|
||||
$ret[$build->chan][$build->version] = $build->hash;
|
||||
}
|
||||
|
||||
Memc::setq($q, $ret);
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
@@ -132,8 +132,8 @@ class Layout
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||
<link rel="stylesheet" type="text/css" href="<?php print URL_ROOT ?>/css/singularity/jquery-ui-1.10.3.custom.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="<?php print URL_ROOT ?>/css/singularity/singularity.css"/>
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
|
||||
<link rel="shortcut icon" href="<?php print IMG_ROOT ?>/favicon.ico" type="image/x-icon" />
|
||||
<title>Singularity Viewer - Automated Crash Report Processing System</title>
|
||||
</head>
|
||||
|
||||
@@ -69,4 +69,13 @@ create table comment(
|
||||
user_id integer,
|
||||
commented timestamp not null default current_timestamp,
|
||||
comment text
|
||||
);
|
||||
|
||||
create table builds(
|
||||
build_nr integer,
|
||||
chan varchar(64),
|
||||
version varchar(64),
|
||||
hash varchar(64),
|
||||
modified timestamp,
|
||||
primary key(chan, build_nr)
|
||||
);
|
||||
36
htdocs/sync_builds.php
Normal file
36
htdocs/sync_builds.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
define("SITE_ROOT", realpath(dirname(__file__)));
|
||||
require_once SITE_ROOT . "/lib/init.php";
|
||||
|
||||
set_time_limit(0);
|
||||
|
||||
if (PHP_SAPI != "cli")
|
||||
{
|
||||
header("Content-Type: text/plain");
|
||||
}
|
||||
|
||||
if (!$remote_map = json_decode(file_get_contents("http://alpha.singularityviewer.org/alpha/builds_map.php"))) return;
|
||||
|
||||
$existing = CrashReport::getBuildsMap();
|
||||
|
||||
$nr = 0;
|
||||
foreach ($remote_map as $build)
|
||||
{
|
||||
if (!$existing[$build->chan][$build->version])
|
||||
{
|
||||
$nr++;
|
||||
$q = kl_str_sql("insert into builds (build_nr, chan, version, hash, modified) values (!i, !s, !s, !s, !s)",
|
||||
$build->build_nr,
|
||||
$build->chan,
|
||||
$build->version,
|
||||
$build->hash,
|
||||
$build->modified);
|
||||
DBH::$db->query($q);
|
||||
}
|
||||
}
|
||||
if ($nr)
|
||||
{
|
||||
print "Added $nr builds\n";
|
||||
Memc::flush();
|
||||
}
|
||||
Reference in New Issue
Block a user