function captcha_schema in CAPTCHA 7
Same name and namespace in other branches
- 8 captcha.install \captcha_schema()
- 6.2 captcha.install \captcha_schema()
- 6 captcha.install \captcha_schema()
Implementation of hook_schema().
1 call to captcha_schema()
- captcha_update_7001 in ./
captcha.install - Increase the Session Id field size.
File
- ./
captcha.install, line 11 - Install, update and uninstall functions for the CAPTCHA module.
Code
function captcha_schema() {
// Table for positions and types of the challenges.
$schema['captcha_points'] = array(
'description' => 'This table describes which challenges should be added to which forms.',
'export' => array(
'key' => 'form_id',
'identifier' => 'captcha',
'default hook' => 'captcha_default_points',
// Function hook name.
'status' => 'mark_status',
'api' => array(
'owner' => 'captcha',
'api' => 'captcha',
// Base name for api include files.
'minimum_version' => 1,
'current_version' => 1,
),
),
'fields' => array(
'form_id' => array(
'description' => 'The form_id of the form to add a CAPTCHA to.',
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
),
'module' => array(
'description' => 'The module that provides the challenge.',
'type' => 'varchar',
'length' => 64,
),
'captcha_type' => array(
'description' => 'The challenge type to use.',
'type' => 'varchar',
'length' => 64,
),
),
'primary key' => array(
'form_id',
),
);
// Table for the CAPTCHA sessions.
$schema['captcha_sessions'] = array(
'description' => 'Stores the data about CAPTCHA sessions (solution, IP address, timestamp, ...).',
'fields' => array(
'csid' => array(
'description' => 'CAPTCHA session ID.',
'type' => 'serial',
'not null' => TRUE,
),
'token' => array(
'description' => 'One time CAPTCHA token.',
'type' => 'varchar',
'length' => 64,
'not null' => FALSE,
),
'uid' => array(
'description' => "User's {users}.uid.",
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'sid' => array(
'description' => "Session ID of the user.",
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
),
'ip_address' => array(
'description' => 'IP address of the visitor.',
'type' => 'varchar',
'length' => 128,
'not null' => FALSE,
),
'timestamp' => array(
'description' => 'A Unix timestamp indicating when the challenge was generated.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'form_id' => array(
'description' => 'The form_id of the form where the CAPTCHA is added to.',
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
),
'solution' => array(
'description' => 'Solution of the challenge.',
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
),
'status' => array(
'description' => 'Status of the CAPTCHA session (unsolved, solved, ...)',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'attempts' => array(
'description' => 'The number of attempts.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array(
'csid',
),
'indexes' => array(
'csid_ip' => array(
'csid',
'ip_address',
),
),
);
return $schema;
}