tripal_organism.install 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <?php
  2. /**
  3. * @file
  4. * Functions pertaining to the install/uninstall of this module
  5. */
  6. /**
  7. * Implements hook_disable().
  8. * Disable default views when module is disabled
  9. *
  10. * @ingroup tripal_legacy_organism
  11. */
  12. function tripal_organism_disable() {
  13. // Disable all default views provided by this module
  14. require_once("tripal_organism.views_default.inc");
  15. $views = tripal_organism_views_default_views();
  16. foreach (array_keys($views) as $view_name) {
  17. tripal_disable_view($view_name,FALSE,array('suppress_error' => TRUE));
  18. }
  19. }
  20. /**
  21. * Implementation of hook_install().
  22. *
  23. * @ingroup tripal_legacy_organism
  24. */
  25. function tripal_organism_install() {
  26. // set the default vocabularies
  27. tripal_set_default_cv('organismprop', 'type_id', 'organism_property');
  28. }
  29. /**
  30. * Implementation of hook_schema().
  31. *
  32. * @ingroup tripal_legacy_organism
  33. */
  34. function tripal_organism_schema() {
  35. $schema['chado_organism'] = array(
  36. 'fields' => array(
  37. 'vid' => array(
  38. 'type' => 'int',
  39. 'unsigned' => TRUE,
  40. 'not null' => TRUE,
  41. 'default' => 0
  42. ),
  43. 'nid' => array(
  44. 'type' => 'int',
  45. 'unsigned' => TRUE,
  46. 'not null' => TRUE,
  47. 'default' => 0
  48. ),
  49. 'organism_id' => array(
  50. 'type' => 'int',
  51. 'not null' => TRUE,
  52. 'default' => 0
  53. )
  54. ),
  55. 'indexes' => array(
  56. 'organism_id' => array('organism_id')
  57. ),
  58. 'unique keys' => array(
  59. 'nid_vid' => array('nid', 'vid'),
  60. 'vid' => array('vid')
  61. ),
  62. 'primary key' => array('nid'),
  63. );
  64. return $schema;
  65. }
  66. /**
  67. * Implementation of hook_uninstall().
  68. *
  69. * @ingroup tripal_legacy_organism
  70. */
  71. function tripal_organism_uninstall() {
  72. }
  73. /**
  74. * Implementation of hook_requirements().
  75. *
  76. * @ingroup tripal_legacy_organism
  77. */
  78. function tripal_organism_requirements($phase) {
  79. $requirements = array();
  80. if ($phase == 'install') {
  81. // make sure chado is installed
  82. if (!$GLOBALS["chado_is_installed"]) {
  83. $requirements ['tripal_organism'] = array(
  84. 'title' => "tripal_organism",
  85. 'value' => "ERROR: Chado must be installed before this module can be enabled",
  86. 'severity' => REQUIREMENT_ERROR,
  87. );
  88. }
  89. }
  90. return $requirements;
  91. }