| 1 |
<?php
|
| 2 |
// $Id: openid.install,v 1.7 2009/08/29 21:07:43 dries Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* @file
|
| 6 |
* Install, update and uninstall functions for the openid module.
|
| 7 |
*/
|
| 8 |
|
| 9 |
/**
|
| 10 |
* Implement hook_schema().
|
| 11 |
*/
|
| 12 |
function openid_schema() {
|
| 13 |
$schema['openid_association'] = array(
|
| 14 |
'description' => 'Stores temporary shared key association information for OpenID authentication.',
|
| 15 |
'fields' => array(
|
| 16 |
'idp_endpoint_uri' => array(
|
| 17 |
'type' => 'varchar',
|
| 18 |
'length' => 255,
|
| 19 |
'description' => 'URI of the OpenID Provider endpoint.',
|
| 20 |
),
|
| 21 |
'assoc_handle' => array(
|
| 22 |
'type' => 'varchar',
|
| 23 |
'length' => 255,
|
| 24 |
'not null' => TRUE,
|
| 25 |
'description' => 'Primary Key: Used to refer to this association in subsequent messages.',
|
| 26 |
),
|
| 27 |
'assoc_type' => array(
|
| 28 |
'type' => 'varchar',
|
| 29 |
'length' => 32,
|
| 30 |
'description' => 'The signature algorithm used: one of HMAC-SHA1 or HMAC-SHA256.',
|
| 31 |
),
|
| 32 |
'session_type' => array(
|
| 33 |
'type' => 'varchar',
|
| 34 |
'length' => 32,
|
| 35 |
'description' => 'Valid association session types: "no-encryption", "DH-SHA1", and "DH-SHA256".',
|
| 36 |
),
|
| 37 |
'mac_key' => array(
|
| 38 |
'type' => 'varchar',
|
| 39 |
'length' => 255,
|
| 40 |
'description' => 'The MAC key (shared secret) for this association.',
|
| 41 |
),
|
| 42 |
'created' => array(
|
| 43 |
'type' => 'int',
|
| 44 |
'not null' => TRUE,
|
| 45 |
'default' => 0,
|
| 46 |
'description' => 'UNIX timestamp for when the association was created.',
|
| 47 |
),
|
| 48 |
'expires_in' => array(
|
| 49 |
'type' => 'int',
|
| 50 |
'not null' => TRUE,
|
| 51 |
'default' => 0,
|
| 52 |
'description' => 'The lifetime, in seconds, of this association.',
|
| 53 |
),
|
| 54 |
),
|
| 55 |
'primary key' => array('assoc_handle'),
|
| 56 |
);
|
| 57 |
|
| 58 |
return $schema;
|
| 59 |
}
|
| 60 |
|
| 61 |
/**
|
| 62 |
* Implement hook_requirements().
|
| 63 |
*/
|
| 64 |
function openid_requirements($phase) {
|
| 65 |
$requirements = array();
|
| 66 |
|
| 67 |
if ($phase == 'runtime') {
|
| 68 |
// Check for the PHP BC Math library.
|
| 69 |
if (!function_exists('bcadd')) {
|
| 70 |
$requirements['bcmath'] = array(
|
| 71 |
'value' => t('Not installed'),
|
| 72 |
'severity' => REQUIREMENT_ERROR,
|
| 73 |
'description' => t('OpenID requires the BC Math library for PHP which is missing or outdated. Please 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')),
|
| 74 |
);
|
| 75 |
}
|
| 76 |
else {
|
| 77 |
$requirements['bcmath'] = array(
|
| 78 |
'value' => t('Installed'),
|
| 79 |
'severity' => REQUIREMENT_OK,
|
| 80 |
);
|
| 81 |
}
|
| 82 |
$requirements['bcmath']['title'] = t('BC Match library');
|
| 83 |
}
|
| 84 |
|
| 85 |
return $requirements;
|
| 86 |
}
|