You are here

session_api.install in Session API 6

Same filename and directory in other branches
  1. 5 session_api.install
  2. 7 session_api.install

File

session_api.install
View source
<?php

/**
 * Implementation of hook_install().
 */
function session_api_install() {
  drupal_install_schema('session_api');
}

/**
 * Implementation of hook_uninstall().
 */
function session_api_uninstall() {
  drupal_uninstall_schema('session_api');
}

/**
 * Implementation of hook_schema().
 */
function session_api_schema() {
  $schema['session_api'] = array(
    'description' => t('Map Session API IDs to the {sessions} sid field.'),
    'fields' => array(
      'sid' => array(
        'type' => 'serial',
        'not null' => TRUE,
      ),
      'session_id' => array(
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
      ),
    ),
    'primary key' => array(
      'sid',
    ),
    'unique keys' => array(
      'session_id' => array(
        'session_id',
      ),
    ),
  );
  return $schema;
}

/**
 * Remove cleanup variables.
 */
function session_api_update_6100() {
  $ret = array();
  $ret[] = update_sql("DELETE FROM {variable} WHERE name LIKE 'session_api_run_cron_%'");
  return $ret;
}

/**
 * Implements hook_update_N().
 *
 * Lengthens the session_id field to match core {sessions}.sid field.
 */
function session_api_update_6101() {
  db_change_field($ret, 'session_api', 'session_id', 'session_id', array(
    'type' => 'varchar',
    'length' => 128,
    'not null' => TRUE,
  ));
  return $ret;
}

Functions

Namesort descending Description
session_api_install Implementation of hook_install().
session_api_schema Implementation of hook_schema().
session_api_uninstall Implementation of hook_uninstall().
session_api_update_6100 Remove cleanup variables.
session_api_update_6101 Implements hook_update_N().