forked from roblib/islandora_solution_pack_chemistry
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathislandora_chemistry.install
94 lines (89 loc) · 2.37 KB
/
islandora_chemistry.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
<?php
/**
* @file
* Install hooks for this module.
*/
/**
* Implements hook_install().
*
* @see islandora_chemistry_islandora_required_objects()
*/
function islandora_chemistry_install() {
module_load_include('inc', 'islandora', 'includes/solution_packs');
islandora_install_solution_pack('islandora_chemistry');
}
/**
* Implements hook_uninstall().
*/
function islandora_chemistry_uninstall() {
module_load_include('inc', 'islandora', 'includes/solution_packs');
islandora_install_solution_pack('islandora_chemistry', 'uninstall');
$variables = array(
'islandora_chemistry_python',
'islandora_chemistry_java',
'islandora_chemistry_openbabel',
'islandora_chemistry_obprop',
'islandora_chemistry_inchikey_solr_field',
'islandora_chemistry_fragment_solr_field',
'islandora_chemistry_formula_solr_field',
'islandora_chemistry_cmmmsrv_host',
'islandora_chemistry_cmmmsrv_port',
);
array_walk($variables, 'variable_del');
}
/**
* Implements hook_requirements().
*/
function islandora_chemistry_requirements() {
if (!libraries_get_path('indigo-python')) {
$t = get_t();
$readme_link = l(
$t('README'),
drupal_get_path('module', 'islandora_chemistry') . '/README.md'
);
return array(
'indigo-python' => array(
'title' => $t('Indigo'),
'description' => $t(
'Indigo is missing, please consult the !readme for installation instructions.',
array('!readme' => $readme_link)
),
'severity' => REQUIREMENT_ERROR,
),
);
}
}
/**
* Implements hook_schema().
*/
function islandora_chemistry_schema() {
$schema = array();
$schema['islandora_chemistry_fingerprints'] = array(
'description' => 'Table of chimcal fingerprints.',
'fields' => array(
'id' => array(
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'inchikey' => array(
'type' => 'varchar',
'length' => 50,
'not null' => TRUE,
),
),
'primary key' => array('id'),
'indexes' => array('inchikey' => array('inchikey')),
);
for ($i = 0; $i <= 116; $i++) {
$schema['islandora_chemistry_fingerprints']['fields']["fingerprint_$i"] = array(
'type' => 'int',
'size' => 'big',
'length' => 64,
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
);
}
return $schema;
}