From f54f515f440f69de6479fef14cd2aae004aff551 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 23 May 2006 09:59:00 +0100 Subject: report runtime info in counter callbacks --- backend-rpc.php | 24 +++++++++++++++++++++++- functions.js | 9 ++++++++- functions.php | 7 +++++++ tt-rss.js | 4 +++- 4 files changed, 41 insertions(+), 3 deletions(-) diff --git a/backend-rpc.php b/backend-rpc.php index 1e98aa125..6387b1e53 100644 --- a/backend-rpc.php +++ b/backend-rpc.php @@ -24,22 +24,29 @@ if ($subop == "getLabelCounters") { $aid = $_GET["aid"]; print ""; + print ""; getLabelCounters($link); if ($aid) { getFeedCounter($link, $aid); } + print ""; print ""; } if ($subop == "getFeedCounters") { print ""; + print ""; getFeedCounters($link); + print ""; print ""; } if ($subop == "getAllCounters") { print ""; + print ""; getAllCounters($link); + print ""; + print_runtime_info($link); print ""; } @@ -71,8 +78,10 @@ update_rss_feed($link, $feed_url, $feed_id); } - print ""; + print ""; + print ""; getFeedCounter($link, $feed_id); + print ""; print ""; return; @@ -108,6 +117,8 @@ print ""; + print ""; + if ($global_unread_caller != $global_unread) { $omode = $_GET["omode"]; @@ -126,6 +137,10 @@ getGlobalCounters($link, $global_unread); + print ""; + + print_runtime_info($link); + print ""; } @@ -154,7 +169,10 @@ } } print ""; + print ""; getAllCounters($link); + print ""; + print_runtime_info($link); print ""; } @@ -181,7 +199,10 @@ } } print ""; + print ""; getAllCounters($link); + print ""; + print_runtime_info($link); print ""; } @@ -190,6 +211,7 @@ if (sanity_check($link)) { print ""; print_init_params($link); + print_runtime_info($link); } print ""; } diff --git a/functions.js b/functions.js index 355793640..e58a97036 100644 --- a/functions.js +++ b/functions.js @@ -470,6 +470,11 @@ function parse_counters(reply, scheduled_call) { var f_document = getFeedsContext().document; var title_obj = getMainContext(); + if (reply.firstChild && reply.firstChild.firstChild) { + debug("wrong element passed to parse_counters, adjusting."); + reply = reply.firstChild; + } + debug("F_DOC: " + f_document + ", T_OBJ: " + title_obj); for (var l = 0; l < reply.childNodes.length; l++) { @@ -565,7 +570,9 @@ function all_counters_callback() { var reply = xmlhttp_rpc.responseXML.firstChild; - parse_counters(reply); + var counters = reply.firstChild; + + parse_counters(counters); } catch (e) { exception_error("all_counters_callback", e); diff --git a/functions.php b/functions.php index 5ec8d45f4..fbce56b5e 100644 --- a/functions.php +++ b/functions.php @@ -1718,4 +1718,11 @@ print ""; } + + function print_runtime_info($link) { + print ""; + print ""; + print ""; + } ?> diff --git a/tt-rss.js b/tt-rss.js index 55c813b7f..7157d3292 100644 --- a/tt-rss.js +++ b/tt-rss.js @@ -70,8 +70,10 @@ function refetch_callback() { if (error_code && error_code != 0) { return fatalError(error_code, reply.getAttribute("error-msg")); } + + var counters = reply.firstChild; - parse_counters(reply, true); + parse_counters(counters, true); debug("refetch_callback: done"); -- cgit v1.2.3