Import/Core_geoip.php
[Pman.Core] / Import / Core_geoip.php
index 0a7c0e1..9dac308 100644 (file)
@@ -56,7 +56,7 @@ class Pman_Core_Import_Core_geoip extends Pman_Roo
     {
         ini_set("auto_detect_line_endings", true);
         
-        $linecount = count(file($csv));
+        
         
         $fh = fopen($csv, 'r');
         
@@ -73,7 +73,9 @@ class Pman_Core_Import_Core_geoip extends Pman_Roo
         
         $cols = false;
         
-        $processed = 0
+        $this->processed = 0;
+        $this->total = count(file($csv));
+        $this->echo = '';
         
         while(false !== ($n = fgetcsv($fh,10000, ',', '"'))) {
             if(!array_filter($n)){ // empty row
@@ -106,24 +108,7 @@ class Pman_Core_Import_Core_geoip extends Pman_Roo
             
             $this->processLocation($row);
             
-            echo "\033[K"; // Erase to end of line:
-            
-            $echo = '';
-            
-            if (strlen($echo)) {
-                echo "\033[".strlen($echo)."D";    // Move $length characters backward
-            }
-            
-            $echo = str_pad(ROUND(($this->processed / $this->total),2) * 100, 3, ' ', STR_PAD_LEFT) .
-                " % (" . str_pad(($this->processed), strlen($this->total), ' ', STR_PAD_LEFT) .
-                " / {$this->total}) - out {$this->out_count}";
-
-
-            echo $this->echo;
-
-            if($this->processed == $this->total){
-                echo "\n";
-            }
+            $this->processStatus();
         }
         
     }
@@ -327,7 +312,7 @@ class Pman_Core_Import_Core_geoip extends Pman_Roo
         
     }
     
-    function log($str)
+    function processStatus()
     {
         echo "$str \n";
     }