View source
<?php
function antispam_schema() {
$schema['antispam_spam_marks'] = array(
'fields' => array(
'content_type' => array(
'type' => 'varchar',
'length' => 20,
'not null' => TRUE,
'default' => '',
),
'content_id' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'spam_created' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'hostname' => array(
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
),
'mail' => array(
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
),
'signature' => array(
'type' => 'varchar',
'length' => 40,
'not null' => FALSE,
'default' => '',
),
'spaminess' => array(
'type' => 'float',
'not null' => FALSE,
'default' => 1,
),
'judge' => array(
'type' => 'varchar',
'length' => 40,
'not null' => FALSE,
'default' => '',
),
),
'unique key' => array(
'content' => array(
'content_type',
'content_id',
),
),
'indexes' => array(
'spam_created' => array(
'spam_created',
),
'hostname' => array(
'hostname',
),
'mail' => array(
'mail',
),
),
);
$schema['antispam_moderator'] = array(
'fields' => array(
'uid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'email_for' => array(
'type' => 'varchar',
'length' => 20,
'not null' => TRUE,
'default' => '',
),
),
'primary key' => array(
'uid',
),
'indexes' => array(
'email_for' => array(
'email_for',
),
),
);
$schema['antispam_counter'] = array(
'fields' => array(
'id' => array(
'description' => 'The record ID (unique number)',
'type' => 'serial',
'unsigned' => FALSE,
'not null' => TRUE,
),
'date' => array(
'type' => 'datetime',
'not null' => TRUE,
),
'provider' => array(
'type' => 'int',
'unsigned' => FALSE,
'not null' => TRUE,
'default' => 0,
),
'spam_detected' => array(
'type' => 'int',
'unsigned' => FALSE,
'not null' => FALSE,
'default' => 0,
),
'ham_detected' => array(
'type' => 'int',
'unsigned' => FALSE,
'not null' => FALSE,
'default' => 0,
),
'false_negative' => array(
'type' => 'int',
'unsigned' => FALSE,
'not null' => FALSE,
'default' => 0,
),
'false_positive' => array(
'type' => 'int',
'unsigned' => FALSE,
'not null' => FALSE,
'default' => 0,
),
),
'primary key' => array(
'id',
),
);
return $schema;
}
function antispam_install() {
drupal_install_schema('antispam');
}
function antispam_uninstall() {
drupal_uninstall_schema('antispam');
db_query("DELETE FROM {variable} WHERE name LIKE 'antispam%'");
cache_clear_all('variables', 'cache');
}