View source
<?php
function spambot_schema() {
$schema = array();
$schema['node_spambot'] = array(
'description' => t('Node table to track author IP addresses. For use by spambot only.'),
'fields' => array(
'nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'uid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'hostname' => array(
'type' => 'varchar',
'length' => 128,
'not null' => FALSE,
),
),
'primary key' => array(
'nid',
),
'indexes' => array(
'uid' => array(
'uid',
),
),
);
return $schema;
}
function spambot_install() {
drupal_install_schema('spambot');
}
function spambot_uninstall() {
db_query("DELETE FROM {variable} WHERE name LIKE 'spambot_%'");
drupal_uninstall_schema('spambot');
}
function spambot_update_6300() {
$ret = array();
$message = variable_get('spambot_blocked_message', FALSE);
if (!$message) {
variable_set('spambot_blocked_message', t('Blacklisted. Now go away!'));
}
variable_set('spambot_criteria_email', TRUE);
variable_set('spambot_criteria_username', TRUE);
variable_set('spambot_criteria_ip', TRUE);
return $ret;
}
function spambot_update_6301() {
$ret = array();
if (variable_set('spambot_criteria_email', TRUE)) {
variable_set('spambot_criteria_email', 1);
}
if (variable_set('spambot_criteria_username', FALSE)) {
variable_set('spambot_criteria_username', 1);
}
if (variable_set('spambot_criteria_ip', FALSE)) {
variable_set('spambot_criteria_ip', 1);
}
return $ret;
}
function spambot_update_6302() {
$ret = array();
variable_del('spambot_user_register_report');
$ret[] = array(
'success' => TRUE,
'query' => t('Deleted variable <em>spambot_user_register_report.</em>'),
);
$message = variable_get('spambot_blocked_message', FALSE);
if ($message !== FALSE) {
variable_set('spambot_blocked_message_email', $message);
variable_set('spambot_blocked_message_username', $message);
variable_set('spambot_blocked_message_ip', $message);
variable_del('spambot_blocked_message');
$ret[] = array(
'success' => TRUE,
'query' => t('Transferred user registration blocked message to new format.'),
);
}
$schema = array();
$schema['node_spambot'] = array(
'description' => t('Node table to track author IP addresses. For use by spambot only.'),
'fields' => array(
'nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'uid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'hostname' => array(
'type' => 'varchar',
'length' => 128,
'not null' => FALSE,
),
),
'primary key' => array(
'nid',
),
'indexes' => array(
'uid' => array(
'uid',
),
),
);
db_create_table($ret, 'node_spambot', $schema['node_spambot']);
return $ret;
}