123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- <?php
- /**
- * @file
- * Install and update hooks for Spambot module.
- */
- /**
- * Implements hook_schema().
- */
- function spambot_schema() {
- $schema['node_spambot'] = array(
- 'description' => '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;
- }
- /**
- * Implements hook_uninstall().
- */
- function spambot_uninstall() {
- db_delete('variable')
- ->condition('name', 'spambot_%', 'LIKE')
- ->execute();
- }
- /**
- * Update variables, create new table 'node_spambot'.
- */
- function spambot_update_7101() {
- $messages = array();
- variable_del('spambot_user_register_report');
- $messages[] = 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');
- $messages[] = t('Transferred user registration blocked message to new format.');
- }
- // Create new table node_spambot.
- if (!db_table_exists('node_spambot')) {
- $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('node_spambot', $node_spambot);
- $messages[] = t('Created new table <em>node_spambot</em>.');
- }
- return implode('<br />', $messages);
- }
|