function variable_clean_form_submit in Variable Cleanup 6
Same name and namespace in other branches
- 7 variable_clean.module \variable_clean_form_submit()
Form submit handler for variable cleanup.
See also
File
- ./
variable_clean.module, line 157 - Allows you to remove variables not currently used.
Code
function variable_clean_form_submit($form, &$form_state) {
// Confirmation complete.
if ($form_state['storage']['step'] == 'confirm') {
$form_state['storage']['step'] = 'scan';
$form_state['rebuild'] = TRUE;
return;
}
// Delete the variables.
$deleted_variables = array();
foreach ($form_state['values']['variables'] as $variable) {
if ($variable) {
variable_del($variable);
$deleted_variables[] = $variable;
}
}
drupal_set_message(t('The following variables have been removed from the database: !variables', array(
'!variables' => '<br />' . filter_xss_admin(implode('<br />', $deleted_variables)),
)));
$form_state['storage']['step'] = 'confirm';
$form_state['rebuild'] = TRUE;
}