You are here

statistics_filter.install in Statistics Filter 6

Same filename and directory in other branches
  1. 5 statistics_filter.install
  2. 7 statistics_filter.install

Installs the necessary table for Statistics filter module.

File

statistics_filter.install
View source
<?php

/**
 * @file
 * Installs the necessary table for Statistics filter module.
 */
function statistics_filter_schema() {
  $schema['statistics_filter_browsers'] = array(
    // Table description.
    'description' => t('Stores browser details for statistics filtering'),
    // Field definition
    'fields' => array(
      'browser' => array(
        'type' => 'varchar',
        'length' => '255',
        'not null' => TRUE,
        'default' => '',
        'description' => t('Name of browser'),
      ),
      'counter' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'disp-width' => '11',
        'description' => t('Counter'),
      ),
      'is_crawler' => array(
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
        'disp-width' => '1',
        'description' => t('Flag for crawlers'),
      ),
    ),
    // Index declarations
    'primary key' => array(
      'browser',
    ),
  );
  return $schema;
}

/**
 * Implementation of hook_install().
 */
function statistics_filter_install() {

  // Create my tables.
  drupal_install_schema('statistics_filter');
}

/**
 * Implementation of hook_uninstall().
 */
function statistics_filter_uninstall() {

  //  Drop my tables.
  drupal_uninstall_schema('statistics_filter');

  // Delete variables.
  variable_del('statistics_filter_noadmin');
  variable_del('statistics_filter_roles');
  variable_del('statistics_filter_crawlers');
}

Functions

Namesort descending Description
statistics_filter_install Implementation of hook_install().
statistics_filter_schema @file Installs the necessary table for Statistics filter module.
statistics_filter_uninstall Implementation of hook_uninstall().