Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

152 lines (138 sloc) 3.713 kB
<?php
// $Id$
/**
* @file Shurly install file
*/
/**
* Implement hook_schema().
*/
function shurly_schema() {
$schema = array();
$schema['shurly'] = array(
'description' => t('URL redirects for the Shurly module'),
'fields' => array(
'rid' => array(
'description' => t('unique redirect id'),
'type' => 'serial',
'not null' => TRUE,
),
'uid' => array(
'description' => t('user id of owner'),
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'source' => array(
'description' => t('source path'),
'type' => 'varchar',
'length' => '255',
'not null' => TRUE,
),
'destination' => array(
'description' => t('redirect URL'),
'type' => 'varchar',
'length' => '255',
'not null' => TRUE,
),
'created' => array(
'description' => t('datestamp of creation'),
'type' => 'int',
'not null' => TRUE,
),
'count' => array(
'description' => t('usage count'),
'type' => 'int',
'not null' => TRUE,
),
'last_used' => array(
'description' => t('datestamp of last use'),
'type' => 'int',
'not null' => TRUE,
),
'custom' => array(
'description' => t('flag for custom path'),
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'active' => array(
'description' => t('allows links to be deactivated'),
'type' => 'int',
'not null' => TRUE,
'default' => 1,
),
),
'primary key' => array('rid'),
'indexes' => array(
'source' => array('source'),
),
);
$schema['shurly_flood'] = array(
'description' => t('Flood controls the threshold of events, such as the number of contact attempts.'),
'fields' => array(
'fid' => array(
'description' => t('Unique flood event ID.'),
'type' => 'serial',
'not null' => TRUE,
),
'event' => array(
'description' => t('Name of event (e.g. contact).'),
'type' => 'varchar',
'length' => 64,
'not null' => TRUE,
'default' => '',
),
'identifier' => array(
'description' => t('Identifier of the visitor, such as an IP address or hostname.'),
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
),
'timestamp' => array(
'description' => t('Timestamp of the event.'),
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'expiration' => array(
'description' => t('Expiration timestamp. Expired events are purged on cron run.'),
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array('fid'),
'indexes' => array(
'allow' => array('event', 'identifier', 'timestamp'),
//'purge' => array('expiration'),
),
);
return $schema;
}
/**
* Implement hook_install().
*/
function shurly_install() {
drupal_install_schema('shurly');
}
function shurly_update_6100() {
$module = 'shurly';
$schema = drupal_get_schema_unprocessed($module);
_drupal_initialize_schema($module, $schema);
$ret = array();
db_create_table($ret, 'shurly_flood', $schema['shurly_flood']);
return $ret;
}
/**
* Implement hook_uninstall().
*/
function shurly_uninstall() {
// Remove tables.
drupal_uninstall_schema('shurly');
// Remove variables.
variable_del('shurly_throttle');
variable_del('shurly_length');
variable_del('shurly_counter');
variable_del('shurly_index');
}
Jump to Line
Something went wrong with that request. Please try again.