You are here

function uc_ip2country_cron in IP-based Determination of a Visitor's Country 5

Implementation of hook_cron().

Updates the IP to Country database automatically on a periodic basis. Default period is 1 week.

File

./uc_ip2country.module, line 70
Determination of user's Country based on IP

Code

function uc_ip2country_cron() {
  if (variable_get('ip2country_last_update', 0) <= time() - variable_get('ip2country_update_interval', 604800)) {
    ip2country_update_database(variable_get('ip2country_rir', 'arin'));
    variable_set('ip2country_last_update', time());
    if (variable_get('ip2country_watchdog', 1)) {
      watchdog('ip2country', t('Database updated from @registry server.', array(
        '@registry' => drupal_strtoupper(variable_get('ip2country_rir', 'arin')),
      )), WATCHDOG_NOTICE);
    }
  }
}