Import/Core_geoip.php
[Pman.Core] / Import / Core_geoip.php
index 3e35105..9dac308 100644 (file)
@@ -25,6 +25,10 @@ class Pman_Core_Import_Core_geoip extends Pman_Roo
         $this->get();
     }
     
+    var $processed = 0;
+    var $total = 0;
+    var $echo = '';
+    
     function get()
     {
         
@@ -52,16 +56,14 @@ class Pman_Core_Import_Core_geoip extends Pman_Roo
     {
         ini_set("auto_detect_line_endings", true);
         
+        
+        
         $fh = fopen($csv, 'r');
         
         if (!$fh) {
             $this->jerr("invalid location file");
         }
         
-        $linecount = count(file($csv));
-        
-        print_r($linecount);exit;
-        
         $req = array(
             'GEONAME_ID', 'CONTINENT_CODE', 'CONTINENT_NAME',
             'COUNTRY_ISO_CODE', 'COUNTRY_NAME', 'SUBDIVISION_ISO_CODE',
@@ -71,6 +73,10 @@ class Pman_Core_Import_Core_geoip extends Pman_Roo
         
         $cols = false;
         
+        $this->processed = 0;
+        $this->total = count(file($csv));
+        $this->echo = '';
+        
         while(false !== ($n = fgetcsv($fh,10000, ',', '"'))) {
             if(!array_filter($n)){ // empty row
                 continue;
@@ -101,6 +107,8 @@ class Pman_Core_Import_Core_geoip extends Pman_Roo
             }
             
             $this->processLocation($row);
+            
+            $this->processStatus();
         }
         
     }
@@ -304,7 +312,7 @@ class Pman_Core_Import_Core_geoip extends Pman_Roo
         
     }
     
-    function log($str)
+    function processStatus()
     {
         echo "$str \n";
     }