You are here

captcha_questions_dblog.install in Captcha Questions 7

Same filename and directory in other branches
  1. 8 captcha_questions_dblog/captcha_questions_dblog.install

Install and uninstall functions for the Captcha questions dblog module.

File

captcha_questions_dblog/captcha_questions_dblog.install
View source
<?php

/**
 * @file
 * Install and uninstall functions for the Captcha questions dblog module.
 */

/**
 * Implements hook_schema().
 */
function captcha_questions_dblog_schema() {
  $schema['captcha_questions_dblog'] = array(
    'description' => 'Stores failed form submissions.',
    'fields' => array(
      'dblogid' => array(
        'description' => 'Primary Key: unique ID for failed form submissions.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'timestamp' => array(
        'description' => 'A Unix timestamp indicating when the submit failed.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'ip' => array(
        'description' => 'IP address',
        'type' => 'varchar',
        'length' => 40,
        'not null' => TRUE,
        'default' => '',
      ),
      'form_id' => array(
        'description' => 'The form_id of the form',
        'type' => 'varchar',
        'length' => 40,
        'not null' => TRUE,
        'default' => '',
      ),
      'question_asked' => array(
        'description' => 'The question the form submit failed on',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'answer_given' => array(
        'description' => 'The answer that was wrong',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'answer_correct' => array(
        'description' => 'The correct answer',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
    ),
    'indexes' => array(
      'dblogid' => array(
        'dblogid',
      ),
      'timestamp' => array(
        'timestamp',
      ),
    ),
  );
  return $schema;
}

/**
 * Implements hook_install().
 */
function captcha_questions_dblog_install() {
  drupal_set_message(st("Captcha questions database logging installed successfully. !configure what forms to protect.", array(
    '!configure' => l(st('Configure'), 'admin/config/people/captcha_questions'),
  )));
}