diff --git a/core/modules/locale/locale.module b/core/modules/locale/locale.module index aba3fd0..10f7c2a 100644 --- a/core/modules/locale/locale.module +++ b/core/modules/locale/locale.module @@ -505,6 +505,19 @@ function locale_cron() { if ($frequency = config('locale.settings')->get('translation.update_interval_days')) { module_load_include('compare.inc', 'locale'); $result = locale_translation_update_cron(1, REQUEST_TIME - $frequency * 24 * 3600); + /* TODO: the call to locale_translation_update_cron should result in queue items + * / + $queue = Drupal::queue('locale_translation_update'); + foreach ($result as $task) { + // transform $task into $item if necessary + $item = array( + 'name' => $name, + 'x' => 'X', + ); + watchdog('locale', 'Queued: ' . $name); + $queue->createItem($graph); + } + */ // @todo Use the code below for development. It reduces the cron threshold from days to minutes. //$result = locale_translation_update_cron(1, REQUEST_TIME - $frequency * 60); if ($result) { @@ -514,6 +527,31 @@ function locale_cron() { } /** + * Implements hook_queue_info(). + */ +function locale_queue_info() { + $queues['locale_translation_update'] = array( + 'title' => t('Updates the translations'), + 'worker callback' => 'locale_translation_update_worker', + 'cron' => array( + 'time' => 60, + ), + ); + return $queues; +} + +/** + * Process 1 file download + * + * TODO: define type for item: object or custom class or array. + * @param type $item + * + * @see locale_cron(). + */ +function locale_translation_update_worker($item) { +} + +/** * Imports translations when new modules or themes are installed. * * This function will start a batch to import translations for the added