public function init() { switch ($this->mode) { case 'MEMORY_CACHE': self::$flags = GeoIP::MEMORY_CACHE; break; default: self::$flags = GeoIP::STANDARD; break; } self::$geoip = GeoIP::getInstance($this->filename, self::$flags); // Run parent parent::init(); }
public function init() { $this->filename = Yii::getPathOfAlias('app.geoip.dats') . DS . $this->filedat . '.dat'; $this->mode = YII_DEBUG === true ? 'STANDARD' : 'MEMORY_CACHE'; switch ($this->mode) { case 'MEMORY_CACHE': self::$flags = GeoIP::MEMORY_CACHE; break; default: self::$flags = GeoIP::STANDARD; break; } self::$geoip = GeoIP::getInstance($this->filename, self::$flags); // Run parent parent::init(); }