clients.install in Web Service Clients 7.2
Same filename and directory in other branches
Install, update and uninstall functions for the Clients module.
File
clients.installView source
<?php
/**
* @file
* Install, update and uninstall functions for the Clients module.
*/
/**
* Implements hook_schema
*/
function clients_schema() {
$schema['cache_clients'] = drupal_get_schema_unprocessed('system', 'cache');
$schema['clients_connections'] = array(
'description' => 'Stores service connection configurations',
// CTools exportables support:
'export' => array(
'key' => 'name',
'key name' => 'Name',
'primary key' => 'cid',
'identifier' => 'connection',
// Exports will be as $myobj
'default hook' => 'clients_default_connections',
// Function hook name.
'export type string' => 'export_type_label',
'object factory' => 'clients_connection_unpack_object',
'export callback' => 'clients_export_object',
'api' => array(
'owner' => 'clients',
'api' => 'clients',
// Base name for api include files.
'minimum_version' => 3,
'current_version' => 3,
),
),
'fields' => array(
'cid' => array(
'description' => 'The primary identifier for a service connection.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
'no export' => TRUE,
),
'name' => array(
'description' => 'Connection name, must be unique',
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
),
'type' => array(
'description' => 'Connection type',
'type' => 'varchar',
'length' => 64,
),
'endpoint' => array(
'description' => 'Connection endpoint',
'type' => 'varchar',
'length' => 256,
),
'configuration' => array(
'description' => 'Connection configuration - serialized',
'serialize' => TRUE,
'size' => 'big',
'type' => 'text',
),
),
'unique keys' => array(
'name' => array(
'name',
),
),
'primary key' => array(
'cid',
),
);
return $schema;
}
/**
* Helper function for connection type modules to delete all their connections.
*
* For example usage, see clients_drupal_uninstall().
*
* @param $module
* The name of the module whose connections should be deleted.
*/
function clients_connection_uninstall_connection_delete($module) {
// Invoke hook_clients_connection_type_info().
// This works even when the module is about to be uninstalled.
$connection_types = module_invoke($module, 'clients_connection_type_info');
foreach ($connection_types as $type => $info) {
$num_deleted = db_delete('clients_connections')
->condition('type', $type)
->execute();
}
}
Functions
Name | Description |
---|---|
clients_connection_uninstall_connection_delete | Helper function for connection type modules to delete all their connections. |
clients_schema | Implements hook_schema |