forked from yhahn/searchlight
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearchlight.install
166 lines (161 loc) · 4.8 KB
/
searchlight.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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<?php
/**
* @file
* Install, update and uninstall functions for the searchlight module.
*
*/
/**
* Implements hook_schema().
*/
function searchlight_schema() {
$schema = array();
$schema['searchlight_datasource'] = array(
'description' => 'Storage for Searchlight datasource configuration.',
'export' => array(
'key' => 'name',
'object' => 'SearchlightDatasource',
'identifier' => 'searchlight_datasource',
'default hook' => 'searchlight_default_datasources',
'api' => array(
'owner' => 'searchlight',
'api' => 'datasource', // Base name for api include files.
'minimum_version' => 1,
'current_version' => 1,
),
),
'fields' => array(
'name' => array(
'description' => 'The primary identifier for a datasource.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'base_table' => array(
'description' => 'The base table for this datasource.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'fields' => array(
'description' => 'Serialized storage of datasource field settings.',
'type' => 'text',
'serialize' => TRUE,
),
'relations' => array(
'description' => 'Serialized storage of datasource relations settings.',
'type' => 'text',
'serialize' => TRUE,
),
'filters' => array(
'description' => 'Serialized storage of datasource filter settings.',
'type' => 'text',
'serialize' => TRUE,
),
'options' => array(
'description' => 'Serialized storage of other datasource options.',
'type' => 'text',
'serialize' => TRUE,
),
),
'primary key' => array('name'),
);
$schema['searchlight_environment'] = array(
'description' => 'Storage for Searchlight environment configuration.',
'export' => array(
'key' => 'name',
'object' => 'SearchlightEnvironment',
'identifier' => 'searchlight_environment',
'default hook' => 'searchlight_default_environments',
'api' => array(
'owner' => 'searchlight',
'api' => 'environment', // Base name for api include files.
'minimum_version' => 1,
'current_version' => 1,
),
),
'fields' => array(
'name' => array(
'description' => 'The primary identifier for an environment.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'view_display' => array(
'description' => 'The view/display combination for which this environment is used.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'facets' => array(
'description' => 'Serialized storage of environment facet settings.',
'type' => 'text',
'serialize' => TRUE,
),
'options' => array(
'description' => 'Serialized storage of other environment options.',
'type' => 'text',
'serialize' => TRUE,
),
),
'primary key' => array('name'),
);
$schema['searchlight_search'] = array(
'description' => 'Stores a record of an items status in the index.',
'fields' => array(
'type' => array(
'description' => 'The type of item.',
'type' => 'varchar',
'length' => '128',
'not null' => TRUE,
),
'id' => array(
'description' => 'The primary identifier for an item.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'status' => array(
'description' => 'Boolean indicating whether the item should be available in the index.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
),
'indexes' => array(
'status' => array('status'),
),
'primary key' => array('type', 'id'),
);
return $schema;
}
/**
* Implements hook_enable().
*/
function searchlight_enable() {
searchlight_invalidate_index();
}
/**
* Implements hook_install().
*/
function searchlight_install() {
// TODO The drupal_(un)install_schema functions are called automatically in D7.
// drupal_install_schema('searchlight')
}
/**
* Implements hook_uninstall().
*/
function searchlight_uninstall() {
variable_del('searchlight_views');
variable_del('searchlight_backend');
// TODO Please review the conversion of this statement to the D7 database API syntax.
/* db_query("DELETE FROM {variable} WHERE name LIKE 'searchlight_backend_%'") */
db_delete('variable')
->condition('name', 'searchlight_backend_%', 'LIKE')
->execute();
// TODO The drupal_(un)install_schema functions are called automatically in D7.
// drupal_uninstall_schema('searchlight')
}