@@ -635,7 +635,7 @@ public function mysql_scan_update_host_statuses () {
635
635
* @return void
636
636
*/
637
637
private function update_subnet_status_scantime ($ subnet_id ) {
638
- try { $ this ->Database ->updateObject ("subnets " , array ("id " =>$ id , "lastScan " =>$ this ->nowdate ), "id " ); }
638
+ try { $ this ->Database ->updateObject ("subnets " , array ("id " =>$ subnet_id , "lastScan " =>$ this ->nowdate ), "id " ); }
639
639
catch (Exception $ e ) {}
640
640
}
641
641
@@ -762,7 +762,7 @@ private function mysql_check_slaves ($subnetId) {
762
762
// int check
763
763
if (!is_numeric ($ subnetId )) { return false ; }
764
764
// check
765
- try { $ count = $ this ->Database ->numObjectsFilter ("subnets " , "masterSubnetId " , $ subnetid ); }
765
+ try { $ count = $ this ->Database ->numObjectsFilter ("subnets " , "masterSubnetId " , $ subnetId ); }
766
766
catch (Exception $ e ) {
767
767
$ this ->Result ->show ("danger " , _ ("Error: " ).$ e ->getMessage ());
768
768
return false ;
@@ -980,42 +980,12 @@ private function mysql_scan_discover_hosts_fping_nonthreaded ($subnets, $address
980
980
* @access private
981
981
* @param mixed $subnets
982
982
* @param mixed $addresses
983
- * @return void
983
+ * @return $subnets
984
984
*/
985
985
private function mysql_scan_discover_hosts_ping_nonthreaded ($ subnets , $ addresses ) {
986
- $ z = 0 ; //addresses array index
987
-
988
- /*
989
- //run per MAX_THREADS
990
- for ($m=0; $m<=sizeof($addresses); $m += $this->config->threads) {
991
- // create threads
992
- $threads = array();
993
-
994
- //fork processes
995
- for ($i = 0; $i <= $this->config->threads && $i <= sizeof($addresses); $i++) {
996
- //only if index exists!
997
- if(isset($addresses[$z])) {
998
- //start new thread
999
- $threads[$z] = new Thread( 'ping_address' );
1000
- $threads[$z]->start( $this->transform_to_dotted( $addresses[$z]['ip_addr']) );
1001
- $z++; //next index
1002
- }
1003
- }
1004
986
1005
- // wait for all the threads to finish
1006
- while( !empty( $threads ) ) {
1007
- foreach( $threads as $index => $thread ) {
1008
- if( ! $thread->isAlive() ) {
1009
- //unset dead hosts
1010
- if($thread->getExitCode() != 0) {
1011
- unset($addresses[$index]);
1012
- }
1013
- //remove thread
1014
- unset( $threads[$index]);
1015
- }
1016
- }
1017
- usleep(200000);
1018
- }
987
+ for ($ i = 0 ; $ i <= sizeof ($ addresses ); $ i ++) {
988
+ ping_address ( $ this ->transform_to_dotted ( $ addresses [$ z ]['ip_addr ' ]) );
1019
989
}
1020
990
1021
991
//ok, we have all available addresses, rekey them
@@ -1030,7 +1000,6 @@ private function mysql_scan_discover_hosts_ping_nonthreaded ($subnets, $addresse
1030
1000
}
1031
1001
}
1032
1002
}
1033
- */
1034
1003
1035
1004
// return result
1036
1005
return $ subnets ;
@@ -1048,7 +1017,7 @@ private function mysql_scan_discovered_write_to_db ($subnets) {
1048
1017
$ discovered = 0 ; //for mailing
1049
1018
1050
1019
# reset db connection for ping / pear
1051
- if ($ this ->can_type !=="fping " ) {
1020
+ if ($ this ->scan_type !=="fping " ) {
1052
1021
unset($ this ->Database );
1053
1022
$ this ->Database = new Database_PDO ();
1054
1023
}
0 commit comments