You are here

function jplayer_update_7001 in jPlayer 8.2

Same name and namespace in other branches
  1. 7.2 jplayer.install \jplayer_update_7001()

Add a table to track when direct file downloads are denied.

File

./jplayer.install, line 44
Installation file for jPlayer module.

Code

function jplayer_update_7001() {
  $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',
      ),
    ),
  );

  // If the site is being upgraded from a 6.x release, this table might exist.
  if (!db_table_exists('jplayer_denied')) {
    db_create_table('jplayer_denied', $schema['jplayer_denied']);
  }
}