From a59cf78fe5046e8021167a80cc2c6912385c87e8 Mon Sep 17 00:00:00 2001 From: sasha Date: Wed, 3 Oct 2007 13:24:36 +0000 Subject: - [ZBX-90] fixed displaying of last line of a log file in the Latest Data and Overview (Alexei) [svn merge svn://svn.zabbix.com/branches/1.4 -r4823:4828] git-svn-id: svn://svn.zabbix.com/trunk@4829 97f52cf1-0a1b-0410-bd0e-c28be96e8082 --- frontends/php/include/items.inc.php | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'frontends/php/include/items.inc.php') diff --git a/frontends/php/include/items.inc.php b/frontends/php/include/items.inc.php index 3f9863bd..3eea2f4b 100644 --- a/frontends/php/include/items.inc.php +++ b/frontends/php/include/items.inc.php @@ -1061,7 +1061,23 @@ COpt::profiling_stop('prepare table'); function format_lastvalue($db_item) { - if(isset($db_item["lastvalue"])) + if($db_item["value_type"] == ITEM_VALUE_TYPE_LOG) + { + $row=DBfetch(DBselect("select max(id) as max from history_log where itemid=".$db_item["itemid"])); + + if($row && !is_null($row['max'])) + { + $row2=DBfetch(DBselect("select value from history_log where id=".$row["max"])); + $lastvalue=nbsp(htmlspecialchars(substr($row2["value"],0,20))); + if(strlen($db_item["lastvalue"]) > 20) + $lastvalue .= " ..."; + } + else + { + $lastvalue="-"; + } + } + else if(isset($db_item["lastvalue"])) { if($db_item["value_type"] == ITEM_VALUE_TYPE_FLOAT) { @@ -1075,21 +1091,6 @@ COpt::profiling_stop('prepare table'); { $lastvalue="..."; } - else if($db_item["value_type"] == ITEM_VALUE_TYPE_LOG) - { - $row=DBfetch(DBselect("select max(id) as max from history_log where itemid=".$db_item["itemid"])); - if($row) - { - $row2=DBfetch(DBselect("select value from history_log where id=".$row["max"])); - $lastvalue=nbsp(htmlspecialchars(substr($row2["value"],0,20))); - if(strlen($db_item["lastvalue"]) > 20) - $lastvalue .= " ..."; - } - else - { - $lastvalue="-"; - } - } else if($db_item["value_type"] == ITEM_VALUE_TYPE_STR) { $lastvalue=nbsp(htmlspecialchars(substr($db_item["lastvalue"],0,20))); -- cgit