summaryrefslogtreecommitdiffstats
path: root/frontends/php/include/items.inc.php
diff options
context:
space:
mode:
authorsasha <sasha@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2007-10-03 13:24:36 +0000
committersasha <sasha@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2007-10-03 13:24:36 +0000
commita59cf78fe5046e8021167a80cc2c6912385c87e8 (patch)
tree25d30233c32b0096e4c07d02e6571448b149a03f /frontends/php/include/items.inc.php
parentc78202c579c9b7059e5eb81d1989f672fb24ac62 (diff)
downloadzabbix-a59cf78fe5046e8021167a80cc2c6912385c87e8.tar.gz
zabbix-a59cf78fe5046e8021167a80cc2c6912385c87e8.tar.xz
zabbix-a59cf78fe5046e8021167a80cc2c6912385c87e8.zip
- [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
Diffstat (limited to 'frontends/php/include/items.inc.php')
-rw-r--r--frontends/php/include/items.inc.php33
1 files changed, 17 insertions, 16 deletions
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)));