You are here

track_da_files.install in Track da files 7

Same filename and directory in other branches
  1. 8 track_da_files.install

Install, update and uninstall functions for Track da files module.

File

track_da_files.install
View source
<?php

/**
 * @file
 * Install, update and uninstall functions for Track da files module.
 */

/**
 * Implements hook_schema().
 */
function track_da_files_schema() {
  $schema['track_da_files'] = array(
    'fields' => array(
      'recid' => array(
        'description' => 'record ID',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'pid' => array(
        'description' => 'Path ID.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => FALSE,
      ),
      'ip' => array(
        'description' => 'IP address',
        'type' => 'varchar',
        'length' => 40,
        'not null' => TRUE,
        'default' => '',
      ),
      'browser' => array(
        'description' => 'Browser used',
        'type' => 'varchar',
        'length' => 255,
        'not null' => FALSE,
        'default' => '',
      ),
      'browser_version' => array(
        'description' => 'Browser version',
        'type' => 'varchar',
        'length' => 40,
        'not null' => FALSE,
        'default' => '',
      ),
      'browser_platform' => array(
        'description' => 'Browser platform',
        'type' => 'varchar',
        'length' => 255,
        'not null' => FALSE,
        'default' => '',
      ),
      'referer' => array(
        'description' => 'Referer URI.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'uid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => "User's uid.",
      ),
      'time' => array(
        'description' => 'Display date in Unix timestamp',
        'type' => 'int',
        'unsigned' => FALSE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'id' => array(
        'description' => 'The entity id the file is attached to',
        'type' => 'int',
        'not null' => FALSE,
        'default' => 0,
      ),
      'type' => array(
        'description' => 'The entity type the file is attached to',
        'type' => 'varchar',
        'length' => 64,
        'not null' => FALSE,
        'default' => '',
      ),
    ),
    'primary key' => array(
      'recid',
    ),
  );
  $schema['track_da_files_paths'] = array(
    'fields' => array(
      'pid' => array(
        'description' => 'Path ID.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'path' => array(
        'description' => 'Path of the displayed element.',
        'type' => 'varchar',
        'length' => '255',
        'not null' => TRUE,
        'default' => '',
        'description' => 'Stores paths.',
      ),
      'fid' => array(
        'description' => 'Unique file ID.',
        'type' => 'int',
        'not null' => FALSE,
        'unsigned' => TRUE,
      ),
    ),
    'primary key' => array(
      'pid',
    ),
  );
  return $schema;
}

/**
 * Implements hook_uninstall().
 */
function track_da_files_uninstall() {
  variable_del('track_da_files_report_datas');
  variable_del('track_da_files_report_files_datas');
  variable_del('track_da_files_single_file_report_datas');
  variable_del('track_da_files_single_user_report_datas');
  variable_del('track_da_files_user_report_enabled');
  variable_del('track_da_files_file_field_links_show_enabled');
  variable_del('track_da_files_colorbox_enabled');
  variable_del('track_da_files_specific_roles');
  variable_del('track_da_files_roles');
}

Functions