jplayer_protect.install in jPlayer 6
Same filename and directory in other branches
Installation hooks for the jplayer_protect module.
File
jplayer_protect/jplayer_protect.installView source
<?php
/**
* @file
* Installation hooks for the jplayer_protect module.
*/
/**
* Implementation of hook_schema().
*/
function jplayer_protect_schema() {
$schema = array();
$schema['jplayer_protect_denied'] = array(
'description' => 'Contains user statistics for when a user is blocked from downloading a file.',
'fields' => array(
'did' => array(
'description' => 'Primary Key: Unique denied event ID.',
'type' => 'serial',
'not null' => TRUE,
),
'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(
'did',
),
'indexes' => array(
'uid' => array(
'uid',
),
'fid' => array(
'fid',
),
'hostname' => array(
'hostname',
),
'timestamp' => array(
'timestamp',
),
),
);
return $schema;
}
/**
* Implementation of hook_install().
*/
function jplayer_protect_install() {
drupal_install_schema('jplayer_protect');
}
/**
* Implementation of hook_uninstall().
*/
function jplayer_protect_uninstall() {
drupal_uninstall_schema('jplayer_protect');
variable_del('jplayer_protect');
}
/**
* Add a serial column for the denied statistics.
*/
function jplayer_protect_update_6001() {
$ret = array();
$spec = array(
'description' => 'Primary Key: Unique denied event ID.',
'type' => 'serial',
'not null' => TRUE,
);
$keys_new = array(
'primary key' => array(
'did',
),
);
db_drop_primary_key($ret, 'jplayer_protect_denied');
db_add_field($ret, 'jplayer_protect_denied', 'did', $spec, $keys_new);
return $ret;
}
Functions
Name | Description |
---|---|
jplayer_protect_install | Implementation of hook_install(). |
jplayer_protect_schema | Implementation of hook_schema(). |
jplayer_protect_uninstall | Implementation of hook_uninstall(). |
jplayer_protect_update_6001 | Add a serial column for the denied statistics. |