You are here

function l10n_update_admin_settings_form_validate in Localization update 7

Same name and namespace in other branches
  1. 6 l10n_update.admin.inc \l10n_update_admin_settings_form_validate()
  2. 7.2 l10n_update.admin.inc \l10n_update_admin_settings_form_validate()

Additional validation handler for update settings.

Check for existing files directory and creates one when required.

File

./l10n_update.admin.inc, line 217
Admin settings and update page.

Code

function l10n_update_admin_settings_form_validate($form, &$form_state) {
  $form_values = $form_state['values'];
  if (!empty($form_values['l10n_update_download_store'])) {
    if (!file_prepare_directory($form_values['l10n_update_download_store'], FILE_CREATE_DIRECTORY, 'l10n_update_download_store')) {
      form_set_error('l10n_update_download_store', t('The directory %directory does not exist or is not writable.', array(
        '%directory' => $form_values['l10n_update_download_store'],
      )));
      watchdog('file system', 'The directory %directory does not exist or is not writable.', array(
        '%directory' => $form_values['l10n_update_download_store'],
      ), WATCHDOG_ERROR);
    }
  }
}