View source
<?php
function linkedin_install() {
drupal_install_schema('linkedin');
}
function linkedin_schema() {
$schema['linkedin_token'] = array(
'description' => t('Tokens for request and services accesses.'),
'fields' => array(
'uid' => array(
'description' => t('User ID from {user}.uid.'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'token_key' => array(
'description' => t('Tokens for request and services accesses.'),
'type' => 'varchar',
'length' => 100,
'not null' => TRUE,
),
'token_secret' => array(
'description' => t('Token "password".'),
'type' => 'varchar',
'length' => 100,
'not null' => TRUE,
),
'type' => array(
'description' => t('Type of the token: request or access.'),
'type' => 'varchar',
'length' => 7,
'not null' => TRUE,
),
),
'primary key' => array(
'uid',
),
'indexes' => array(
'token_key_type' => array(
'token_key',
),
),
);
return $schema;
}
function linkedin_uninstall() {
drupal_uninstall_schema('linkedin');
variable_del('linkedin_consumer_key');
variable_del('linkedin_consumer_secret');
$types = node_get_types('names');
array_push($types, 'event_signup');
foreach ($types as $type) {
$type = strtolower($type);
variable_del('linkedin_enabled_' . $type);
variable_del('linkedin_default_format_' . $type);
}
}
function linkedin_requirements($phase) {
$requirements = array();
$t = get_t();
$has_curl = function_exists('curl_init');
$requirements['curl'] = array(
'title' => $t('cURL'),
'value' => $has_curl ? $t('Enabled') : $t('Not found'),
);
if (!$has_curl) {
$requirements['curl']['severity'] = REQUIREMENT_ERROR;
$requirements['curl']['description'] = $t('Linkedin module could not be installed because the PHP <a href="@curl_url">cURL</a> library is not available.', array(
'@curl_url' => 'http://php.net/manual/en/curl.setup.php',
));
}
return $requirements;
}