Database Schema

Developer Knowledge Level

This content is intended for WordPress developers, and it may require coding knowledge of WordPress, PHP, and JavaScript. Code examples provided here may contain errors or needs some additional coding. Make sure to test the code before using it on a live website!

The plugin adds several Database tables.

Dictionary

Entries used by various plugin features are stored in this table. To see and control the content of this table, check this out: Dictionary.

CREATE TABLE `wp_coresecurity_dictionary` (
    `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
    `type` VARCHAR(64) NOT NULL DEFAULT '',
    `source` VARCHAR(32) NOT NULL DEFAULT 'user',
    `source_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
    `website` VARCHAR(128) NOT NULL DEFAULT '',
    `status` CHAR(1) NOT NULL DEFAULT 'A',
    `entry` VARCHAR(255) NOT NULL DEFAULT '',
    `note` VARCHAR(255) NOT NULL DEFAULT '',
    PRIMARY KEY (`id`),
    INDEX `type` (`type`),
    INDEX `status` (`status`),
    INDEX `source` (`source`),
    INDEX `source_id` (`source_id`),
    INDEX `entry` (`entry`)
) ENGINE=InnoDB;

IP Ban

This table is used to store all banned IPs. More information is available here: Banned IPs.

CREATE TABLE `wp_coresecurity_ip_ban` (
    `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
    `source` VARCHAR(128) NOT NULL DEFAULT '',
    `status` VARCHAR(32) NOT NULL DEFAULT '',
    `ip` VARCHAR(64) NOT NULL DEFAULT '',
    `period` INT(10) UNSIGNED NOT NULL DEFAULT '0',
    `banned` DATETIME NULL DEFAULT NULL,
    `notice` TEXT NULL DEFAULT NULL,
    PRIMARY KEY (`id`),
    UNIQUE INDEX `ip` (`ip`),
    INDEX `source` (`source`),
    INDEX `status` (`status`),
    INDEX `period` (`period`),
    INDEX `banned` (`banned`)
) ENGINE=InnoDB;

IP Log

This is a cache table for the DNSBL results to avoid sending multiple requests for repeated IPs and to have reference data for quick use.

CREATE TABLE `wp_coresecurity_ip_log` (
    `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
    `ip` VARCHAR(64) NOT NULL DEFAULT '',
    `checked` DATETIME NULL DEFAULT NULL,
    `engine` VARCHAR(32) NOT NULL DEFAULT '',
    `search_engine` CHAR(1) NOT NULL DEFAULT 'N',
    `suspicious` CHAR(1) NOT NULL DEFAULT 'N',
    `harvester` CHAR(1) NOT NULL DEFAULT 'N',
    `comment_spammer` CHAR(1) NOT NULL DEFAULT 'N',
    `last_active` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
    `threat_level` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
    `search_engine_key` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
    PRIMARY KEY (`id`),
    UNIQUE INDEX `ip_engine` (`ip`, `engine`),
    INDEX `ip` (`ip`),
    INDEX `engine` (`engine`),
    INDEX `search_engine` (`search_engine`),
    INDEX `suspicious` (`suspicious`),
    INDEX `harvester` (`harvester`),
    INDEX `comment_spammer` (`comment_spammer`),
    INDEX `last_active` (`last_active`),
    INDEX `threat_level` (`threat_level`),
    INDEX `search_engine_key` (`search_engine_key`)
) ENGINE=InnoDB;
Rate this article
0
0
37

You are not allowed to rate this post.

Leave a Comment