@@ -84,8 +84,7 @@ discard block |
||
| 84 | 84 | } |
| 85 | 85 | $this->logging->log('Trap updated : '.$this->oidDesc['name'] . ' / OID : '.$this->oidDesc['oid'],DEBUG ); |
| 86 | 86 | return 1; |
| 87 | - } |
|
| 88 | - else |
|
| 87 | + } else |
|
| 89 | 88 | { |
| 90 | 89 | $this->logging->log('Trap unchanged : '.$this->oidDesc['name'] . ' / OID : '.$this->oidDesc['oid'],DEBUG ); |
| 91 | 90 | return 0; |
@@ -107,7 +106,9 @@ discard block |
||
| 107 | 106 | 'values (:oid, :name , :type ,:mib ,:tc , :display_hint'. |
| 108 | 107 | ', :syntax, :type_enum, :description )'; |
| 109 | 108 | |
| 110 | - if ($this->trapsDB->trapDBType == 'pgsql') $sql .= 'RETURNING id'; |
|
| 109 | + if ($this->trapsDB->trapDBType == 'pgsql') { |
|
| 110 | + $sql .= 'RETURNING id'; |
|
| 111 | + } |
|
| 111 | 112 | |
| 112 | 113 | $sqlQuery=$db_conn->prepare($sql); |
| 113 | 114 | |
@@ -147,7 +148,9 @@ discard block |
||
| 147 | 148 | } |
| 148 | 149 | |
| 149 | 150 | $inserted_id=$ret_code->fetch(PDO::FETCH_ASSOC)['LAST_INSERT_ID()']; |
| 150 | - if ($inserted_id==false) throw new Exception("Weird SQL error : last_insert_id returned false : open issue"); |
|
| 151 | + if ($inserted_id==false) { |
|
| 152 | + throw new Exception("Weird SQL error : last_insert_id returned false : open issue"); |
|
| 153 | + } |
|
| 151 | 154 | $this->dbOidIndex[$this->oidDesc['oid']]['id']=$inserted_id; |
| 152 | 155 | break; |
| 153 | 156 | default: |
@@ -325,7 +328,10 @@ discard block |
||
| 325 | 328 | $this->reset_oidDesc(); |
| 326 | 329 | |
| 327 | 330 | $snmptrans=$this->get_object_details($object, $trapmib); // Get object mib & details |
| 328 | - if ($snmptrans === null) continue; // object not found |
|
| 331 | + if ($snmptrans === null) { |
|
| 332 | + continue; |
|
| 333 | + } |
|
| 334 | + // object not found |
|
| 329 | 335 | |
| 330 | 336 | $this->parse_object($snmptrans); |
| 331 | 337 | |
@@ -476,12 +482,14 @@ discard block |
||
| 476 | 482 | $this->oidDesc['name']=$match[1]; // Name |
| 477 | 483 | $this->oidDesc['type']=$match[2]; // type (21=trap, 0: may be trap, else : not trap |
| 478 | 484 | |
| 479 | - if ($this->oidDesc['type']==0) // object type=0 : check if v1 trap |
|
| 485 | + if ($this->oidDesc['type']==0) { |
|
| 486 | + // object type=0 : check if v1 trap |
|
| 480 | 487 | { |
| 481 | 488 | // Check if next is suboid -> in that case is cannot be a trap |
| 482 | 489 | if (preg_match("/^".$this->oidDesc['oid']."/",$this->objectsAll[$curElement+1])) |
| 483 | 490 | { |
| 484 | 491 | $this->timing['type0_check_time'] += microtime(true) - $this->timing['base_time']; |
| 492 | + } |
|
| 485 | 493 | $this->timing['type0_check_num']++; |
| 486 | 494 | return true; |
| 487 | 495 | } |
@@ -499,9 +507,11 @@ discard block |
||
| 499 | 507 | // Force as trap. |
| 500 | 508 | $this->oidDesc['type']=21; |
| 501 | 509 | } |
| 502 | - if ($onlyTraps===true && $this->oidDesc['type']!=21) // if only traps and not a trap, continue |
|
| 510 | + if ($onlyTraps===true && $this->oidDesc['type']!=21) { |
|
| 511 | + // if only traps and not a trap, continue |
|
| 503 | 512 | { |
| 504 | 513 | $this->timing['nottrap_time'] += microtime(true) - $this->timing['base_time']; |
| 514 | + } |
|
| 505 | 515 | $this->timing['nottrap_num']++; |
| 506 | 516 | return true; |
| 507 | 517 | } |
@@ -532,7 +542,9 @@ discard block |
||
| 532 | 542 | $this->oidDesc['mib']=$match[1]; |
| 533 | 543 | |
| 534 | 544 | $numLine=1; |
| 535 | - while (isset($snmptrans[$numLine]) && !preg_match('/^[\t ]+DESCRIPTION[\t ]+"(.*)/',$snmptrans[$numLine],$match)) $numLine++; |
|
| 545 | + while (isset($snmptrans[$numLine]) && !preg_match('/^[\t ]+DESCRIPTION[\t ]+"(.*)/',$snmptrans[$numLine],$match)) { |
|
| 546 | + $numLine++; |
|
| 547 | + } |
|
| 536 | 548 | if (isset($snmptrans[$numLine])) |
| 537 | 549 | { |
| 538 | 550 | $snmptrans[$numLine] = preg_replace('/^[\t ]+DESCRIPTION[\t ]+"/','',$snmptrans[$numLine]); |
@@ -636,7 +648,10 @@ discard block |
||
| 636 | 648 | $this->timing['num_traps']++; |
| 637 | 649 | |
| 638 | 650 | $this->logging->log('Found trap : '.$this->oidDesc['name'] . ' / OID : '.$this->oidDesc['oid'],INFO ); |
| 639 | - if ($display_progress) echo '#'; // echo a # when trap found |
|
| 651 | + if ($display_progress) { |
|
| 652 | + echo '#'; |
|
| 653 | + } |
|
| 654 | + // echo a # when trap found |
|
| 640 | 655 | |
| 641 | 656 | // get trap objects & source MIB |
| 642 | 657 | |
@@ -653,7 +668,9 @@ discard block |
||
| 653 | 668 | if (($update==0) && ($check_change===false)) |
| 654 | 669 | { // Trapd didn't change & force check disabled |
| 655 | 670 | $this->timing['objects_time'] += microtime(true) - $this->timing['base_time']; |
| 656 | - if ($display_progress) echo "C"; |
|
| 671 | + if ($display_progress) { |
|
| 672 | + echo "C"; |
|
| 673 | + } |
|
| 657 | 674 | continue; |
| 658 | 675 | } |
| 659 | 676 | |