-
Notifications
You must be signed in to change notification settings - Fork 1
/
webfm.install
executable file
·198 lines (192 loc) · 6.66 KB
/
webfm.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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
<?php
/**
* @file
* WebFM Module Installation
*/
function webfm_schema() {
$schema['webfm_dir'] = array(
'description' => 'WebFM Directory Records',
'fields' => array(
'did' => array(
'description' => 'Directory id, primary identifier for directories',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'path' => array(
'description' => 'The URI of the directory record',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'uid' => array(
'description' => 'The {users}.uid reference to the directory owner',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
),
'indexes' => array(
'path' => array('path'),
),
'primary key' => array('did'),
);
$schema['webfm_apachesolr_index_entities_file'] = array(
'description' => 'Stores a record of when a file property changed to determine if it needs indexing by Solr.',
'fields' => array(
'entity_type' => array(
'description' => t('The type of entity.'),
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
),
'entity_id' => array(
'description' => t('The primary identifier for an entity.'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'bundle' => array(
'description' => t('The bundle to which this entity belongs.'),
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
),
'status' => array(
'description' => t('Boolean indicating whether the entity is visible to non-administrators (eg, published for nodes).'),
'type' => 'int',
'not null' => TRUE,
'default' => 1,
),
'changed' => array(
'description' => t('The Unix timestamp when an entity was changed.'),
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
),
'indexes' => array(
'changed' => array('bundle', 'changed', 'status'),
),
'primary key' => array('entity_id'),
);
$schema['webfm_file'] = array(
'description' => 'WebFM File Records',
'fields' => array(
'fid' => array(
'description' => 'The {file_managed}.fid reference for the file',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'modified' => array(
'description' => 'The last modified time of the file',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
),
'unique keys' => array(
'file' => array('fid'),
),
);
return $schema;
}
function webfm_requirements($phase) {
$requirements = array();
if ($phase == 'runtime') {
// Include the file backend class definition
require_once(dirname(__FILE__) . '/webfm.filebackend.inc');
module_invoke_all('webfm_register_backend');
$backend = webfm_get_active_backend();
$uploaders = array();
foreach (module_implements('webfm_register_uploader') as $module) {
$uploaders[] = module_invoke($module, 'webfm_register_uploader');
}
$requirements['webfm_file_backend'] = array(
'title' => t('WebFM File Backend'),
'value' => NULL,
);
$requirements['webfm_jquery_17'] = array(
'title' => t('WebFM jQuery 1.7 Status'),
'value' => 'Up to date',
);
$requirements['webfm_uploader'] = array(
'title' => t('WebFM File Uploader'),
'value' => NULL,
);
if ($backend == NULL) {
$requirements['webfm_file_backend']['description'] = t('WebFM is missing a file backend. Please enable the default WebFM Local File Management or install an alternative');
$requirements['webfm_file_backend']['severity'] = REQUIREMENT_ERROR;
}
else {
$requirements['webfm_file_backend']['value'] = $backend->getName();
$requirements['webfm_file_backend']['severity'] = REQUIREMENT_OK;
}
if (count($uploaders) == 0) {
$requirements['webfm_uploader']['description'] = t('A suitable WebFM file upload module was not detected, please enable one. The default is the Webfm jQuery Upload module');
$requirements['webfm_uploader']['severity'] = REQUIREMENT_ERROR;
}
elseif (count($uploaders) > 1) {
$requirements['webfm_uploader']['description'] = t('Multiple Webfm file upload modules were detected, please disable all but one. Multiple file upload modules can produce undefined results');
$requirements['webfm_uploader']['severity'] = REQUIREMENT_ERROR;
}
else {
$requirements['webfm_uploader']['severity'] = REQUIREMENT_OK;
$requirements['webfm_uploader']['value'] = $uploaders[0];
}
$requirements['webfm_jquery_17']['severity'] = REQUIREMENT_OK;
if (version_compare(variable_get('jquery_update_jquery_version', '1.5'), '1.7') < 0) {
$requirements['webfm_jquery_17']['severity'] = REQUIREMENT_ERROR;
$requirements['webfm_jquery_17']['value'] = 'Out of date';
$requirements['webfm_jquery_17']['description'] = t('WebFM requires jQuery version 1.7 or greater, please install and configure the jquery_update module');
}
}
return $requirements;
}
function webfm_update_7001() {
$schema['webfm_apachesolr_index_entities_file'] = array(
'description' => 'Stores a record of when a file property changed to determine if it needs indexing by Solr.',
'fields' => array(
'entity_type' => array(
'description' => t('The type of entity.'),
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
),
'entity_id' => array(
'description' => t('The primary identifier for an entity.'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'bundle' => array(
'description' => t('The bundle to which this entity belongs.'),
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
),
'status' => array(
'description' => t('Boolean indicating whether the entity is visible to non-administrators (eg, published for nodes).'),
'type' => 'int',
'not null' => TRUE,
'default' => 1,
),
'changed' => array(
'description' => t('The Unix timestamp when an entity was changed.'),
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
),
'indexes' => array(
'changed' => array('bundle', 'changed', 'status'),
),
'primary key' => array('entity_id'),
);
db_create_table('webfm_apachesolr_index_entities_file', $schema['webfm_apachesolr_index_entities_file']);
}