tripal_organism.install

  1. 2.x tripal_organism/tripal_organism.install
  2. 3.x legacy/tripal_organism/tripal_organism.install
  3. 1.x tripal_organism/tripal_organism.install

Functions pertaining to the install/uninstall of this module

File

legacy/tripal_organism/tripal_organism.install
View source
  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. }