You are here

function l10n_update_status_form_submit in Localization update 7.2

Form submission handler for locale_translation_status_form().

File

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

Code

function l10n_update_status_form_submit($form, $form_state) {
  module_load_include('fetch.inc', 'l10n_update');
  $langcodes = array_filter($form_state['values']['langcodes']);
  $projects = array_filter($form_state['values']['projects_update']);

  // Set the translation import options. This determines if existing
  // translations will be overwritten by imported strings.
  $options = _l10n_update_default_update_options();

  // If the status was updated recently we can immediately start fetching the
  // translation updates. If the status is expired we clear it an run a batch to
  // update the status and then fetch the translation updates.
  $last_checked = variable_get('l10n_update_last_check');
  if ($last_checked < REQUEST_TIME - L10N_UPDATE_STATUS_TTL) {
    l10n_update_clear_status();
    $batch = l10n_update_batch_update_build(array(), $langcodes, $options);
    batch_set($batch);
  }
  else {
    $batch = l10n_update_batch_fetch_build($projects, $langcodes, $options);
    batch_set($batch);
  }
}