Skip to content

Commit

Permalink
Merge branch 'hotfix-0.6.3'. Fixes #28.
Browse files Browse the repository at this point in the history
  • Loading branch information
chesio committed Oct 25, 2017
2 parents bee7166 + 566b61d commit f50ec8f
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 7 deletions.
2 changes: 1 addition & 1 deletion bc-security.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: BC Security
* Plugin URI: https://github.com/chesio/bc-security
* Description: Helps keeping WordPress websites secure. Plugin requires PHP 5.6 or newer to run.
* Version: 0.6.2
* Version: 0.6.3
* Author: Česlav Przywara <[email protected]>
* Author URI: https://www.chesio.com
* Requires at least: 4.7
Expand Down
9 changes: 7 additions & 2 deletions classes/BlueChip/Security/Modules/IpBlacklist/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,17 @@ public function __construct(\wpdb $wpdb)
}


/**
* @link https://codex.wordpress.org/Creating_Tables_with_Plugins#Creating_or_Updating_the_Table
*/
public function install()
{
// To have dbDelta()
require_once ABSPATH . 'wp-admin/includes/upgrade.php';

dbDelta(implode(' ', [
$charset_collate = $this->wpdb->get_charset_collate();

dbDelta(implode(PHP_EOL, [
"CREATE TABLE {$this->blacklist_table} (",
"id int unsigned NOT NULL AUTO_INCREMENT,",
"scope tinyint unsigned NOT NULL,",
Expand All @@ -80,7 +85,7 @@ public function install()
"comment char(255) NOT NULL,",
"PRIMARY KEY (id),", // 2 spaces seems to be necessary
"UNIQUE KEY ip_in_scope_for_reason (scope, ip_address, reason)",
");",
") $charset_collate;",
]));
}

Expand Down
9 changes: 7 additions & 2 deletions classes/BlueChip/Security/Modules/Log/Logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,17 @@ public function __construct(\wpdb $wpdb, $remote_address)
}


/**
* @link https://codex.wordpress.org/Creating_Tables_with_Plugins#Creating_or_Updating_the_Table
*/
public function install()
{
// To have dbDelta()
require_once ABSPATH . 'wp-admin/includes/upgrade.php';

dbDelta(implode(' ', [
$charset_collate = $this->wpdb->get_charset_collate();

dbDelta(implode(PHP_EOL, [
"CREATE TABLE {$this->log_table} (",
"id int unsigned NOT NULL AUTO_INCREMENT,",
"date_and_time datetime NOT NULL,",
Expand All @@ -65,7 +70,7 @@ public function install()
"context text NULL,",
"PRIMARY KEY (id),", // 2 spaces seems to be necessary
"INDEX event (event)",
");",
") $charset_collate;",
]));
}

Expand Down
9 changes: 7 additions & 2 deletions classes/BlueChip/Security/Modules/Login/Bookkeeper.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,17 @@ public function __construct(Settings $settings, \wpdb $wpdb)
}


/**
* @link https://codex.wordpress.org/Creating_Tables_with_Plugins#Creating_or_Updating_the_Table
*/
public function install()
{
// To have dbDelta()
require_once ABSPATH . 'wp-admin/includes/upgrade.php';

dbDelta(implode(' ', [
$charset_collate = $this->wpdb->get_charset_collate();

dbDelta(implode(PHP_EOL, [
"CREATE TABLE {$this->failed_logins_table} (",
"id int unsigned NOT NULL AUTO_INCREMENT,",
"ip_address char(128) NOT NULL,",
Expand All @@ -62,7 +67,7 @@ public function install()
"user_id bigint unsigned NULL,",
"PRIMARY KEY (id),", // 2 spaces seems to be necessary
"INDEX ip_address (ip_address, date_and_time)",
");",
") $charset_collate;",
]));
}

Expand Down

0 comments on commit f50ec8f

Please sign in to comment.