You are here

auto_login_url.install in Auto Login URL 7

Same filename and directory in other branches
  1. 8 auto_login_url.install
  2. 2.x auto_login_url.install

Install file.

File

auto_login_url.install
View source
<?php

/**
 * @file
 * Install file.
 */

/**
 * Implements hook_schema().
 */
function auto_login_url_schema() {
  $schema['auto_login_url'] = array(
    'description' => 'Auto login records.',
    'fields' => array(
      'id' => array(
        'description' => 'ID of the record.',
        'type' => 'serial',
        'not null' => TRUE,
      ),
      'uid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Primary Key: {users}.uid for user.',
      ),
      'hash' => array(
        'type' => 'varchar',
        'length' => 100,
        'not null' => FALSE,
        'default' => '',
        'description' => 'Unique hash tag for the generated link.',
      ),
      'destination' => array(
        'type' => 'varchar',
        'length' => 1000,
        'not null' => FALSE,
        'default' => '',
        'description' => 'The destination after user login.',
      ),
      'timestamp' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Timestamp of the creation of the auto login link.',
      ),
    ),
    'indexes' => array(
      'hash_index' => array(
        'hash',
      ),
      'timestamp_index' => array(
        'timestamp',
      ),
    ),
    'primary key' => array(
      'id',
    ),
    'foreign keys' => array(
      'user' => array(
        'table' => 'users',
        'columns' => array(
          'uid' => 'uid',
        ),
      ),
    ),
  );
  return $schema;
}

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

  // Delete variables.
  variable_del('auto_login_url_secret');
  variable_del('auto_login_url_expiration');
  variable_del('auto_login_url_delete_on_use');
  variable_del('auto_login_url_short_url');
}

/**
 * Remove current secret URL, so a new one will be generated.
 */
function auto_login_url_update_7001() {
  variable_del('auto_login_url_secret');
}

Functions

Namesort descending Description
auto_login_url_schema Implements hook_schema().
auto_login_url_uninstall Implements hook_uninstall().
auto_login_url_update_7001 Remove current secret URL, so a new one will be generated.