@@ -86,8 +86,7 @@ discard block |
||
| 86 | 86 | } |
| 87 | 87 | $this->logging->log('Trap updated : '.$this->oidDesc['name'] . ' / OID : '.$this->oidDesc['oid'],DEBUG ); |
| 88 | 88 | return 1; |
| 89 | - } |
|
| 90 | - else |
|
| 89 | + } else |
|
| 91 | 90 | { |
| 92 | 91 | $this->logging->log('Trap unchanged : '.$this->oidDesc['name'] . ' / OID : '.$this->oidDesc['oid'],DEBUG ); |
| 93 | 92 | return 0; |
@@ -103,7 +102,9 @@ discard block |
||
| 103 | 102 | 'values (:oid, :name , :type ,:mib ,:tc , :display_hint'. |
| 104 | 103 | ', :syntax, :type_enum, :description )'; |
| 105 | 104 | |
| 106 | - if ($this->trapsDB->trapDBType == 'pgsql') $sql .= 'RETURNING id'; |
|
| 105 | + if ($this->trapsDB->trapDBType == 'pgsql') { |
|
| 106 | + $sql .= 'RETURNING id'; |
|
| 107 | + } |
|
| 107 | 108 | |
| 108 | 109 | $sqlQuery=$db_conn->prepare($sql); |
| 109 | 110 | |
@@ -143,7 +144,9 @@ discard block |
||
| 143 | 144 | } |
| 144 | 145 | |
| 145 | 146 | $inserted_id=$ret_code->fetch(PDO::FETCH_ASSOC)['LAST_INSERT_ID()']; |
| 146 | - if ($inserted_id==false) throw new Exception("Weird SQL error : last_insert_id returned false : open issue"); |
|
| 147 | + if ($inserted_id==false) { |
|
| 148 | + throw new Exception("Weird SQL error : last_insert_id returned false : open issue"); |
|
| 149 | + } |
|
| 147 | 150 | $this->dbOidIndex[$this->oidDesc['oid']]['id']=$inserted_id; |
| 148 | 151 | break; |
| 149 | 152 | default: |
@@ -301,7 +304,10 @@ discard block |
||
| 301 | 304 | $this->reset_oidDesc(); |
| 302 | 305 | |
| 303 | 306 | $snmptrans=$this->get_object_details($object, $trapmib); // Get object mib & details |
| 304 | - if ($snmptrans === null) continue; // object not found |
|
| 307 | + if ($snmptrans === null) { |
|
| 308 | + continue; |
|
| 309 | + } |
|
| 310 | + // object not found |
|
| 305 | 311 | |
| 306 | 312 | $this->parse_object($snmptrans); |
| 307 | 313 | |
@@ -452,12 +458,14 @@ discard block |
||
| 452 | 458 | $this->oidDesc['name']=$match[1]; // Name |
| 453 | 459 | $this->oidDesc['type']=$match[2]; // type (21=trap, 0: may be trap, else : not trap |
| 454 | 460 | |
| 455 | - if ($this->oidDesc['type']==0) // object type=0 : check if v1 trap |
|
| 461 | + if ($this->oidDesc['type']==0) { |
|
| 462 | + // object type=0 : check if v1 trap |
|
| 456 | 463 | { |
| 457 | 464 | // Check if next is suboid -> in that case is cannot be a trap |
| 458 | 465 | if (preg_match("/^".$this->oidDesc['oid']."/",$this->objectsAll[$curElement+1])) |
| 459 | 466 | { |
| 460 | 467 | $this->timing['type0_check_time'] += microtime(true) - $this->timing['base_time']; |
| 468 | + } |
|
| 461 | 469 | $this->timing['type0_check_num']++; |
| 462 | 470 | return true; |
| 463 | 471 | } |
@@ -475,9 +483,11 @@ discard block |
||
| 475 | 483 | // Force as trap. |
| 476 | 484 | $this->oidDesc['type']=21; |
| 477 | 485 | } |
| 478 | - if ($onlyTraps===true && $this->oidDesc['type']!=21) // if only traps and not a trap, continue |
|
| 486 | + if ($onlyTraps===true && $this->oidDesc['type']!=21) { |
|
| 487 | + // if only traps and not a trap, continue |
|
| 479 | 488 | { |
| 480 | 489 | $this->timing['nottrap_time'] += microtime(true) - $this->timing['base_time']; |
| 490 | + } |
|
| 481 | 491 | $this->timing['nottrap_num']++; |
| 482 | 492 | return true; |
| 483 | 493 | } |
@@ -503,7 +513,9 @@ discard block |
||
| 503 | 513 | $this->oidDesc['mib']=$match[1]; |
| 504 | 514 | |
| 505 | 515 | $numLine=1; |
| 506 | - while (isset($snmptrans[$numLine]) && !preg_match('/^[\t ]+DESCRIPTION[\t ]+"(.*)/',$snmptrans[$numLine],$match)) $numLine++; |
|
| 516 | + while (isset($snmptrans[$numLine]) && !preg_match('/^[\t ]+DESCRIPTION[\t ]+"(.*)/',$snmptrans[$numLine],$match)) { |
|
| 517 | + $numLine++; |
|
| 518 | + } |
|
| 507 | 519 | if (isset($snmptrans[$numLine])) |
| 508 | 520 | { |
| 509 | 521 | $snmptrans[$numLine] = preg_replace('/^[\t ]+DESCRIPTION[\t ]+"/','',$snmptrans[$numLine]); |
@@ -575,7 +587,10 @@ discard block |
||
| 575 | 587 | $this->timing['num_traps']++; |
| 576 | 588 | |
| 577 | 589 | $this->logging->log('Found trap : '.$this->oidDesc['name'] . ' / OID : '.$this->oidDesc['oid'],INFO ); |
| 578 | - if ($display_progress) echo '#'; // echo a # when trap found |
|
| 590 | + if ($display_progress) { |
|
| 591 | + echo '#'; |
|
| 592 | + } |
|
| 593 | + // echo a # when trap found |
|
| 579 | 594 | |
| 580 | 595 | //################################ |
| 581 | 596 | // get trap objects & source MIB |
@@ -593,7 +608,9 @@ discard block |
||
| 593 | 608 | if (($update==0) && ($check_change===false)) |
| 594 | 609 | { // Trapd didn't change & force check disabled |
| 595 | 610 | $this->timing['objects_time'] += microtime(true) - $this->timing['base_time']; |
| 596 | - if ($display_progress) echo "C"; |
|
| 611 | + if ($display_progress) { |
|
| 612 | + echo "C"; |
|
| 613 | + } |
|
| 597 | 614 | continue; |
| 598 | 615 | } |
| 599 | 616 | |