function smart_ip_run_batch in Smart IP 6
Same name and namespace in other branches
- 6.2 smart_ip.module \smart_ip_run_batch()
- 7.2 smart_ip.module \smart_ip_run_batch()
- 7 smart_ip.module \smart_ip_run_batch()
Menu page callback for Smart IP batch operations.
1 string reference to 'smart_ip_run_batch'
- smart_ip_menu in ./
smart_ip.module - Implements hook_menu().
File
- ./
smart_ip.module, line 130 - Determines country, geo location (longitude/latitude), region, city and postal code of the user, based on IP address
Code
function smart_ip_run_batch() {
if (isset($_POST['smart_ip_cron_key']) && $_POST['smart_ip_cron_key'] == variable_get('cron_key', 'drupal')) {
global $_smart_ip_db_update_access;
$recover = !variable_get('smart_ip_db_update_busy', FALSE) & (variable_get('smart_ip_get_zip_done', FALSE) | variable_get('smart_ip_extract_zip_done', FALSE) | variable_get('smart_ip_store_location_csv_done', FALSE));
$submit = $recover ? t('Recover database update') : t('Update database now');
$form_state = array(
'values' => array(
'smart_ip_csv_source' => smart_ip_get_csv_source_filename(),
'smart_ip_update_database' => $submit,
'op' => $submit,
),
);
// Set the db update access flag to allow cron to execute db update
$_smart_ip_db_update_access = TRUE;
drupal_execute('smart_ip_cron_db_update', $form_state);
}
else {
drupal_access_denied();
}
}