-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,3 +20,4 @@ rate_limit: true | |
window: 86400 | ||
threshold: 20 | ||
max_challenges: 5 | ||
history_enabled: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
|
||
/** | ||
* @file | ||
* Contains turnstile_protect.install. | ||
*/ | ||
|
||
use Drupal\Core\Database\Database; | ||
|
||
/** | ||
* Implements hook_schema(). | ||
*/ | ||
function turnstile_protect_schema() { | ||
$schema['turnstile_protect_history'] = [ | ||
'description' => 'Stores the history of requests by IP range.', | ||
'fields' => [ | ||
'timestamp' => [ | ||
'description' => 'The Unix timestamp of the record.', | ||
'type' => 'int', | ||
'not null' => TRUE, | ||
'default' => 0, | ||
], | ||
'ip_range' => [ | ||
'description' => 'The IP range being tracked.', | ||
'type' => 'varchar', | ||
'length' => 255, | ||
'not null' => TRUE, | ||
], | ||
'requests' => [ | ||
'description' => 'The number of requests by the IP range.', | ||
'type' => 'int', | ||
'not null' => TRUE, | ||
'default' => 0, | ||
], | ||
], | ||
'indexes' => [ | ||
'ip_range' => ['ip_range'], | ||
], | ||
]; | ||
|
||
return $schema; | ||
} | ||
|
||
/** | ||
* Adds the turnstile_protect_history table. | ||
*/ | ||
function turnstile_protect_update_10001() { | ||
$schema = Database::getConnection()->schema(); | ||
if (!$schema->tableExists('turnstile_protect_history')) { | ||
// Create the table using the schema definition from hook_schema(). | ||
$schema_definition = turnstile_protect_schema(); | ||
$schema->createTable('turnstile_protect_history', $schema_definition['turnstile_protect_history']); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters