Import/Core_geoip.php
[Pman.Core] / Import / Core_geoip.php
index 97cf8f7..2ab6c20 100644 (file)
@@ -37,7 +37,7 @@ class Pman_Core_Import_Core_geoip extends Pman_Roo
             $this->jerr('GeoLite2-City-Locations.csv OR GeoLite2-City-Blocks.csv does not exists?!');
         }
         
-//        $this->insertLocation($location);
+        $this->insertLocation($location);
         
         $this->insertBlock($block);
     }
@@ -249,10 +249,16 @@ class Pman_Core_Import_Core_geoip extends Pman_Roo
     
     function processBlock($row)
     {
+        if(empty($this->id_mapping[$row['GEONAME_ID']])){
+            $this->log("Missing mapping for {$row['GEONAME_ID']}");
+            $this->log("IP : {$row['NETWORK_START_IP']}");
+            return;
+        }
+        
         $network_mapping = DB_DataObject::factory('core_geoip_network_mapping');
         
         $start_ip = array_pop(explode(":", $row['NETWORK_START_IP']));
-        print_r($start_ip);exit;
+        
         $network_mapping->setFrom(array(
             'start_ip' => $start_ip,
             'mask_length' => pow(2, (128 - $row['NETWORK_MASK_LENGTH'])),