You are here

statistics_filter.install in Statistics Filter 7

Same filename and directory in other branches
  1. 5 statistics_filter.install
  2. 6 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.
 */

/**
 * Implements hook_schema().
 */
function statistics_filter_schema() {
  $schema['statistics_filter_browsers'] = array(
    'description' => 'Stores browser details for statistics filtering',
    'fields' => array(
      'browser' => array(
        'type' => 'varchar',
        'length' => '255',
        'not null' => TRUE,
        'default' => '',
        'description' => 'Name of browser',
      ),
      'counter' => array(
        'type' => 'int',
        'size' => 'big',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Counter',
      ),
      'is_crawler' => array(
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Flag for crawlers',
      ),
      'timestamp' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => "Timestamp for browser's last access.",
      ),
    ),
    'primary key' => array(
      'browser',
    ),
  );
  return $schema;
}

/**
 * Implements hook_uninstall().
 */
function statistics_filter_uninstall() {

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

/**
 * Change table structure.
 */
function statistics_filter_update_7101() {
  $table = 'statistics_filter_browsers';
  $schema = statistics_filter_schema();
  db_drop_table($table);
  db_create_table($table, $schema[$table]);
}

Functions