You are here

function _smart_ip_database_update_submit in Smart IP 6

Same name and namespace in other branches
  1. 6.2 includes/smart_ip.admin.inc \_smart_ip_database_update_submit()
  2. 7.2 includes/smart_ip.admin.inc \_smart_ip_database_update_submit()
  3. 7 includes/smart_ip.admin.inc \_smart_ip_database_update_submit()

Submit handler to update the Smart IP database.

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

File

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

Code

function _smart_ip_database_update_submit($form, &$form_state) {
  global $_smart_ip_db_update_access;

  // Utility functions for loading database from external sources
  module_load_include('inc', 'smart_ip', 'includes/smart_ip.utility');
  if ($_smart_ip_db_update_access) {
    $watchdog_msg = 'The Smart IP database has been updated via cron.';
    $_smart_ip_db_update_access = FALSE;
  }
  else {
    $watchdog_msg = 'The Smart IP database has been manually updated.';
  }
  batch_set(smart_ip_update_db_batch(check_url($form_state['values']['smart_ip_csv_source'])));
  watchdog('smart_ip', $watchdog_msg);
  $form_state['storage']['smart_ip_db_message'] = t('The Smart IP database has been updated. @rows rows affected.', array(
    '@rows' => smart_ip_get_count(),
  ));
  $form_state['rebuild'] = TRUE;
}