You are here

function cleantalk_schema in Anti Spam by CleanTalk 8.3

Same name and namespace in other branches
  1. 8.4 cleantalk.install \cleantalk_schema()
  2. 8 cleantalk.install \cleantalk_schema()
  3. 7 cleantalk.install \cleantalk_schema()
  4. 9.1.x cleantalk.install \cleantalk_schema()

Implements hook_schema().

File

./cleantalk.install, line 12
Install and uninstall functions, schema definition for the CleanTalk module.

Code

function cleantalk_schema() {
  $schema['cleantalk_timelabels'] = array(
    'description' => 'Timelabels for admin notification sending.',
    'fields' => array(
      'ct_key' => array(
        'type' => 'varchar',
        'length' => 100,
        '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',
    ),
  );
  $schema['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.',
      ),
      'status' => array(
        'type' => 'int',
        'length' => 1,
        'unsigned' => FALSE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Spam status.',
      ),
    ),
    'indexes' => array(
      'network' => array(
        'network',
      ),
    ),
  );
  $schema['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',
    ),
  );
  $schema['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',
        'pgsql_type' => 'timestamp',
        'not null' => FALSE,
        'default' => NULL,
        'description' => 'time().',
      ),
    ),
    'primary key' => array(
      'id',
      'name',
    ),
  );
  \Drupal::state()
    ->set('cleantalk_remote_calls', array(
    'close_renew_banner' => array(
      'last_call' => 0,
    ),
    'sfw_update' => array(
      'last_call' => 0,
      'cooldown' => 600,
    ),
    'sfw_update__write_base' => array(
      'last_call' => 0,
    ),
    'sfw_send_logs' => array(
      'last_call' => 0,
    ),
    'update_plugin' => array(
      'last_call' => 0,
    ),
  ));
  return $schema;
}