You are here

ip.install in IP address manager 7

Same filename and directory in other branches
  1. 8.2 ip.install
  2. 6 ip.install
  3. 7.2 ip.install

IP address manager module install file.

File

ip.install
View source
<?php

/**
 * @file
 * IP address manager module install file.
 */

/**
 * Implements hook_uninstall().
 */
function ip_uninstall() {
  variable_del('ip_backlog_nodes');
}

/**
 * Implements hook_schema().
 */
function ip_schema() {
  $schema['ip_tracker'] = array(
    'description' => 'Stores IP addresses against uids.',
    'fields' => array(
      'uid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'The User ID',
      ),
      'ip' => array(
        'type' => 'int',
        'size' => 'big',
        'not null' => TRUE,
        'description' => 'The User IP address',
      ),
      'visits' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'How many visits with this uid/ip combination',
      ),
      'first_visit' => array(
        'description' => 'A Unix timestamp indicating when this record was created.',
        'type' => 'int',
        'not null' => TRUE,
      ),
      'last_visit' => array(
        'description' => 'A Unix timestamp indicating when this record was updated.',
        'type' => 'int',
        'not null' => TRUE,
      ),
    ),
    'primary key' => array(
      'uid',
      'ip',
    ),
  );
  $schema['ip_posts'] = array(
    'description' => 'Stores ips against nids/cids.',
    'fields' => array(
      'type' => array(
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
        'description' => 'The sort of created item.',
      ),
      'id' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'The Node/Comment ID',
      ),
      'ip' => array(
        'type' => 'int',
        'size' => 'big',
        'not null' => TRUE,
        'description' => 'The User IP address',
      ),
    ),
    'primary key' => array(
      'id',
      'type',
    ),
  );
  return $schema;
}

Functions

Namesort descending Description
ip_schema Implements hook_schema().
ip_uninstall Implements hook_uninstall().