Пример #1
0
 /**
  * Downloads the geolite database file from maxmind database source location.
  * 
  * GeoLite data created by MaxMind, available from http://www.maxmind.com
  */
 public static function download_geoip_databases()
 {
     $path = JPATH_ROOT . DS . 'media' . DS . 'com_cjlib' . DS . 'geoip' . DS;
     if (file_exists($path . 'GeoLiteCity.dat')) {
         $filemtime = filemtime($path . 'GeoLiteCity.dat');
         if (time() - $filemtime >= 30 * 86400) {
             JFile::delete($path . 'GeoLiteCity.dat');
         } else {
             return false;
         }
     }
     CJFunctions::download_file('http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz', $path, 'GeoLiteCity.dat.gz');
     CJFunctions::uncompress($path . 'GeoLiteCity.dat.gz', $path . 'GeoLiteCity.dat');
     return true;
 }