@@ -97,8 +97,7 @@ discard block |
||
| 97 | 97 | } |
| 98 | 98 | $this->logging->log('Trap updated : '.$name . ' / OID : '.$oid,DEBUG ); |
| 99 | 99 | return 1; |
| 100 | - } |
|
| 101 | - else |
|
| 100 | + } else |
|
| 102 | 101 | { |
| 103 | 102 | $this->logging->log('Trap unchanged : '.$name . ' / OID : '.$oid,DEBUG ); |
| 104 | 103 | return 0; |
@@ -114,7 +113,9 @@ discard block |
||
| 114 | 113 | 'values (:oid, :name , :type ,:mib ,:tc , :display_hint'. |
| 115 | 114 | ', :syntax, :type_enum, :description )'; |
| 116 | 115 | |
| 117 | - if ($this->trapsDB->trapDBType == 'pgsql') $sql .= 'RETURNING id'; |
|
| 116 | + if ($this->trapsDB->trapDBType == 'pgsql') { |
|
| 117 | + $sql .= 'RETURNING id'; |
|
| 118 | + } |
|
| 118 | 119 | |
| 119 | 120 | $sqlQuery=$db_conn->prepare($sql); |
| 120 | 121 | |
@@ -154,7 +155,9 @@ discard block |
||
| 154 | 155 | } |
| 155 | 156 | |
| 156 | 157 | $inserted_id=$ret_code->fetch(PDO::FETCH_ASSOC)['LAST_INSERT_ID()']; |
| 157 | - if ($inserted_id==false) throw new Exception("Weird SQL error : last_insert_id returned false : open issue"); |
|
| 158 | + if ($inserted_id==false) { |
|
| 159 | + throw new Exception("Weird SQL error : last_insert_id returned false : open issue"); |
|
| 160 | + } |
|
| 158 | 161 | $this->dbOidIndex[$oid]['id']=$inserted_id; |
| 159 | 162 | break; |
| 160 | 163 | default: |
@@ -396,12 +399,14 @@ discard block |
||
| 396 | 399 | $name=$match[1]; // Name |
| 397 | 400 | $type=$match[2]; // type (21=trap, 0: may be trap, else : not trap |
| 398 | 401 | |
| 399 | - if ($type==0) // object type=0 : check if v1 trap |
|
| 402 | + if ($type==0) { |
|
| 403 | + // object type=0 : check if v1 trap |
|
| 400 | 404 | { |
| 401 | 405 | // Check if next is suboid -> in that case is cannot be a trap |
| 402 | 406 | if (preg_match("/^$oid/",$this->objectsAll[$curElement+1])) |
| 403 | 407 | { |
| 404 | 408 | $this->timing['type0_check_time'] += microtime(true) - $this->timing['base_time']; |
| 409 | + } |
|
| 405 | 410 | $this->timing['type0_check_num']++; |
| 406 | 411 | return true; |
| 407 | 412 | } |
@@ -419,9 +424,11 @@ discard block |
||
| 419 | 424 | // Force as trap. |
| 420 | 425 | $type=21; |
| 421 | 426 | } |
| 422 | - if ($onlyTraps===true && $type!=21) // if only traps and not a trap, continue |
|
| 427 | + if ($onlyTraps===true && $type!=21) { |
|
| 428 | + // if only traps and not a trap, continue |
|
| 423 | 429 | { |
| 424 | 430 | $this->timing['nottrap_time'] += microtime(true) - $this->timing['base_time']; |
| 431 | + } |
|
| 425 | 432 | $this->timing['nottrap_num']++; |
| 426 | 433 | return true; |
| 427 | 434 | } |
@@ -480,7 +487,10 @@ discard block |
||
| 480 | 487 | $this->timing['num_traps']++; |
| 481 | 488 | |
| 482 | 489 | $this->logging->log('Found trap : '.$name . ' / OID : '.$oid,INFO ); |
| 483 | - if ($display_progress) echo '#'; // echo a # when trap found |
|
| 490 | + if ($display_progress) { |
|
| 491 | + echo '#'; |
|
| 492 | + } |
|
| 493 | + // echo a # when trap found |
|
| 484 | 494 | |
| 485 | 495 | // get trap objects & source MIB |
| 486 | 496 | $retVal=0; |
@@ -499,7 +509,9 @@ discard block |
||
| 499 | 509 | $trapMib=$match[1]; |
| 500 | 510 | |
| 501 | 511 | $numLine=1;$trapDesc=''; |
| 502 | - while (isset($snmptrans[$numLine]) && !preg_match('/^[\t ]+DESCRIPTION[\t ]+"(.*)/',$snmptrans[$numLine],$match)) $numLine++; |
|
| 512 | + while (isset($snmptrans[$numLine]) && !preg_match('/^[\t ]+DESCRIPTION[\t ]+"(.*)/',$snmptrans[$numLine],$match)) { |
|
| 513 | + $numLine++; |
|
| 514 | + } |
|
| 503 | 515 | if (isset($snmptrans[$numLine])) |
| 504 | 516 | { |
| 505 | 517 | $snmptrans[$numLine] = preg_replace('/^[\t ]+DESCRIPTION[\t ]+"/','',$snmptrans[$numLine]); |
@@ -524,7 +536,9 @@ discard block |
||
| 524 | 536 | if (($update==0) && ($check_change===false)) |
| 525 | 537 | { // Trapd didn't change & force check disabled |
| 526 | 538 | $this->timing['objects_time'] += microtime(true) - $this->timing['base_time']; |
| 527 | - if ($display_progress) echo "C"; |
|
| 539 | + if ($display_progress) { |
|
| 540 | + echo "C"; |
|
| 541 | + } |
|
| 528 | 542 | continue; |
| 529 | 543 | } |
| 530 | 544 | |