You are here

jplayer_protect.install in jPlayer 7.2

Same filename and directory in other branches
  1. 6 jplayer_protect/jplayer_protect.install

Installation hooks for the jplayer_protect module.

File

jplayer_protect/jplayer_protect.install
View source
<?php

/**
 * @file
 * Installation hooks for the jplayer_protect module.
 */

/**
 * Implements 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;
}

/**
 * Add a serial column for the denied statistics.
 */
function jplayer_protect_update_7001() {
  $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('jplayer_protect_denied');
  db_add_field('jplayer_protect_denied', 'did', $spec, $keys_new);
  return $ret;
}

/**
 * Implements hook_uninstall().
 */
function jplayer_protect_uninstall() {
  variable_del('jplayer_protect');
}

Functions

Namesort descending Description
jplayer_protect_schema Implements hook_schema().
jplayer_protect_uninstall Implements hook_uninstall().
jplayer_protect_update_7001 Add a serial column for the denied statistics.