Documentation

MaxMindDatabase
in package
Uses UtilsProvider

A common service to download the MaxMind database to the WordPress `uploads` directory.

Table of Contents

Constants

DATABASE_EXTENSION  = '.mmdb'
DATABASE_NAME  = 'GeoLite2-Country'

Properties

$me  : MaxMindDatabase
Singleton instance.

Methods

clear()  : mixed
Delete the database.
download()  : WP_Error|true
Download the database `gzip`ped and extract it.
exists()  : mixed
Check if the database exists.
getInstance()  : mixed
Get singleton instance.
getPath()  : mixed
Get the absolute path where the database is located.
getPluginConstantPrefix()  : string
Get the prefix of this plugin so composer packages can dynamically build other constant values on it.
lookupCountryCode()  : mixed
Lookup country code by IP address. Can return `null` if not found.
__construct()  : mixed
C'tor.

Constants

Properties

Methods

download()

Download the database `gzip`ped and extract it.

public download([array<string|int, mixed> $args = [] ]) : WP_Error|true
Parameters
$args : array<string|int, mixed> = []

Additional query arguments

Return values
WP_Error|true

getInstance()

Get singleton instance.

public static getInstance() : mixed
Tags
codeCoverageIgnore

getPath()

Get the absolute path where the database is located.

public getPath() : mixed

getPluginConstantPrefix()

Get the prefix of this plugin so composer packages can dynamically build other constant values on it.

public getPluginConstantPrefix() : string
Tags
codeCoverageIgnore

It only returns a string with the constant prefix

Return values
string

lookupCountryCode()

Lookup country code by IP address. Can return `null` if not found.

public lookupCountryCode(string $ip) : mixed
Parameters
$ip : string

        
On this page

Search results