jplayer.install in jPlayer 6
Same filename and directory in other branches
Installation file for jPlayer module.
File
jplayer.installView source
<?php
/**
* @file
* Installation file for jPlayer module.
*/
/**
* Implementation of hook_schema().
*/
function jplayer_schema() {
}
/**
* Implementation of hook_install().
*/
function jplayer_install() {
drupal_install_schema('jplayer');
}
/**
* Implementation of hook_requirements().
*/
function jplayer_requirements($phase) {
$requirements = array();
if ($phase == 'runtime') {
$requirements['jplayer']['title'] = t('jPlayer');
if ($jplayer_version = jplayer_get_version()) {
$requirements['jplayer']['value'] = $jplayer_version;
$requirements['jplayer']['severity'] = REQUIREMENT_OK;
}
else {
$requirements['jplayer']['value'] = t('Not found');
$requirements['jplayer']['description'] = t('Missing the jPlayer library. Please <a href="!url">download jPlayer</a> and extract it into the %directory directory.', array(
'!url' => url('http://www.happyworm.com/jquery/jplayer/download.htm'),
'%directory' => variable_get('jplayer_directory', 'sites/all/libraries/jplayer'),
));
$requirements['jplayer']['severity'] = REQUIREMENT_ERROR;
}
}
return $requirements;
}
/**
* Implementation of hook_uninstall().
*/
function jplayer_uninstall() {
drupal_uninstall_schema('jplayer');
variable_del('jplayer_pause_others');
}
/**
* Add a table to track when direct file downloads are denied.
*/
function jplayer_update_6001() {
$ret = array();
$schema = array();
$schema['jplayer_denied'] = array(
'description' => 'Contains user statistics for when a user is blocked from downloading a file.',
'fields' => array(
'uid' => array(
'description' => 'The user ID of the user.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'fid' => array(
'description' => 'The file ID that was denied access.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'hostname' => array(
'description' => 'The hostname of the user that was denied access.',
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
),
'timestamp' => array(
'description' => 'The last time this user was denied access.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array(
'uid',
'fid',
'timestamp',
),
'indexes' => array(
'uid' => array(
'uid',
),
'fid' => array(
'fid',
),
'hostname' => array(
'hostname',
),
'timestamp' => array(
'timestamp',
),
),
);
db_create_table($ret, 'jplayer_denied', $schema['jplayer_denied']);
return $ret;
}
/**
* Transition to the jplayer_protect module if jplayer content protection is
* enabled.
*/
function jplayer_update_6002() {
$ret = array();
if (variable_get('jplayer_protected', FALSE)) {
variable_set('jplayer_protect', TRUE);
if (!module_exists('jplayer_protect')) {
drupal_install_modules(array(
'jplayer_protect',
));
if (db_table_exists('jplayer_protect_denied')) {
db_drop_table($ret, 'jplayer_protect_denied');
db_rename_table($ret, 'jplayer_denied', 'jplayer_protect_denied');
}
}
else {
return t('It appears that the jplayer_protect module has been manually enabled. Please move any data from the {jplayer_protect} table to the {jplayer_protect_denied} table and drop the {jplayer_protect} table.');
}
}
else {
db_drop_table($ret, 'jplayer_denied');
}
variable_del('jplayer_protected');
return $ret;
}
Functions
Name | Description |
---|---|
jplayer_install | Implementation of hook_install(). |
jplayer_requirements | Implementation of hook_requirements(). |
jplayer_schema | Implementation of hook_schema(). |
jplayer_uninstall | Implementation of hook_uninstall(). |
jplayer_update_6001 | Add a table to track when direct file downloads are denied. |
jplayer_update_6002 | Transition to the jplayer_protect module if jplayer content protection is enabled. |