You are here

function services_update_6001 in Services 6.3

Same name and namespace in other branches
  1. 6 services.install \services_update_6001()
  2. 6.2 services.install \services_update_6001()
  3. 7 services.install \services_update_6001()

Implementation of hook_update().

Create the nonce table

File

./services.install, line 177
Install, uninstall and update the Services module.

Code

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;
}