You are here

function l10n_update_cron in Localization update 7

Same name and namespace in other branches
  1. 6 l10n_update.module \l10n_update_cron()
  2. 7.2 l10n_update.module \l10n_update_cron()

Implements hook_cron().

Check one project/language at a time, download and import if update available

File

./l10n_update.module, line 99
Download translations from remote localization server.

Code

function l10n_update_cron() {
  $last = variable_get('l10n_update_last_check', 0);
  $frequency = variable_get('l10n_update_check_frequency', 0) * 24 * 3600;
  if ($frequency && $last < REQUEST_TIME - $frequency) {
    module_load_include('check.inc', 'l10n_update');
    list($checked, $updated) = l10n_update_check_translations(L10N_UPDATE_CRON_PROJECTS, REQUEST_TIME - $frequency, L10N_UPDATE_CRON_UPDATES);
    if (count($checked) || count($updated)) {
      watchdog('l10n_update', 'Automatically checked @checked translations, updated @updated.', array(
        '@checked' => count($checked),
        '@updated' => count($updated),
      ));
    }
    variable_set('l10n_update_last_check', REQUEST_TIME);
  }
}