function autoban_clear_tables_form_submit in Automatic IP ban (Autoban) 7
Form submission for autoban_clear_tables_form().
File
- ./
autoban.admin.inc, line 518 - Configuration for autoban module.
Code
function autoban_clear_tables_form_submit($form, &$form_state) {
foreach ($form_state['values']['tables'] as $table) {
if ($table) {
$query = db_delete($table);
if ($table == 'ip_ranges') {
$query
->condition('type', 'blacklist', '=');
}
$query
->execute();
if ($table == 'autoban') {
drupal_static_reset('autoban_get_rules');
}
if ($table == 'blocked_ips' && _autoban_blocked_ips_expire_enable()) {
$query = db_delete('blocked_ips_expire');
$query
->execute();
}
drupal_set_message(t('Table %table was cleared.', array(
'%table' => $table,
)));
}
}
$form_state['redirect'] = AUTOBAN_BASE_URL;
}