From 687a1fb227d37f8c7fa6e960e2e755482caa2480 Mon Sep 17 00:00:00 2001 From: Latif Khalifa Date: Wed, 16 Oct 2013 13:46:34 +0200 Subject: [PATCH] Sync build infro from the alpha site --- htdocs/batch_process.php | 3 ++- htdocs/crashes.php | 2 +- htdocs/lib/CrashReport.php | 23 +++++++++++++++++++++++ htdocs/lib/Layout.php | 4 ++-- htdocs/lib/db_init.sql | 9 +++++++++ htdocs/sync_builds.php | 36 ++++++++++++++++++++++++++++++++++++ 6 files changed, 73 insertions(+), 4 deletions(-) create mode 100644 htdocs/sync_builds.php diff --git a/htdocs/batch_process.php b/htdocs/batch_process.php index d0c9e5f..b93b390 100644 --- a/htdocs/batch_process.php +++ b/htdocs/batch_process.php @@ -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/"); } diff --git a/htdocs/crashes.php b/htdocs/crashes.php index ff40b1b..56ac5b1 100644 --- a/htdocs/crashes.php +++ b/htdocs/crashes.php @@ -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"); diff --git a/htdocs/lib/CrashReport.php b/htdocs/lib/CrashReport.php index 13cd0d1..44ff0c6 100644 --- a/htdocs/lib/CrashReport.php +++ b/htdocs/lib/CrashReport.php @@ -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; + } } \ No newline at end of file diff --git a/htdocs/lib/Layout.php b/htdocs/lib/Layout.php index a9cc2c1..09032c0 100644 --- a/htdocs/lib/Layout.php +++ b/htdocs/lib/Layout.php @@ -132,8 +132,8 @@ class Layout - - + + Singularity Viewer - Automated Crash Report Processing System diff --git a/htdocs/lib/db_init.sql b/htdocs/lib/db_init.sql index 3915b54..0b73b6a 100644 --- a/htdocs/lib/db_init.sql +++ b/htdocs/lib/db_init.sql @@ -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) ); \ No newline at end of file diff --git a/htdocs/sync_builds.php b/htdocs/sync_builds.php new file mode 100644 index 0000000..2fb93ca --- /dev/null +++ b/htdocs/sync_builds.php @@ -0,0 +1,36 @@ +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(); +}