You are here

uiplog.install in User IP Log 6

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

File

uiplog.install
View source
<?php

/**
 * 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',
      ),
    ),
    'primary key' => array(
      'lid',
    ),
  );
  return $schema;
}

/**
 * Implements hook_install().
 */
function uiplog_install() {
  drupal_install_schema('uiplog');
}

/**
 * Implements hook_uninstall().
 */
function uiplog_uninstall() {
  drupal_uninstall_schema('uiplog');
}

/**
 * Implements hook_disable()
 */
function uiplog_disable() {
  module_load_include('inc', 'views', 'includes/view');
  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_install Implements hook_install().
uiplog_schema Implements hook_schema().
uiplog_uninstall Implements hook_uninstall().