function locale_translation_batch_status_fetch_remote

Batch operation callback: Check the availability of a remote po file.

Checks the presence and creation time of one po file per batch process. The file URL and timestamp are stored.

Parameters

array $source: A translation source object of the project for which to check the state of a remote po file.

array $context: The batch context array. The collected state is stored in the 'results' parameter of the context.

See also

locale_translation_batch_status_fetch_local()

locale_translation_batch_status_compare()

1 string reference to 'locale_translation_batch_status_fetch_remote'
locale_translation_batch_status_build in drupal/core/modules/locale/locale.batch.inc
Build a batch to get the status of remote and local translation files.

File

drupal/core/modules/locale/locale.batch.inc, line 60
Batch process to check the availability of remote or local po files.

Code

function locale_translation_batch_status_fetch_remote($source, &$context) {

  // Check the translation file at the remote server and update the source
  // data with the remote status.
  if (isset($source->files['remote'])) {
    $remote_file = $source->files['remote'];
    $result = locale_translation_http_check($remote_file->url);

    // Update the file object with the result data. In case of a redirect we
    // store the resulting url.
    if ($result && !empty($result->updated)) {
      $remote_file->url = isset($result->redirect_url) ? $result->redirect_url : $remote_file->url;
      $remote_file->timestamp = $result->updated;
      $source->files['remote'] = $remote_file;
    }
    $context['results'][$source->name][$source->language] = $source;
  }
}