spam_filter_duplicate.install in Spam 6
Defines the Duplicate module schemata.
File
filters/spam_filter_duplicate/spam_filter_duplicate.installView source
<?php
/**
* @file
* Defines the Duplicate module schemata.
*/
function spam_filter_duplicate_schema() {
$schema['spam_filter_duplicate'] = array(
'description' => t('The base table for the Duplicate submodule'),
'fields' => array(
'iid' => array(
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
'disp-width' => '11',
),
'sid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'disp-width' => '11',
),
'content_hash' => array(
'type' => 'char',
'length' => '32',
'not null' => TRUE,
'default' => '',
),
'hostname' => array(
'type' => 'varchar',
'length' => '15',
'not null' => TRUE,
'default' => '',
),
'duplicate_hash' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'disp-width' => '11',
),
'duplicate_ip' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'disp-width' => '11',
),
'spam' => array(
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
'disp-width' => '4',
),
'expired' => array(
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
'disp-width' => '4',
),
'timestamp' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => FALSE,
'default' => 0,
'disp-width' => '11',
),
),
'primary key' => array(
'iid',
),
'indexes' => array(
'content_hash' => array(
'content_hash',
),
'hostname' => array(
'hostname',
),
'sid' => array(
'sid',
),
'spam' => array(
'spam',
),
'timestamp' => array(
'timestamp',
),
),
);
return $schema;
}
function spam_filter_duplicate_install() {
// Create my tables.
drupal_install_schema('spam_filter_duplicate');
}
function spam_filter_duplicate_uninstall() {
// Remove tables.
drupal_uninstall_schema('spam_filter_duplicate');
drupal_set_message('The spam_filter_duplicate table has been dropped.');
}
/**
* Fix variable namespacing.
*/
function spam_filter_duplicate_update_6101() {
$ret = array();
$old_vars = array(
'duplicate_blacklist',
'duplicate_blacklist_action',
'duplicate_blacklist_message',
'duplicate_post_message',
'duplicate_threshold',
);
foreach ($old_vars as $var) {
$test = variable_get($var, null);
if (!empty($test) && !strcmp(substr($var, 0, 12), "spam_filter_")) {
$ret[] = update_sql('UPDATE {variables} SET name = %s WHERE name = %s', 'spam_filter_' . $var, $var);
}
}
return $ret;
}
Functions
Name | Description |
---|---|
spam_filter_duplicate_install | |
spam_filter_duplicate_schema | @file Defines the Duplicate module schemata. |
spam_filter_duplicate_uninstall | |
spam_filter_duplicate_update_6101 | Fix variable namespacing. |