You are here

function cleantalk_install in Anti Spam by CleanTalk 7.5

Same name and namespace in other branches
  1. 8 cleantalk.module \cleantalk_install()
  2. 7 cleantalk.module \cleantalk_install()
  3. 7.2 cleantalk.install \cleantalk_install()
  4. 7.4 cleantalk.install \cleantalk_install()

Implements hook_install().

File

./cleantalk.install, line 11
Install and uninstall functions for the CleanTalk module.

Code

function cleantalk_install() {
  db_drop_table('cleantalk_timelabels');
  $cleantalk_timelabels = array(
    'description' => 'Timelabels for admin notification sending.',
    'fields' => array(
      'ct_key' => array(
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
        'default' => '',
        'description' => 'Notification ID.',
      ),
      'ct_value' => array(
        'type' => 'int',
        'length' => 12,
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Time of last notification.',
      ),
    ),
    'primary key' => array(
      'ct_key',
    ),
  );
  db_create_table('cleantalk_timelabels', $cleantalk_timelabels);
  db_drop_table('cleantalk_sfw');
  $cleantalk_sfw = array(
    'description' => 'SpamFireWall data.',
    'fields' => array(
      'network' => array(
        'type' => 'int',
        'length' => 11,
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Spam network.',
      ),
      'mask' => array(
        'type' => 'int',
        'length' => 11,
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Spam mask.',
      ),
    ),
    'indexes' => array(
      'network' => array(
        'network',
      ),
    ),
  );
  db_create_table('cleantalk_sfw', $cleantalk_sfw);
  db_drop_table('cleantalk_sfw_logs');
  $cleantalk_sfw_logs = array(
    'description' => 'SpamFireWall logs.',
    'fields' => array(
      'ip' => array(
        'type' => 'varchar',
        'length' => 15,
        'not null' => TRUE,
        'default' => '',
        'description' => 'IP.',
      ),
      'all_entries' => array(
        'type' => 'int',
        'description' => 'All entries.',
      ),
      'blocked_entries' => array(
        'type' => 'int',
        'description' => 'Blocked entries.',
      ),
      'entries_timestamp' => array(
        'type' => 'int',
        'description' => 'time().',
      ),
    ),
    'primary key' => array(
      'ip',
    ),
  );
  db_create_table('cleantalk_sfw_logs', $cleantalk_sfw_logs);
  db_drop_table('cleantalk_sessions');
  $cleantalk_sessions = array(
    'description' => 'Alternative cookies table',
    'fields' => array(
      'id' => array(
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
        'description' => 'id.',
      ),
      'name' => array(
        'type' => 'varchar',
        'length' => 40,
        'not null' => TRUE,
        'default' => '',
        'description' => 'name.',
      ),
      'value' => array(
        'type' => 'text',
        'not null' => FALSE,
        'default' => NULL,
        'description' => 'value.',
      ),
      'last_update' => array(
        'type' => 'datetime',
        'mysql_type' => 'datetime',
        'not null' => FALSE,
        'default' => NULL,
        'description' => 'time().',
      ),
    ),
    'primary key' => array(
      'id',
      'name',
    ),
  );
  db_create_table('cleantalk_sessions', $cleantalk_sessions);
}