You are here

function _smart_ip_bin_database_update_submit in Smart IP 6.2

Same name and namespace in other branches
  1. 7.2 includes/smart_ip.admin.inc \_smart_ip_bin_database_update_submit()

Submit handler to update the Maxmind binary file.

1 string reference to '_smart_ip_bin_database_update_submit'
smart_ip_admin_settings in includes/smart_ip.admin.inc
Smart IP administration settings.

File

includes/smart_ip.admin.inc, line 571
Admin interface callbacks/handlers to configure Smart IP.

Code

function _smart_ip_bin_database_update_submit($form, &$form_state) {
  global $_smart_ip_db_update_access;
  if (!$_smart_ip_db_update_access) {

    // Utility functions for loading database from external sources
    module_load_include('inc', 'smart_ip', 'includes/smart_ip.utility');

    // Force the update even if the database is up-to-date
    if ($form_state['values']['smart_ip_source'] == 'maxmind_bin' && $form_state['values']['smart_ip_maxmind_bin_db_auto_update']) {
      smart_ip_maxmind_bin_db_update($form_state['values']['smart_ip_maxmind_license'], FALSE, TRUE);
      $form_state['storage']['smart_ip_db_message'] = t('The Maxmind binary database has been updated.');
    }
    elseif ($form_state['values']['smart_ip_source'] == 'maxmindgeoip2_bin' && $form_state['values']['smart_ip_maxmind_geoip2_bin_db_auto_update']) {
      smart_ip_maxmind_bin_db_update($form_state['values']['smart_ip_maxmind_geoip2_license'], FALSE, TRUE);
      $form_state['storage']['smart_ip_db_message'] = t('The Maxmind binary database has been updated.');
    }
    $form_state['rebuild'] = TRUE;
  }
}