public function downloadFreeGeoIPDB()
    {
        $this->dieIfGeolocationAdminIsDisabled();
        Piwik::checkUserHasSuperUserAccess();

        if ($this->isGeoIp2Enabled()) {
            return $this->downloadFreeGeoIP2DB();
        }

        if ($_SERVER["REQUEST_METHOD"] == "POST") {
            $this->checkTokenInUrl();
            Json::sendHeaderJSON();
            $outputPath = GeoIp::getPathForGeoIpDatabase('GeoIPCity.dat') . '.gz';
            try {
                $result = Http::downloadChunk(
                    $url = GeoIp::GEO_LITE_URL,
                    $outputPath,
                    $continue = Common::getRequestVar('continue', true, 'int')
                );

                // if the file is done
                if ($result['current_size'] >= $result['expected_file_size']) {
                    GeoIPAutoUpdater::unzipDownloadedFile($outputPath, $unlink = true);

                    // setup the auto updater
                    GeoIPAutoUpdater::setUpdaterOptions(array(
                                                             'loc' => GeoIp::GEO_LITE_URL,
                                                             'period' => GeoIPAutoUpdater::SCHEDULE_PERIOD_MONTHLY,
                                                        ));

                    // make sure to echo out the geoip updater management screen
                    $result['settings'] = GeoIPAutoUpdater::getConfiguredUrls();
                }

                return json_encode($result);
            } catch (Exception $ex) {
                return json_encode(array('error' => $ex->getMessage()));
            }
        }
    }