function ip2country_install in IP-based Determination of a Visitor's Country 8
Same name and namespace in other branches
- 6 ip2country.install \ip2country_install()
- 7 ip2country.install \ip2country_install()
Implements hook_install().
Populates database tables needed by this module.
By default, this module WILL populate the database. But because it is so time-consuming, an option is available to not populate the database automatically on install, intended for use by SimpleTest.
File
- ./
ip2country.install, line 72 - Install, update, and uninstall functions for the ip2country module.
Code
function ip2country_install() {
//
// Set the variable to FALSE before installing this module to
// leave the database table empty on install.
//
$populate = \Drupal::state()
->get('ip2country_populate_database_on_install');
if (!isset($populate) || $populate) {
$ip2country_config = \Drupal::config('ip2country.settings');
$registry = $ip2country_config
->get('rir');
$md5_checksum = $ip2country_config
->get('md5_checksum');
$batch_size = $ip2country_config
->get('batch_size');
\Drupal::service('ip2country.manager')
->updateDatabase($registry, $md5_checksum, $batch_size);
}
}