You are here

public function Ip2CountryManagerInterface::updateDatabase in IP-based Determination of a Visitor's Country 8

Updates the database.

Truncates ip2country table then reloads from ftp servers. These steps are performed within a transaction to ensure that no data is lost if the update fails.

Parameters

string $registry: Regional Internet Registry from which to get the data. Allowed values are afrinic, apnic, arin (default), lacnic, or ripe.

bool $md5_checksum: Whether to compare the MD5 checksum downloaded from the RIR with the MD5 checksum calculated locally to ensure the data has not been corrupted. Default is FALSE because RIRs don't always provide a checksum.

int $batch_size: The number of rows to write to the database at one time. Increasing this value will consume more memory but will take less time and make fewer database queries. Default is 200.

Return value

int|false FALSE if database update failed. Otherwise, returns the number of rows in the updated database.

1 method overrides Ip2CountryManagerInterface::updateDatabase()
Ip2CountryManager::updateDatabase in src/Ip2CountryManager.php
Updates the database.

File

src/Ip2CountryManagerInterface.php, line 33

Class

Ip2CountryManagerInterface
Interface for Ip2CountryManager.

Namespace

Drupal\ip2country

Code

public function updateDatabase($registry = 'arin', $md5_checksum = FALSE, $batch_size = 200);