-
Notifications
You must be signed in to change notification settings - Fork 1
/
ontology_search.install
126 lines (107 loc) · 3.75 KB
/
ontology_search.install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<?php
/**
* @file
* Installation of the example module
*/
/**
* Implements hook_disable().
*
* Perform actions when the module is disabled by the site administrator
*
* @ingroup ontology_search
*/
function ontology_search_disable() {
// EXPLANATION: If you are using Drupal Views you want to ensure that any
// default views that your module provides are disabled when the module is
// disabled. Default views are specified in the
// [module name].views.default.inc file. The following code will disable these
// views. If your module does not create any default views you can remove the
// following code.
}
/**
* Implements hook_requirements().
*
* Performs check to see if all required dependencies are met. Drupal will
* automatically check for module dependencies but here you can check for other
* requirements.
*
* @ingroup ontology_search
*/
function ontology_search_requirements($phase) {
$requirements = array();
if ($phase == 'install') {
// EXPLANATION: It is essential that Chado be installed for almost all
// Tripal modules. Therefore, the following code checks to ensure Chado is
// installed and available. If your module does not require that Chado be
// installed, you can remove the following check.
// make sure chado is installed
if (!$GLOBALS["chado_is_installed"]) {
$requirements ['ontology_search'] = array(
'title' => "ontology_search",
'value' => "ERROR: Chado must be installed before this module can be enabled",
'severity' => REQUIREMENT_ERROR,
);
}
}
return $requirements;
}
/**
* Implements hook_install().
*
* Performs actions when the modules is first installed.
*
* @ingroup ontology_search
*/
function ontology_search_install() {
// do nothing
}
/**
* Implements hook_uninstall().
*
* Performs actions when the modules is uninstalled.
*
* @ingroup ontology_search
*/
function ontology_search_uninstall() {
// nothing to uninstall
}
/**
* This is the required update for ontology_search.
*/
function ontology_search_update_7200() {
// EXPLANATION: as you create new releases of your module you may find that
// tables your module created, or data may need to be adjusted. This function
// allows you to do that. This function is executed using the
// http://[your site]/update.php URL or using the drush command 'updatedb'.
// This function should be named according to the instructions provided here:
// https://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_update_N/7
//
// It is best not to use Tripal API calls inside of this function because an
// upgrade from Drupal 6 to Drupal 7 requires that all modules be disabled
// which means the Tripal API is not available. This is an unfortunate
// requirement, but will prevent errors during a major upgrade.
// it is good to wrap any database changes inside of a try catch block:
try {
// perform database changes
}
catch (\PDOException $e) {
$error = $e->getMessage();
throw new DrupalUpdateException('Could not apply updates: '. $error);
}
}
/**
* Implementation of hook_update_dependencies(). It specifies a list of other
* modules whose updates must be run prior to this one.
*/
function ontology_search_update_dependencies() {
$dependencies = array();
// EXPLANATION: here we can specify which modules must be updated prior to
// applying the updates in this module. This is useful because it prevents
// updates from being executed out of order. The following example code shows
// that the 'ontology_search' module update number 7200 must be executed after
// the 'tripal_cv' module's 7200 update.
$dependencies['ontology_search'][7200] = array(
'tripal_cv' => 7200
);
return $dependencies;
}