Import/Core_geoip.php
authorEdward <edward@roojs.com>
Tue, 13 May 2014 08:49:49 +0000 (16:49 +0800)
committerEdward <edward@roojs.com>
Tue, 13 May 2014 08:49:49 +0000 (16:49 +0800)
Import/Core_geoip.php [new file with mode: 0644]

diff --git a/Import/Core_geoip.php b/Import/Core_geoip.php
new file mode 100644 (file)
index 0000000..e32c527
--- /dev/null
@@ -0,0 +1,69 @@
+<?php
+
+require_once 'Pman/Roo.php';
+
+class Pman_Core_Import_Core_geoip extends Pman_Roo
+{
+    static $cli_desc = "Insert the geoip database";
+    
+    static $cli_opts = array();
+    
+    function getAuth()
+    {
+        $ff = HTML_FlexyFramework::get();
+        if (!$ff->cli) {
+            die("access denied");
+        }
+        HTML_FlexyFramework::ensureSingle(__FILE__, $this);
+        return true;
+    }
+    
+    function get()
+    {
+        
+        PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($this, 'onPearError'));
+        
+        $location = '/tmp/GeoLite2-City-Locations.csv';
+        $block = '/tmp/GeoLite2-City-Blocks.csv';
+        
+        
+//        $fc = new File_Convert($cp, 'application/vnd.ms-excel');
+//        //var_Dump($img->getStoreName());
+//        $csv = $fc->convert('text/csv');
+//        unlink($cp);
+//        //var_dump($csv);
+//        $this->importCsv($csv);
+    }
+    
+    function post()
+    {
+//        $this->transObj = DB_DataObject::Factory('custinfo');
+//        
+//        $this->transObj->query('BEGIN');
+//        
+//        PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($this, 'onPearError'));
+//        
+//        $img = DB_DataObject::Factory('images');
+//        $img->setFrom(array(
+//            'onid' => 0,
+//            'ontable' => 'ipshead'
+//        ));
+//        $img->onUpload(false);
+//        
+//        require_once 'File/Convert.php';
+//        $fc = new File_Convert($img->getStoreName(), $img->mimetype );
+//        $csv = $fc->convert('text/csv');
+//        $this->importCsv($csv);
+    }
+    
+    function importCsv($csv)
+    {
+        
+        exit;
+    }
+    
+    function log($str)
+    {
+        echo "$str \n";
+    }
+}