You are here

fbconnect_login.install in Facebook Connect 8.2

Same filename and directory in other branches
  1. 7.2 fbconnect_login/fbconnect_login.install

Install, update and uninstall functions for the FBConnect Login module.

File

fbconnect_login/fbconnect_login.install
View source
<?php

/**
 * @file
 * Install, update and uninstall functions for the FBConnect Login module.
 */

/**
 * Implements hook_install().
 */
function fbconnect_login_install() {
  _fbconnect_login_change_user_mail_field();
}

/**
 * Implements hook_schema().
 */
function fbconnect_login_schema() {
  $schema['fbconnect_users'] = array(
    'fields' => array(
      'uid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'fbuid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'size' => 'big',
      ),
      'timestamp' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'fbuid',
    ),
  );
  return $schema;
}

/**
 * Implements hook_uninstall
 */
function fbconnect_login_uninstall() {
  _fbconnect_login_change_user_mail_field('uninstall');
}

/**
 * Implements hook_schema_alter().
 * @param array $schema
 * @todo remove it / create updating tool
 */
function fbconnect_login_schema_alter(&$schema) {
  $schema['users']['fields']['mail']['length'] = 320;
}

/**
 * Extend maximum email length to 320 chars
 */
function _fbconnect_login_change_user_mail_field($action = 'install') {
  $schema = array(
    'users' => drupal_get_schema('users'),
  );
  if ($action == 'install') {
    fbconnect_login_schema_alter($schema);
  }
  db_change_field('users', 'mail', 'mail', $schema['users']['fields']['mail']);

  //return $res;
}

Functions

Namesort descending Description
fbconnect_login_install Implements hook_install().
fbconnect_login_schema Implements hook_schema().
fbconnect_login_schema_alter Implements hook_schema_alter().
fbconnect_login_uninstall Implements hook_uninstall
_fbconnect_login_change_user_mail_field Extend maximum email length to 320 chars