PHP Class Piwik\Plugins\UserCountry\Controller

Inheritance: extends Piwik\Plugin\ControllerAdmin
显示文件 Open project: piwik/piwik

Public Methods

Method Description
adminIndex ( )
downloadFreeGeoIPDB ( ) Starts or continues download of GeoLiteCity.dat.
downloadMissingGeoIpDb ( ) Starts or continues a download for a missing GeoIP database. A database is missing if it has an update URL configured, but the actual database is not available in the misc directory.
getDistinctCountries ( )
getLastDistinctCountriesGraph ( )
getLocationUsingProvider ( ) Echo's a pretty formatted location using a specific LocationProvider.
getNumberOfDistinctCountries ( )
updateGeoIPLinks ( ) Sets the URLs used to download new versions of the installed GeoIP databases.

Private Methods

Method Description
dieIfGeolocationAdminIsDisabled ( )
getGeoIpUpdaterManageScreen ( ) : string Renders and returns the HTML that manages the GeoIP auto-updater.
getNextMissingDbUrlInfo ( ) : boolean Gets information for the first missing GeoIP database (if any).
getPeriodUpdateOptions ( )
setUpdaterManageVars ( View $view ) Sets some variables needed by the _updaterManage.twig template.

Method Details

adminIndex() public method

public adminIndex ( )

downloadFreeGeoIPDB() public method

To avoid a server/PHP timeout & to show progress of the download to the user, we use the HTTP Range header to download one chunk of the file at a time. After each chunk, it is the browser's responsibility to call the method again to continue the download. Input: 'continue' query param - if set to 1, will assume we are currently downloading & use Range: HTTP header to get another chunk of the file. Output (in JSON): 'current_size' - Current size of the partially downloaded file on disk. 'expected_file_size' - The expected finished file size as returned by the HTTP server. 'next_screen' - When the download finishes, this is the next screen that should be shown. 'error' - When an error occurs, the message is returned in this property.
public downloadFreeGeoIPDB ( )

downloadMissingGeoIpDb() public method

Input: 'url' - The URL to download the database from. 'continue' - 1 if we're continuing a download, 0 if we're starting one. Output: 'error' - If an error occurs this describes the error. 'to_download' - The URL of a missing database that should be downloaded next (if any). 'to_download_label' - The label to use w/ the progress bar that describes what we're downloading. 'current_size' - Size of the current file on disk. 'expected_file_size' - Size of the completely downloaded file.

getDistinctCountries() public method

getLastDistinctCountriesGraph() public method

getLocationUsingProvider() public method

Input: The 'id' query parameter must be set to the ID of the LocationProvider to use. Output: The pretty formatted location that was obtained. Will be HTML.

getNumberOfDistinctCountries() public method