You are here

bakery.install in Bakery Single Sign-On System 7.4

File

bakery.install
View source
<?php

/**
 * Implements hook_schema().
 */
function bakery_schema() {
  return array(
    'bakery_user' => array(
      'description' => 'Keep track of UID on subsites, master only.',
      'fields' => array(
        'uid' => array(
          'description' => 'User ID on master site.',
          'type' => 'int',
          'unsigned' => TRUE,
          'not null' => TRUE,
        ),
        'slave' => array(
          'description' => 'Slave site.',
          'type' => 'varchar',
          'length' => 128,
          'not null' => TRUE,
        ),
        'slave_uid' => array(
          'description' => 'User ID on slave site.',
          'type' => 'int',
          'unsigned' => TRUE,
          'not null' => TRUE,
        ),
      ),
      'primary key' => array(
        'uid',
        'slave',
      ),
    ),
  );
}

/**
 * Implements hook_uninstall().
 *
 * Remove Bakery variables.
 */
function bakery_uninstall() {
  variable_del('bakery_key');
  variable_del('bakery_domain');
  variable_del('bakery_is_master');
  variable_del('bakery_master');
  variable_del('bakery_slaves');
  variable_del('bakery_supported_fields');
  variable_del('bakery_help_text');
  variable_del('bakery_freshness');
  variable_del('bakery_cookie_extension');
}

/**
 * Implements hook_requirements().
 */
function bakery_requirements($phase) {
  if ($phase != 'runtime') {
    return;
  }
  $t = get_t();
  $requirement = [
    'title' => $t('Bakery'),
    'value' => $t('OK'),
  ];
  if (!class_exists('\\Lcobucci\\JWT\\Token')) {
    $requirement['value'] = $t('library not found');
    $requirement['description'] = $t("You should run 'composer install' to download the JWT library from https://github.com/lcobucci/jwt.");
    $requirement['severity'] = REQUIREMENT_ERROR;
  }
  return [
    'bakery' => $requirement,
  ];
}

Functions