tmgmt_locale.install 837 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. /**
  3. * @file
  4. * Installation hooks for tmgmt_locale module.
  5. */
  6. /**
  7. * Update existing {locales_target}.l10n_status if any.
  8. */
  9. function tmgmt_locale_update_7000() {
  10. if (module_exists('l10n_update')) {
  11. module_load_include('inc', 'l10n_update');
  12. $query = db_select('tmgmt_job_item', 'ji')
  13. ->condition('ji.plugin', 'locale')
  14. ->condition('ji.state', TMGMT_JOB_ITEM_STATE_ACCEPTED);
  15. $query->innerJoin('tmgmt_job', 'j', 'j.tjid = ji.tjid');
  16. $query->addField('ji', 'item_id', 'lid');
  17. $query->addField('j', 'target_language', 'language');
  18. foreach ($query->execute() as $row) {
  19. db_update('locales_target')
  20. ->condition('lid', $row->lid)
  21. ->condition('language', $row->language)
  22. ->fields(array('l10n_status' => L10N_UPDATE_STRING_CUSTOM))
  23. ->execute();
  24. }
  25. }
  26. }