3 require_once 'Pman/Roo.php';
5 class Pman_Core_Import_Core_geoip extends Pman_Roo
7 static $cli_desc = "Insert the geoip database";
9 static $cli_opts = array();
13 $ff = HTML_FlexyFramework::get();
17 HTML_FlexyFramework::ensureSingle(__FILE__, $this);
29 PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($this, 'onPearError'));
31 $location = '/tmp/GeoLite2-City-Locations.csv';
32 $block = '/tmp/GeoLite2-City-Blocks.csv';
34 if(!file_exists($location) || !file_exists($block)){
35 $this->jerr('GeoLite2-City-Locations.csv OR GeoLite2-City-Blocks.csv does not exists?!');
38 static $id_mapping = array();
40 ini_set("auto_detect_line_endings", true);
42 $this->insertLocation($location);
44 $this->insertBlock($block);
47 function insertLocation($csv)
49 $fh = fopen($csv, 'r');