i18n_sync.install 805 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. /**
  3. * @file
  4. * Installation file for i18n_sync module.
  5. */
  6. /**
  7. * Set module weight.
  8. *
  9. * Make sure this runs after taxonomy, i18n and translation modules
  10. * and ideally after all other modules implementing nodeapi hook.
  11. */
  12. function i18n_sync_install() {
  13. db_query("UPDATE {system} SET weight = 100 WHERE name = 'i18n_sync' AND type = 'module'");
  14. // If updating from D6, module changed name
  15. if (variable_get('i18n_drupal6_update')) {
  16. i18n_sync_update_7000();
  17. }
  18. }
  19. /*
  20. * Update variable names from Drupal 6
  21. */
  22. function i18n_sync_update_7000() {
  23. foreach (node_type_get_types() as $type => $info) {
  24. if ($fields = variable_get('i18nsync_nodeapi_' . $type)) {
  25. variable_set('i18n_sync_node_type_' . $type, $fields);
  26. variable_del('i18nsync_nodeapi_' . $type);
  27. }
  28. }
  29. }