You are here

download_count.install in Download Count 6.2

Installation code for the download_count module.

File

download_count.install
View source
<?php

/**
 * @file
 * Installation code for the download_count module.
 */

/**
 * Implementation of hook_enable()
 */
function download_count_enable() {
  drupal_set_message($message = t('Download_count was successfully enabled. Remember to set view access control as desired if enabling any of the module provided views.'), $type = 'status');
}

/**
 * Implementation of hook_schema().
 */
function download_count_schema() {
  $schema['download_count'] = array(
    'description' => t('TODO'),
    'fields' => array(
      'dcid' => array(
        'description' => 'Primary Key: Unique download count id.',
        'type' => 'serial',
        'not null' => TRUE,
      ),
      'fid' => array(
        'description' => t('The id from the drupal files table of the file downloaded.'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'nid' => array(
        'description' => t('The nid of the node to which the downloaded file was attached when it was downloaded.'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'uid' => array(
        'description' => t('The uid of the user that downloaded the file.'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'vid' => array(
        'description' => t('The vid of the node revision to which the downloaded file was attached when it was downloaded.'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'ip_address' => array(
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => NULL,
        'description' => "The ip address of the downloading user.",
      ),
      'referrer' => array(
        'type' => 'text',
        'not null' => TRUE,
        'description' => 'Referrer URI.',
      ),
      'timestamp' => array(
        'description' => t('The date-time the file was downloaded.'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'dcid',
    ),
  );
  return $schema;
}

/**
 * Implementation of hook_install().
 */
function download_count_install() {
  drupal_install_schema('download_count');
}

/**
 * Implementation of hook_uninstall().
 */
function download_count_uninstall() {
  drupal_uninstall_schema('download_count');
  variable_del('download_count_files_block_limit');
  variable_del('download_count_files_show_size');
  variable_del('download_count_files_show_last');
  variable_del('download_count_files_file_links');
  variable_del('download_count_downloaders_block_limit');
  variable_del('download_count_downloaders_show_size');
  variable_del('download_count_downloaders_show_last');
  variable_del('download_count_users_block_limit');
  variable_del('download_count_users_show_size');
  variable_del('download_count_users_show_last');
  variable_del('download_count_nodes_block_limit');
  variable_del('download_count_nodes_show_size');
  variable_del('download_count_nodes_show_last');
  variable_del('download_count_excluded_file_extensions');
  variable_del('download_count_view_page_limit');
  variable_del('download_count_file_links');
  variable_del('download_count_view_page_format');
  variable_del('download_count_view_page_title');
  variable_del('download_count_view_page_header');
  variable_del('download_count_view_page_footer');
  variable_del('download_count_mypage_view_page_limit');
  variable_del('download_count_mypage_file_links');
  variable_del('download_count_mypage_view_page_format');
  variable_del('download_count_mypage_view_page_title');
  variable_del('download_count_mypage_view_page_header');
  variable_del('download_count_mypage_view_page_footer');
  variable_del('download_count_export_range');
}

Functions

Namesort descending Description
download_count_enable Implementation of hook_enable()
download_count_install Implementation of hook_install().
download_count_schema Implementation of hook_schema().
download_count_uninstall Implementation of hook_uninstall().