View source
<?php
$GLOBALS['_kaltura_client_folder'] = drupal_get_path('module', 'kaltura') . '/kaltura_client/';
function kaltura_schema() {
$schema['node_kaltura'] = array(
'description' => t('The base table for Kaltura nodes.'),
'fields' => array(
'vid' => array(
'description' => t('The current {node_revisions}.vid version identifier.'),
'type' => 'int',
'size' => 'small',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'nid' => array(
'description' => t('The primary identifier for a node.'),
'type' => 'int',
'size' => 'small',
'unsigned' => TRUE,
'not null' => TRUE,
),
'kaltura_entryId' => array(
'description' => t('none'),
'type' => 'varchar',
'length' => 10,
'default' => "",
'not null' => TRUE,
),
'kaltura_tags' => array(
'description' => t('tags from kaltura CW'),
'type' => 'text',
'default' => '',
'not null' => FALSE,
),
'kaltura_admin_tags' => array(
'description' => t('admin tags from kaltura CMS'),
'type' => 'text',
'default' => '',
'not null' => FALSE,
),
'kstatus' => array(
'description' => t('The status of the entry/roughcut'),
'type' => 'int',
'size' => 'small',
'default' => 0,
'not null' => TRUE,
),
'kaltura_media_type' => array(
'description' => t('Media type of the entry/mix. see kaltura API documentation for values'),
'type' => 'int',
'size' => 'small',
'not null' => FALSE,
),
'kaltura_duration' => array(
'description' => t('The duration of the entry(msecs)/mix(secs) in seconds'),
'type' => 'int',
'not null' => FALSE,
),
'kaltura_thumbnail_url' => array(
'description' => t('The url of the thumbnail for the entry'),
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
),
'kaltura_partner_data' => array(
'description' => t('partner data that was sent in addentry'),
'type' => 'varchar',
'length' => 4096,
'not null' => FALSE,
),
'kaltura_source' => array(
'description' => t('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' => t('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' => t('The link of the media source'),
'type' => 'varchar',
'length' => 1024,
'not null' => FALSE,
),
'kaltura_width' => array(
'description' => t('if item is image - the width of the image'),
'type' => 'int',
'default' => 0,
'not null' => FALSE,
),
'kaltura_height' => array(
'description' => t('if item is image - the height of the image'),
'type' => 'int',
'default' => 0,
'not null' => FALSE,
),
'kaltura_download_url' => array(
'description' => t('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' => t('Date of the image from EXIF data'),
'type' => 'datetime',
'not null' => FALSE,
),
'kaltura_views' => array(
'description' => t('The number of times this item was viewed (not necessarily played)'),
'type' => 'int',
'default' => 0,
'not null' => FALSE,
),
'kaltura_plays' => array(
'description' => t('The number of times this item was played'),
'type' => 'int',
'default' => 0,
'not null' => FALSE,
),
'kaltura_votes' => array(
'description' => t('The number of votes on the entry/mix'),
'type' => 'int',
'default' => 0,
'not null' => FALSE,
),
'kaltura_rank' => array(
'description' => t('the calculated rank of the entry/mix - multiplied by 1000'),
'type' => 'int',
'default' => 0,
'not null' => FALSE,
),
'kaltura_total_rank' => array(
'description' => t('total rank of the entry/mix'),
'type' => 'int',
'default' => 0,
'not null' => FALSE,
),
'kaltura_entry_data' => array(
'description' => t('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' => t('was the entry added as a comment for another node or not'),
'type' => 'int',
'default' => 0,
'not null' => FALSE,
),
),
'primary key' => array(
'vid',
),
);
$schema['kaltura_notifications'] = array(
'description' => t('table to "log" kaltura notifications, to ignore double notifications'),
'fields' => array(
'notification_id' => array(
'description' => t('notification Id from kaltura'),
'type' => 'int',
'size' => 'normal',
'unsigned' => TRUE,
'not null' => TRUE,
),
'data' => array(
'description' => t('notification REQUEST params'),
'type' => 'text',
'default' => '',
'not null' => FALSE,
),
'received_at' => array(
'type' => 'datetime',
),
),
'primary key' => array(
'notification_id',
),
);
return $schema;
}
function kaltura_tables() {
$tables['node_kaltura'] = "CREATE TABLE `{node_kaltura}` (\n `vid` smallint(5) unsigned NOT NULL default '0',\n `nid` smallint(5) unsigned NOT NULL,\n `kaltura_entryId` varchar(10) NOT NULL default '',\n `kaltura_tags` text,\n `kaltura_admin_tags` text,\n `kstatus` smallint(6) NOT NULL default '0',\n `kaltura_media_type` smallint(6) default NULL,\n `kaltura_duration` int(11) default NULL,\n `kaltura_thumbnail_url` varchar(255) default NULL,\n `kaltura_partner_data` varchar(4096) default NULL,\n `kaltura_source` smallint(6) default NULL,\n `kaltura_source_id` int(11) default '0',\n `kaltura_source_link` varchar(1024) default NULL,\n `kaltura_width` int(11) default '0',\n `kaltura_height` int(11) default '0',\n `kaltura_download_url` varchar(1024) default NULL,\n `kaltura_media_date` datetime default NULL,\n `kaltura_views` int(11) default '0',\n `kaltura_plays` int(11) default '0',\n `kaltura_votes` int(11) default '0',\n `kaltura_rank` int(11) default '0',\n `kaltura_total_rank` int(11) default '0',\n `kaltura_entry_data` text,\n `kaltura_video_comment` tinyint(4) default '0',\n PRIMARY KEY (`vid`)\n )";
$tables['kaltura_notifications'] = "CREATE TABLE `{kaltura_notifications}` (\n `notification_id` int(10) unsigned NOT NULL,\n `data` text,\n `received_at` datetime default NULL,\n PRIMARY KEY (`notification_id`)\n )";
return $tables;
}
function kaltura_install() {
global $_kaltura_client_folder;
require_once $_kaltura_client_folder . 'kaltura_settings.php';
$tables = kaltura_tables();
foreach ($tables as $table_name => $create_sql) {
db_query($create_sql);
}
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>');
}
function kaltura_uninstall() {
global $_kaltura_client_folder;
require_once $_kaltura_client_folder . 'kaltura_settings.php';
$tables = kaltura_tables();
foreach ($tables as $table_name => $create_sql) {
db_query('DROP TABLE {' . $table_name . '}');
}
drupal_set_message('Kaltura module was uninstalled.');
$get_vars = 'SELECT name FROM {variable} WHERE name LIKE \'%s\'';
$result = db_query($get_vars, 'kaltura\\_%');
$vars_deleted = '';
while ($var = db_fetch_object($result)) {
variable_del($var->name);
$vars_deleted .= $var->name . ',';
}
watchdog('kaltura', 'the following vars were deleted during uninstall: ' . rtrim($vars_deleted, ','));
}
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;
}