taxonomy_csv.install 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. /**
  3. * @file
  4. * Install, update and uninstall functions for the taxonomy_csv module.
  5. */
  6. /**
  7. * Implements hook_install().
  8. */
  9. function taxonomy_csv_install() {
  10. // Make uploads easy for csv files.
  11. variable_set('upload_extensions_default', variable_get('upload_extensions_default', '') . ' csv');
  12. drupal_set_message(filter_xss(st('Taxonomy CSV import/export has been installed. You can now import and export taxonomies, structures or lists of terms under <a href="!link_import">Administer > Structure > Taxonomy > CSV import</a> and <a href="!link_export">CSV export</a>. More information is available under <a href="!link_help">Administer > Help > Taxonomy CSV import/export</a>.<br /> Your comments are welcomed on the <a href=\"!link_module\">Taxonomy CSV import/export</a> module page.', array(
  13. '!link_import' => url('admin/structure/taxonomy/csv_import'),
  14. '!link_export' => url('admin/structure/taxonomy/csv_export'),
  15. '!link_help' => url('admin/help/taxonomy_csv'),
  16. '!link_module' => url('https://drupal.org/project/taxonomy_csv'),
  17. ))));
  18. }
  19. /**
  20. * Implements hook_uninstall().
  21. */
  22. function taxonomy_csv_uninstall() {
  23. // Simple DB query to get the names of the variables of the module.
  24. $results = db_select('variable', 'v')
  25. ->fields('v', array('name'))
  26. ->condition('name', 'taxonomy_csv_%', 'LIKE')
  27. ->execute();
  28. foreach ($results as $result) {
  29. variable_del($result->name);
  30. }
  31. drupal_set_message(st('Taxonomy csv import/export: All user preferences have been removed. Thanks for using this module!<br />
  32. Your comments are welcomed on <a href="!link">Taxonomy CSV import/export</a> module page.', array(
  33. '!link' => url('https://drupal.org/project/taxonomy_csv'),
  34. )));
  35. }
  36. /**
  37. * Implements hook_requirements().
  38. */
  39. function taxonomy_csv_requirements($phase) {
  40. $requirements = array();
  41. $requirements['taxonomy_csv'] = array(
  42. 'title' => 'Taxonomy CSV import/export is enabled',
  43. 'value' => 'Taxonomy CSV is designed as a run-once setup or migration module. You may disable it once your imports and exports are processed.',
  44. 'severity' => REQUIREMENT_INFO,
  45. );
  46. return $requirements;
  47. }