services.install in Services 6.2
Same filename and directory in other branches
Install, uninstall and update the module.
File
services.installView source
<?php
/**
* @file
* Install, uninstall and update the module.
*/
/**
* Implementation of hook_schema().
*/
function services_schema() {
return array();
}
/**
* Implementation of hook_install().
*/
function services_install() {
drupal_install_schema('services');
}
/**
* Implementation of hook_uninstall().
*/
function services_uninstall() {
drupal_uninstall_schema('services');
$ret = array();
// Drop legacy tables
$legacy_tables = array(
'services_keys',
'services_timestamp_nonce',
);
foreach ($legacy_tables as $table) {
if (db_table_exists($table)) {
db_drop_table($ret, $table);
}
}
variable_del('services_use_key');
variable_del('services_use_sessid');
variable_del('services_debug');
variable_del('services_auth_module');
}
/**
* Implementation of hook_update().
*
* Create the nonce table
*/
function services_update_6001() {
$schema['services_timestamp_nonce'] = array(
'description' => 'Stores timestamp against nonce for repeat attacks.',
'fields' => array(
'timestamp' => array(
'description' => 'The timestamp used with the Nonce.',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => '',
),
'nonce' => array(
'description' => 'The random string used on the request.',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => '',
),
'domain' => array(
'description' => 'The domain that submitted the request.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
),
'indexes' => array(
'timestamp' => array(
'timestamp',
),
),
'primary key' => array(
'nonce',
),
);
$update = array();
db_create_table($update, 'services_timestamp_nonce', $schema['services_timestamp_nonce']);
return $update;
}
function services_update_6002() {
$ret = array();
menu_rebuild();
return $ret;
}
function services_update_6003() {
$ret = array();
drupal_install_modules(array(
'services_keyauth',
));
variable_set('services_auth_module', 'services_keyauth');
return $ret;
}
// Force cache clear on this update.
function services_update_6004() {
return array();
}
Functions
Name![]() |
Description |
---|---|
services_install | Implementation of hook_install(). |
services_schema | Implementation of hook_schema(). |
services_uninstall | Implementation of hook_uninstall(). |
services_update_6001 | Implementation of hook_update(). |
services_update_6002 | |
services_update_6003 | |
services_update_6004 |