You are here

linkedin.install in LinkedIn Integration 6

Same filename and directory in other branches
  1. 7 linkedin.install

File

linkedin.install
View source
<?php

/*
 * @file : Installation hooks implementation for Linkedin module
 */

/**
 * Implementation of hook_install().
 */
function linkedin_install() {
  drupal_install_schema('linkedin');
}

/**
 * Implementation of hook_schema().
 */
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;
}

/**
 * Implementation of hook_uninstall().
 */
function linkedin_uninstall() {
  drupal_uninstall_schema('linkedin');

  // Delete variables
  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);
  }
}

/**
 * Implements hook_requirements().
 */
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;
}

Functions

Namesort descending Description
linkedin_install Implementation of hook_install().
linkedin_requirements Implements hook_requirements().
linkedin_schema Implementation of hook_schema().
linkedin_uninstall Implementation of hook_uninstall().