You are here

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

Same name and namespace in other branches
  1. 6 ip2country.admin.inc \_ip2country_update()
  2. 7 ip2country.admin.inc \_ip2country_update()

AJAX callback to update the IP to Country database.

Parameters

$rir: String with name of IP registry. One of afrinic, arin, lacnic, ripe

Return value

JSON object for display by jQuery script

1 string reference to '_ip2country_update'
uc_ip2country_menu in ./uc_ip2country.module
Implementation of hook_menu().

File

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

Code

function _ip2country_update($rir) {
  ip2country_update_database($rir);
  if (variable_get('ip2country_watchdog', 1)) {
    watchdog('ip2country', t('Database updated from @registry server.', array(
      '@registry' => drupal_strtoupper($rir),
    )), WATCHDOG_NOTICE);
  }
  print drupal_to_js(array(
    'count' => t('@rows rows affected.', array(
      '@rows' => uc_ip2country_get_count(),
    )),
    'server' => $rir,
    'message' => t('The IP to Country database has been updated from @server.', array(
      '@server' => drupal_strtoupper($rir),
    )),
  ));
  exit;
}