From f9e57a8d0b83155929c3b4aa23e50017679795fc Mon Sep 17 00:00:00 2001 From: Rytis Slatkevicius Date: Sat, 28 Sep 2013 18:53:42 +0300 Subject: [PATCH] Add per-app counts to XML version of the server status page, much like the HTML version. --- html/user/server_status.php | 80 +++++++++++++++++++++++-------------- 1 file changed, 51 insertions(+), 29 deletions(-) diff --git a/html/user/server_status.php b/html/user/server_status.php index a435495389..c305d0b8ff 100644 --- a/html/user/server_status.php +++ b/html/user/server_status.php @@ -386,8 +386,9 @@ if ($retval) { ); if (!$xml) { echo ""; - echo ""; - echo ""; + echo "
".tra("Users")."#
"; + echo ""; + } show_counts( tra("with recent credit"), "users_with_recent_credit", @@ -403,7 +404,9 @@ if ($retval) { "users_registered_in_past_24_hours", get_mysql_count("user where create_time > (unix_timestamp() - (24*3600))") ); - echo ""; + if (!$xml) { + echo ""; + } show_counts( tra("with recent credit"), "hosts_with_recent_credit", @@ -425,39 +428,58 @@ if ($retval) { "current_floating_point_speed", get_mysql_value("SELECT sum(expavg_credit)/200 as value FROM user") ); + if (!$xml) { + end_table(); + echo "
".tra("Users")."#
".tra("Computers")."#
".tra("Computers")."#
"; - end_table(); - echo ""; - - start_table(); - echo "".tra("Tasks by application").""; - row_heading_array( - array( - tra("application"), - tra("unsent"), - tra("in progress"), - tra("avg runtime of last 100 results in h (min-max)"), - tra("users in last 24h") - ) - ); + start_table(); + echo "".tra("Tasks by application").""; + row_heading_array( + array( + tra("application"), + tra("unsent"), + tra("in progress"), + tra("avg runtime of last 100 results in h (min-max)"), + tra("users in last 24h") + ) + ); + } $apps = get_mysql_assoc("SELECT * FROM app WHERE deprecated != 1"); + if ($xml) { + echo " \n"; + } foreach($apps as $app) { $appid = $app["id"]; $uf_name = $app["user_friendly_name"]; - echo "$uf_name - " . number_format(get_mysql_count("result where server_state = 2 and appid = $appid")) . " - " . number_format(get_mysql_count("result where server_state = 4 and appid = $appid")) . " - " - ; $info = get_runtime_info($appid); - echo number_format($info->avg,2) . " (" . number_format($info->min,2) . " - " . number_format($info->max,2) . ")"; - echo " - " . number_format(get_mysql_user("and appid = $appid")) . " - " - ; + if ($xml) { + echo " \n"; + echo " ".$appid."\n"; + echo " ".$app["name"]."\n"; + echo " ".get_mysql_count("result where server_state = 2 and appid = $appid")."\n"; + echo " ".get_mysql_count("result where server_state = 4 and appid = $appid")."\n"; + echo " ".round($info->avg, 2)."\n"; + echo " ".round($info->min, 2)."\n"; + echo " ".round($info->max, 2)."\n"; + echo " ".get_mysql_user("and appid = $appid")."\n"; + echo " \n"; + } else { + echo "$uf_name + " . number_format(get_mysql_count("result where server_state = 2 and appid = $appid")) . " + " . number_format(get_mysql_count("result where server_state = 4 and appid = $appid")) . " + " + ; + echo number_format($info->avg,2) . " (" . number_format($info->min,2) . " - " . number_format($info->max,2) . ")"; + echo " + " . number_format(get_mysql_user("and appid = $appid")) . " + " + ; + } } - end_table(); - + if ($xml) { + echo " \n"; + } else { + end_table(); } }