transliteration.install 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. * @file
  4. * Install, update, and uninstall functions for the transliteration module.
  5. */
  6. /**
  7. * Implements hook_install().
  8. */
  9. function transliteration_install() {
  10. module_load_include('inc', 'transliteration', 'transliteration.admin');
  11. if (!$query = transliteration_file_query()) {
  12. // Database not supported.
  13. return;
  14. }
  15. if (!$query->countQuery()->execute()->fetchColumn()) {
  16. // Don't bother if no files need to be fixed.
  17. return;
  18. }
  19. $t = get_t();
  20. drupal_set_message($t('Transliteration has been installed. <a href="@transliteration-url">Fix existing file names</a>.', array('@transliteration-url' => url('admin/config/media/file-system/transliteration'))));
  21. }
  22. /**
  23. * Implements hook_uninstall().
  24. */
  25. function transliteration_uninstall() {
  26. variable_del('transliteration_file_uploads');
  27. variable_del('transliteration_file_lowercase');
  28. variable_del('transliteration_search');
  29. }
  30. /**
  31. * Remove unnecessary Drupal 6 variables.
  32. */
  33. function transliteration_update_7300() {
  34. // Delete all the transliteration_filter_no_known_transliteration_* variables
  35. // and then clear the variable cache.
  36. db_query("DELETE FROM {variable} WHERE name LIKE 'transliteration_filter_no_known_transliteration_%'");
  37. cache_clear_all('variables', 'cache');
  38. }