2007-06-18 16:09:39 +00:00
<?php
// $Id$
2009-05-13 19:42:18 +00:00
/**
* @file
* Install, update and uninstall functions for the openid module.
*/
2007-10-05 14:43:26 +00:00
/**
2009-12-04 16:49:48 +00:00
* Implements hook_schema().
2007-10-05 14:43:26 +00:00
*/
function openid_schema() {
$schema['openid_association'] = array(
2008-11-15 13:01:11 +00:00
'description' => 'Stores temporary shared key association information for OpenID authentication.',
2007-10-05 14:43:26 +00:00
'fields' => array(
2007-10-10 11:39:35 +00:00
'idp_endpoint_uri' => array(
'type' => 'varchar',
'length' => 255,
2008-11-15 13:01:11 +00:00
'description' => 'URI of the OpenID Provider endpoint.',
2007-10-10 11:39:35 +00:00
),
'assoc_handle' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
2008-11-15 13:01:11 +00:00
'description' => 'Primary Key: Used to refer to this association in subsequent messages.',
2007-10-10 11:39:35 +00:00
),
'assoc_type' => array(
'type' => 'varchar',
'length' => 32,
2008-11-15 13:01:11 +00:00
'description' => 'The signature algorithm used: one of HMAC-SHA1 or HMAC-SHA256.',
2007-10-10 11:39:35 +00:00
),
'session_type' => array(
'type' => 'varchar',
'length' => 32,
2008-11-15 13:01:11 +00:00
'description' => 'Valid association session types: "no-encryption", "DH-SHA1", and "DH-SHA256".',
2007-10-10 11:39:35 +00:00
),
'mac_key' => array(
'type' => 'varchar',
'length' => 255,
2008-11-15 13:01:11 +00:00
'description' => 'The MAC key (shared secret) for this association.',
2007-10-10 11:39:35 +00:00
),
'created' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
2008-11-15 13:01:11 +00:00
'description' => 'UNIX timestamp for when the association was created.',
2007-10-10 11:39:35 +00:00
),
'expires_in' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
2008-11-15 13:01:11 +00:00
'description' => 'The lifetime, in seconds, of this association.',
2007-10-10 11:39:35 +00:00
),
2007-10-05 14:43:26 +00:00
),
'primary key' => array('assoc_handle'),
);
return $schema;
}
2009-08-29 21:07:43 +00:00
/**
2009-12-04 16:49:48 +00:00
* Implements hook_requirements().
2009-08-29 21:07:43 +00:00
*/
function openid_requirements($phase) {
$requirements = array();
if ($phase == 'runtime') {
// Check for the PHP BC Math library.
if (!function_exists('bcadd')) {
$requirements['bcmath'] = array(
'value' => t('Not installed'),
'severity' => REQUIREMENT_ERROR,
2010-01-09 23:03:22 +00:00
'description' => t('OpenID requires the BC Math library for PHP which is missing or outdated. Check the <a href="@url">PHP BC Math Library documentation</a> for information on how to correct this.', array('@url' => 'http://www.php.net/manual/en/book.bc.php')),
2009-08-29 21:07:43 +00:00
);
}
else {
$requirements['bcmath'] = array(
'value' => t('Installed'),
'severity' => REQUIREMENT_OK,
);
}
2010-02-11 15:48:38 +00:00
$requirements['bcmath']['title'] = t('BC Math library');
2009-08-29 21:07:43 +00:00
}
return $requirements;
}