@@ -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: |
@@ -409,12 +412,14 @@ discard block |
||
409 | 412 | $this->oidDesc['name']=$match[1]; // Name |
410 | 413 | $this->oidDesc['type']=$match[2]; // type (21=trap, 0: may be trap, else : not trap |
411 | 414 | |
412 | - if ($this->oidDesc['type']==0) // object type=0 : check if v1 trap |
|
415 | + if ($this->oidDesc['type']==0) { |
|
416 | + // object type=0 : check if v1 trap |
|
413 | 417 | { |
414 | 418 | // Check if next is suboid -> in that case is cannot be a trap |
415 | 419 | if (preg_match("/^".$this->oidDesc['oid']."/",$this->objectsAll[$curElement+1])) |
416 | 420 | { |
417 | 421 | $this->timing['type0_check_time'] += microtime(true) - $this->timing['base_time']; |
422 | + } |
|
418 | 423 | $this->timing['type0_check_num']++; |
419 | 424 | return true; |
420 | 425 | } |
@@ -432,9 +437,11 @@ discard block |
||
432 | 437 | // Force as trap. |
433 | 438 | $this->oidDesc['type']=21; |
434 | 439 | } |
435 | - if ($onlyTraps===true && $this->oidDesc['type']!=21) // if only traps and not a trap, continue |
|
440 | + if ($onlyTraps===true && $this->oidDesc['type']!=21) { |
|
441 | + // if only traps and not a trap, continue |
|
436 | 442 | { |
437 | 443 | $this->timing['nottrap_time'] += microtime(true) - $this->timing['base_time']; |
444 | + } |
|
438 | 445 | $this->timing['nottrap_num']++; |
439 | 446 | return true; |
440 | 447 | } |
@@ -494,7 +501,10 @@ discard block |
||
494 | 501 | $this->timing['num_traps']++; |
495 | 502 | |
496 | 503 | $this->logging->log('Found trap : '.$this->oidDesc['name'] . ' / OID : '.$this->oidDesc['oid'],INFO ); |
497 | - if ($display_progress) echo '#'; // echo a # when trap found |
|
504 | + if ($display_progress) { |
|
505 | + echo '#'; |
|
506 | + } |
|
507 | + // echo a # when trap found |
|
498 | 508 | |
499 | 509 | //################################ |
500 | 510 | // get trap objects & source MIB |
@@ -514,7 +524,9 @@ discard block |
||
514 | 524 | $this->oidDesc['mib']=$match[1]; |
515 | 525 | |
516 | 526 | $numLine=1; |
517 | - while (isset($snmptrans[$numLine]) && !preg_match('/^[\t ]+DESCRIPTION[\t ]+"(.*)/',$snmptrans[$numLine],$match)) $numLine++; |
|
527 | + while (isset($snmptrans[$numLine]) && !preg_match('/^[\t ]+DESCRIPTION[\t ]+"(.*)/',$snmptrans[$numLine],$match)) { |
|
528 | + $numLine++; |
|
529 | + } |
|
518 | 530 | if (isset($snmptrans[$numLine])) |
519 | 531 | { |
520 | 532 | $snmptrans[$numLine] = preg_replace('/^[\t ]+DESCRIPTION[\t ]+"/','',$snmptrans[$numLine]); |
@@ -541,7 +553,9 @@ discard block |
||
541 | 553 | if (($update==0) && ($check_change===false)) |
542 | 554 | { // Trapd didn't change & force check disabled |
543 | 555 | $this->timing['objects_time'] += microtime(true) - $this->timing['base_time']; |
544 | - if ($display_progress) echo "C"; |
|
556 | + if ($display_progress) { |
|
557 | + echo "C"; |
|
558 | + } |
|
545 | 559 | continue; |
546 | 560 | } |
547 | 561 |