You are here

uiplog.install in User IP Log 7

Same filename and directory in other branches
  1. 8 uiplog.install
  2. 6 uiplog.install
  3. 9.1.x uiplog.install

Install, update and uninstall functions for the uiplog module.

File

uiplog.install
View source
<?php

/**
 * @file
 * Install, update and uninstall functions for the uiplog module.
 *
 */

/**
 * Implements hook_schema().
 */
function uiplog_schema() {
  $schema['uiplog'] = array(
    'description' => 'Logs users IP to db table on user login.',
    'fields' => array(
      'lid' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'Unique ID.',
      ),
      'uid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Maps to uid in user table.',
      ),
      'ip' => array(
        'type' => 'varchar',
        'length' => 40,
        'not null' => TRUE,
        'description' => 'IP address of logged in users.',
      ),
      'timestamp' => array(
        'type' => 'int',
        'not null' => TRUE,
        'description' => 'Time of login.',
      ),
    ),
    'indexes' => array(
      'uid' => array(
        'uid',
      ),
      'ip' => array(
        'ip',
      ),
    ),
    'primary key' => array(
      'lid',
    ),
  );
  return $schema;
}

/**
 * Implements hook_disable()
 */
function uiplog_disable() {
  module_load_include('inc', 'uiplog', 'views/uiplog.views_default');
  $default_views = array_keys(module_invoke('uiplog', 'views_default_views'));
  $views_status = variable_get('views_defaults', array());
  foreach ($default_views as $default_view) {
    $views_status[$default_view] = TRUE;

    // TRUE means disable
  }
  variable_set('views_defaults', $views_status);
  views_invalidate_cache();
}

Functions

Namesort descending Description
uiplog_disable Implements hook_disable()
uiplog_schema Implements hook_schema().