-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathkaltura.install
246 lines (240 loc) · 8.1 KB
/
kaltura.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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
<?php
// $Id: kaltura.install,v 1.2.2.5.2.4 2011/01/17 20:56:17 xuriz Exp $
/*
* @file
* Installation process for kaltura core module
*
*/
/**
* Implementation of hook_schema().
*
* Defines the tables and fields in each table that we add to the database
* to store kaltura data (nodes/notifications...)
*/
function kaltura_schema() {
$schema['node_kaltura'] = array(
'description' => 'The base table for Kaltura nodes.',
'fields' => array(
'kaltura_entryid' => array(
'description' => 'Kaltura entry id',
'type' => 'varchar',
'length' => 10,
'default' => '',
'not null' => TRUE),
'kaltura_tags' => array(
'description' => 'tags from kaltura CW',
'type' => 'text',
'default' => NULL,
'not null' => FALSE),
'kaltura_admin_tags' => array(
'description' => 'admin tags from kaltura CMS',
'type' => 'text',
'default' => NULL,
'not null' => FALSE),
'kstatus' => array(
'description' => 'The status of the entry/roughcut',
'type' => 'int',
'size' => 'small',
'default' => 0,
'not null' => TRUE,
),
'kaltura_media_type' => array(
'description' => 'Media type of the entry/mix. see kaltura API documentation for values',
'type' => 'int',
'size' => 'small',
'not null' => FALSE,
),
'kaltura_duration' => array(
'description' => 'The duration of the entry(msecs)/mix(secs) in seconds',
'type' => 'int',
'not null' => FALSE,
),
'kaltura_thumbnail_url' => array(
'description' => 'The url of the thumbnail for the entry',
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
),
'kaltura_partner_data' => array(
'description' => 'partner data that was sent in addentry',
'type' => 'varchar',
'length' => 4096,
'not null' => FALSE,
),
'kaltura_source' => array(
'description' => 'The source of the media (file,webcam,youtube etc.), see kaltura API documentation for values',
'type' => 'int',
'size' => 'small',
'not null' => FALSE,
),
'kaltura_source_id' => array(
'description' => 'The id of the media in the source (e.g. youtube video id)',
'type' => 'int',
'default' => 0,
'not null' => FALSE,
),
'kaltura_source_link' => array(
'description' => 'The link of the media source',
'type' => 'varchar',
'length' => 1024,
'not null' => FALSE,
),
'kaltura_width' => array(
'description' => 'if item is image - the width of the image',
'type' => 'int',
'default' => 0,
'not null' => FALSE,
),
'kaltura_height' => array(
'description' => 'if item is image - the height of the image',
'type' => 'int',
'default' => 0,
'not null' => FALSE,
),
'kaltura_download_url' => array(
'description' => 'The direct download url for the entry/mix. available if item was flattened',
'type' => 'varchar',
'length' => 1024,
'not null' => FALSE,
),
'kaltura_media_date' => array(
'description' => 'Date of the image from exif data',
'type' => 'int',
'not null' => FALSE,
),
// A-sync data fields which should be updated by cron
'kaltura_views' => array(
'description' => 'The number of times this item was viewed not necessarily played',
'type' => 'int',
'default' => 0,
'not null' => FALSE,
),
'kaltura_plays' => array(
'description' => 'The number of times this item was played',
'type' => 'int',
'default' => 0,
'not null' => FALSE,
),
'kaltura_votes' => array(
'description' => 'The number of votes on the entry/mix',
'type' => 'int',
'default' => 0,
'not null' => FALSE,
),
'kaltura_rank' => array(
'description' => 'the calculated rank of the entry/mix - multiplied by 1000',
'type' => 'int',
'default' => 0,
'not null' => FALSE,
),
'kaltura_total_rank' => array(
'description' => 'total rank of the entry/mix',
'type' => 'int',
'default' => 0,
'not null' => FALSE,
),
'kaltura_entry_data' => array(
'description' => 'All the entry/kshow data (serialized) from kaltura received from notification or API call',
'type' => 'text',
'default' => NULL,
'not null' => FALSE
),
'kaltura_video_comment' => array(
'description' => 'was the entry added as a comment for another node or not',
'type' => 'int',
'default' => 0,
'not null' => FALSE,
),
'kaltura_created_date' => array(
'description' => 'The date and time the entry was created',
'type' => 'int',
'default' => 0,
'not null' => FALSE,
),
'kaltura_updated_date' => array(
'description' => 'The date and time the entry was updated',
'type' => 'int',
'default' => 0,
'not null' => FALSE,
),
),
'primary key' => array('kaltura_entryid'),
);
$schema['kaltura_notifications'] = array(
'description' => 'table to "log" kaltura notifications, to ignore double notifications',
'fields' => array(
'notification_id' => array(
'description' => 'notification Id from kaltura',
'type' => 'int',
'size' => 'normal',
'unsigned' => TRUE,
'not null' => TRUE,
),
'data' => array(
'description' => 'notification REQUEST params',
'type' => 'text',
'default' => NULL,
'not null' => FALSE,
),
'received_at' => array(
'type' => 'int',
),
),
'primary key' => array('notification_id'),
);
return $schema;
}
/**
* Implementation of hook_install().
*/
function kaltura_install() {
$_kaltura_client_folder = drupal_get_path('module', 'kaltura') .'/kaltura_client/';
require_once($_kaltura_client_folder .'kaltura_settings.php');
drupal_set_message('<b>To '. l('complete installation', 'admin/settings/kaltura/general') .' of the Kaltura All in One Video Module installation, '.
'you must '. l('get a Partner ID', 'admin/settings/kaltura/general') .'.</b>');
}
/**
* Implementation of hook_uninstall().
*/
function kaltura_uninstall() {
// Remove tables.
$_kaltura_client_folder = drupal_get_path('module', 'kaltura') .'/kaltura_client/';
require_once($_kaltura_client_folder .'kaltura_settings.php');
drupal_uninstall_schema('kaltura');
drupal_set_message('Kaltura module was uninstalled.');
// get all kaltura_ variables, and delete theme
$get_vars = 'SELECT name FROM {variable} WHERE name LIKE :name';
$result = db_query($get_vars, array('name' => 'kaltura\_%'));
$vars_deleted = '';
foreach ($result as $var) {
variable_del($var->name);
$vars_deleted .= $var->name .',';
}
watchdog('kaltura', 'the following vars were deleted during uninstall: '. rtrim($vars_deleted, ','));
}
/*
* Implementation of hook_requirements().
*/
function kaltura_requirements($phase) {
$reqs = array();
if (!module_exists('kaltura')) {
return $reqs;
}
$status = variable_get('kaltura_partner_id', '');
if ($status != '' && $status) {
$status = 'Configured';
}
else {
$status = 'Not Configured';
$severity = REQUIREMENT_ERROR;
$desc = 'You did not complete the module configuration. you must configure the module with valid kaltura partner\'s details<br />'.
'Or perform registration. Go to '. l('kaltura module settings', 'admin/settings/kaltura/general') .' to complete configuration.';
}
$reqs['kaltura'] = array(
'title' => 'Kaltura module',
'value' => $status,
'severity' => $severity,
'description' => $desc,
);
return $reqs;
}