function coder_upgrade_settings_form_submit in Coder 7.2
Same name and namespace in other branches
- 7 coder_upgrade/includes/settings.inc \coder_upgrade_settings_form_submit()
Submit handler for the settings form.
Rename module input and output directories based on user settings.
1 string reference to 'coder_upgrade_settings_form_submit'
- coder_upgrade_settings_form in coder_upgrade/
includes/ settings.inc - Form builder for the settings form.
File
- coder_upgrade/
includes/ settings.inc, line 131 - Provides module conversion settings form.
Code
function coder_upgrade_settings_form_submit($form, &$form_state) {
$values = $form_state['values'];
$op = isset($values['op']) ? $values['op'] : '';
$cur = variable_get('coder_upgrade_dir', DEADWOOD_DIR);
$new = $op == t('Reset to defaults') ? DEADWOOD_DIR : $values['coder_upgrade_dir'];
if ($new != $cur) {
if (rename(coder_upgrade_directory_path($cur, FALSE), coder_upgrade_directory_path($new, FALSE))) {
variable_set('coder_upgrade_dir_old', $new . '/old');
variable_set('coder_upgrade_dir_new', $new . '/new');
variable_set('coder_upgrade_dir_patch', $new . '/patch');
drupal_set_message(t('Base directory was renamed to ' . $new . '.'));
}
else {
// Reset the directory variable.
variable_set('coder_upgrade_dir', $cur);
drupal_set_message(t('Could not rename base directory'), 'error');
}
}
}