You are here

clients.install in Web Service Clients 6

@author Django Beatty - adub Install, update and uninstall functions for the Clients module.

File

clients.install
View source
<?php

/**
 * @file
 * @author Django Beatty - adub
 * Install, update and uninstall functions for the Clients module.
 */

/**
 * Implementation of hook_install().
 */
function clients_install() {
  drupal_install_schema('clients');
}

/**
 * Implementation of hook_uninstall().
 */
function clients_uninstall() {
  drupal_uninstall_schema('clients');

  // clean up any variables created by module
  $module_variables = array();
  foreach ($module_variables as $module_variable) {
    variable_del($module_variables);
  }
}

/**
 * Implementation of hook_schema
 */
function clients_schema() {
  $schema['cache_clients'] = drupal_get_schema_unprocessed('system', 'cache');
  $schema['clients_connections'] = array(
    'description' => 'Stores service connection configurations',
    'fields' => array(
      'cid' => array(
        'description' => 'The primary identifier for a service connection.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'name' => array(
        'description' => 'Connection name, must be unique',
        'type' => 'varchar',
        'length' => 100,
        'not null' => TRUE,
      ),
      'type' => array(
        'description' => 'Connection type',
        'type' => 'varchar',
        'length' => 100,
      ),
      'endpoint' => array(
        'description' => 'Connection endpoint',
        'type' => 'varchar',
        'length' => 100,
      ),
      'configuration' => array(
        'description' => 'Connection configuration - serialized',
        'serialize' => TRUE,
        'size' => 'big',
        'type' => 'text',
      ),
    ),
    'unique keys' => array(
      'name' => array(
        'name',
      ),
    ),
    'primary key' => array(
      'cid',
    ),
  );
  $schema['clients_resources'] = array(
    'description' => 'Stores service configurations - these are used as resources to clients',
    'fields' => array(
      'rid' => array(
        'description' => 'The primary identifier for a resource.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'name' => array(
        'description' => 'Resource name, must be unique',
        'type' => 'varchar',
        'length' => 100,
        'not null' => TRUE,
      ),
      'cid' => array(
        'description' => 'Foreign key referencing {clients_connections}',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'configuration' => array(
        'description' => 'Resource configuration - serialized',
        'serialize' => TRUE,
        'size' => 'big',
        'type' => 'text',
      ),
    ),
    'unique keys' => array(
      'name' => array(
        'name',
      ),
    ),
    'primary key' => array(
      'rid',
    ),
  );
  return $schema;
}

Functions

Namesort descending Description
clients_install Implementation of hook_install().
clients_schema Implementation of hook_schema
clients_uninstall Implementation of hook_uninstall().