diff options
| author | artem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2008-08-19 11:35:09 +0000 |
|---|---|---|
| committer | artem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2008-08-19 11:35:09 +0000 |
| commit | 84a4272b58e6bcc5be3366adc5771851c522eae3 (patch) | |
| tree | e088fd336667817dda9b8b89ddb3ea0ee6a327b8 /frontends/php/httpdetails.php | |
| parent | c18881cf3bf1288bff75ecb10df386ec25a0cab9 (diff) | |
- [DEV-137] improvements in sqls (Artem)
git-svn-id: svn://svn.zabbix.com/trunk@5926 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/httpdetails.php')
| -rw-r--r-- | frontends/php/httpdetails.php | 54 |
1 files changed, 21 insertions, 33 deletions
diff --git a/frontends/php/httpdetails.php b/frontends/php/httpdetails.php index 70d48b42..f62be043 100644 --- a/frontends/php/httpdetails.php +++ b/frontends/php/httpdetails.php @@ -116,38 +116,30 @@ include_once "include/page_header.php"; ); $db_httpsteps = DBselect('select * from httpstep where httptestid='.$httptest_data['httptestid'].' order by no'); - while($httpstep_data = DBfetch($db_httpsteps)) - { + while($httpstep_data = DBfetch($db_httpsteps)){ $status['msg'] = S_OK_BIG; $status['style'] = 'enabled'; - if( HTTPTEST_STATE_BUSY == $httptest_data['curstate'] ) - { - if($httptest_data['curstep'] == ($httpstep_data['no'])) - { + if( HTTPTEST_STATE_BUSY == $httptest_data['curstate'] ){ + if($httptest_data['curstep'] == ($httpstep_data['no'])){ $status['msg'] = S_IN_PROGRESS; $status['style'] = 'unknown'; $status['skip'] = true; } - elseif($httptest_data['curstep'] < ($httpstep_data['no'])) - { + else if($httptest_data['curstep'] < ($httpstep_data['no'])){ $status['msg'] = S_UNKNOWN; $status['style'] = 'unknown'; $status['skip'] = true; } } - else if( HTTPTEST_STATE_IDLE == $httptest_data['curstate'] ) - { - if($httptest_data['lastfailedstep'] != 0) - { - if($httptest_data['lastfailedstep'] == ($httpstep_data['no'])) - { + else if( HTTPTEST_STATE_IDLE == $httptest_data['curstate'] ){ + if($httptest_data['lastfailedstep'] != 0){ + if($httptest_data['lastfailedstep'] == ($httpstep_data['no'])){ $status['msg'] = S_FAIL.' - '.S_ERROR.': '.$httptest_data['error']; $status['style'] = 'disabled'; //$status['skip'] = true; } - else if($httptest_data['lastfailedstep'] < ($httpstep_data['no'])) - { + else if($httptest_data['lastfailedstep'] < ($httpstep_data['no'])){ $status['msg'] = S_UNKNOWN; $status['style'] = 'unknown'; $status['skip'] = true; @@ -155,8 +147,7 @@ include_once "include/page_header.php"; } } - else - { + else{ $status['msg'] = S_UNKNOWN; $status['style'] = 'unknown'; $status['skip'] = true; @@ -164,22 +155,22 @@ include_once "include/page_header.php"; $item_color = $color[$color['current'] = $color[$color['current']]['next']]['color']; - $db_items = DBselect('select i.*, hi.type as httpitem_type from items i, httpstepitem hi '. - ' where hi.itemid=i.itemid and hi.httpstepid='.$httpstep_data['httpstepid']); - while($item_data = DBfetch($db_items)) - { + $sql = 'SELECT i.*, hi.type as httpitem_type '. + ' FROM items i, httpstepitem hi '. + ' WHERE hi.itemid=i.itemid '. + ' AND hi.httpstepid='.$httpstep_data['httpstepid']; + $db_items = DBselect($sql); + while($item_data = DBfetch($db_items)){ if(isset($status['skip'])) $item_data['lastvalue'] = null; $httpstep_data['item_data'][$item_data['httpitem_type']] = $item_data; if (!str_in_array($item_data['httpitem_type'], array(HTTPSTEP_ITEM_TYPE_IN, HTTPSTEP_ITEM_TYPE_TIME))) continue; - if(isset($total_data[$item_data['httpitem_type']])) - { + if(isset($total_data[$item_data['httpitem_type']])){ $total_data[$item_data['httpitem_type']]['lastvalue'] += $item_data['lastvalue']; } - else - { + else{ $total_data[$item_data['httpitem_type']] = $item_data; } $items[$item_data['httpitem_type']][] = array( @@ -200,22 +191,19 @@ include_once "include/page_header.php"; $status['msg'] = S_OK_BIG; $status['style'] = 'enabled'; - if( HTTPTEST_STATE_BUSY == $httptest_data['curstate'] ) - { + if( HTTPTEST_STATE_BUSY == $httptest_data['curstate'] ){ $status['msg'] = S_IN_PROGRESS; $status['style'] = 'unknown'; } - else if ( HTTPTEST_STATE_UNKNOWN == $httptest_data['curstate'] ) - { + else if ( HTTPTEST_STATE_UNKNOWN == $httptest_data['curstate'] ){ $status['msg'] = S_UNKNOWN; $status['style'] = 'unknown'; } - else if($httptest_data['lastfailedstep'] > 0) - { + else if($httptest_data['lastfailedstep'] > 0){ $status['msg'] = S_FAIL.' - '.S_ERROR.': '.$httptest_data['error']; $status['style'] = 'disabled'; } - + $table->AddRow(array( new CCol(S_TOTAL_BIG, 'bold'), new CCol(SPACE, 'bold'), |
