@@ -74,8 +74,7 @@ discard block |
||
| 74 | 74 | } |
| 75 | 75 | $this->getLogging()->log('Trap updated : '.$this->oidDesc['name'] . ' / OID : '.$this->oidDesc['oid'],DEBUG ); |
| 76 | 76 | return 1; |
| 77 | - } |
|
| 78 | - else |
|
| 77 | + } else |
|
| 79 | 78 | { |
| 80 | 79 | $this->getLogging()->log('Trap unchanged : '.$this->oidDesc['name'] . ' / OID : '.$this->oidDesc['oid'],DEBUG ); |
| 81 | 80 | return 0; |
@@ -97,7 +96,9 @@ discard block |
||
| 97 | 96 | 'values (:oid, :name , :type ,:mib ,:tc , :display_hint'. |
| 98 | 97 | ', :syntax, :type_enum, :description )'; |
| 99 | 98 | |
| 100 | - if ($this->getTrapsDB()->trapDBType == 'pgsql') $sql .= 'RETURNING id'; |
|
| 99 | + if ($this->getTrapsDB()->trapDBType == 'pgsql') { |
|
| 100 | + $sql .= 'RETURNING id'; |
|
| 101 | + } |
|
| 101 | 102 | |
| 102 | 103 | $sqlQuery=$db_conn->prepare($sql); |
| 103 | 104 | |
@@ -139,7 +140,9 @@ discard block |
||
| 139 | 140 | } |
| 140 | 141 | |
| 141 | 142 | $inserted_id=$ret_code->fetch(PDO::FETCH_ASSOC)['LAST_INSERT_ID()']; |
| 142 | - if ($inserted_id==false) throw new Exception("Weird SQL error : last_insert_id returned false : open issue"); |
|
| 143 | + if ($inserted_id==false) { |
|
| 144 | + throw new Exception("Weird SQL error : last_insert_id returned false : open issue"); |
|
| 145 | + } |
|
| 143 | 146 | $this->dbOidIndex[$this->oidDesc['oid']]['id']=$inserted_id; |
| 144 | 147 | break; |
| 145 | 148 | default: |
@@ -188,7 +188,10 @@ discard block |
||
| 188 | 188 | $this->reset_oidDesc(); |
| 189 | 189 | |
| 190 | 190 | $snmptrans=$this->get_object_details($object, $trapmib); // Get object mib & details |
| 191 | - if ($snmptrans === null) continue; // object not found |
|
| 191 | + if ($snmptrans === null) { |
|
| 192 | + continue; |
|
| 193 | + } |
|
| 194 | + // object not found |
|
| 192 | 195 | |
| 193 | 196 | $this->parse_object($snmptrans); |
| 194 | 197 | |
@@ -339,12 +342,14 @@ discard block |
||
| 339 | 342 | $this->oidDesc['name']=$match[1]; // Name |
| 340 | 343 | $this->oidDesc['type']=$match[2]; // type (21=trap, 0: may be trap, else : not trap |
| 341 | 344 | |
| 342 | - if ($this->oidDesc['type']==0) // object type=0 : check if v1 trap |
|
| 345 | + if ($this->oidDesc['type']==0) { |
|
| 346 | + // object type=0 : check if v1 trap |
|
| 343 | 347 | { |
| 344 | 348 | // Check if next is suboid -> in that case is cannot be a trap |
| 345 | 349 | if (preg_match("/^".$this->oidDesc['oid']."/",$this->objectsAll[$curElement+1])) |
| 346 | 350 | { |
| 347 | 351 | $this->timing['type0_check_time'] += microtime(true) - $this->timing['base_time']; |
| 352 | + } |
|
| 348 | 353 | $this->timing['type0_check_num']++; |
| 349 | 354 | return true; |
| 350 | 355 | } |
@@ -362,9 +367,11 @@ discard block |
||
| 362 | 367 | // Force as trap. |
| 363 | 368 | $this->oidDesc['type']=21; |
| 364 | 369 | } |
| 365 | - if ($onlyTraps===true && $this->oidDesc['type']!=21) // if only traps and not a trap, continue |
|
| 370 | + if ($onlyTraps===true && $this->oidDesc['type']!=21) { |
|
| 371 | + // if only traps and not a trap, continue |
|
| 366 | 372 | { |
| 367 | 373 | $this->timing['nottrap_time'] += microtime(true) - $this->timing['base_time']; |
| 374 | + } |
|
| 368 | 375 | $this->timing['nottrap_num']++; |
| 369 | 376 | return true; |
| 370 | 377 | } |
@@ -395,7 +402,9 @@ discard block |
||
| 395 | 402 | $this->oidDesc['mib']=$match[1]; |
| 396 | 403 | |
| 397 | 404 | $numLine=1; |
| 398 | - while (isset($snmptrans[$numLine]) && !preg_match('/^[\t ]+DESCRIPTION[\t ]+"(.*)/',$snmptrans[$numLine],$match)) $numLine++; |
|
| 405 | + while (isset($snmptrans[$numLine]) && !preg_match('/^[\t ]+DESCRIPTION[\t ]+"(.*)/',$snmptrans[$numLine],$match)) { |
|
| 406 | + $numLine++; |
|
| 407 | + } |
|
| 399 | 408 | if (isset($snmptrans[$numLine])) |
| 400 | 409 | { |
| 401 | 410 | $snmptrans[$numLine] = preg_replace('/^[\t ]+DESCRIPTION[\t ]+"/','',$snmptrans[$numLine]); |
@@ -499,7 +508,10 @@ discard block |
||
| 499 | 508 | $this->timing['num_traps']++; |
| 500 | 509 | |
| 501 | 510 | $this->logging->log('Found trap : '.$this->oidDesc['name'] . ' / OID : '.$this->oidDesc['oid'],INFO ); |
| 502 | - if ($display_progress) echo '#'; // echo a # when trap found |
|
| 511 | + if ($display_progress) { |
|
| 512 | + echo '#'; |
|
| 513 | + } |
|
| 514 | + // echo a # when trap found |
|
| 503 | 515 | |
| 504 | 516 | // get trap objects & source MIB |
| 505 | 517 | |
@@ -516,7 +528,9 @@ discard block |
||
| 516 | 528 | if (($update==0) && ($check_change===false)) |
| 517 | 529 | { // Trapd didn't change & force check disabled |
| 518 | 530 | $this->timing['objects_time'] += microtime(true) - $this->timing['base_time']; |
| 519 | - if ($display_progress) echo "C"; |
|
| 531 | + if ($display_progress) { |
|
| 532 | + echo "C"; |
|
| 533 | + } |
|
| 520 | 534 | continue; |
| 521 | 535 | } |
| 522 | 536 | |