summaryrefslogtreecommitdiffstats
path: root/extensions
diff options
context:
space:
mode:
authorByron Jones <bjones@mozilla.com>2013-11-19 16:51:50 +0100
committerByron Jones <bjones@mozilla.com>2013-11-19 16:51:50 +0100
commitf4b1c3da1d1ebacc04ebb65275d46e6df63416fa (patch)
treef90896c23bb1c7b353d6f561690d64bb292d4405 /extensions
parentb3d21fc65e4e80363071c4ae0e3029338056561f (diff)
downloadbugzilla-f4b1c3da1d1ebacc04ebb65275d46e6df63416fa.tar.gz
bugzilla-f4b1c3da1d1ebacc04ebb65275d46e6df63416fa.tar.xz
Bug 935570: add anti-spam extension (schema-only)
Diffstat (limited to 'extensions')
-rw-r--r--extensions/AntiSpam/Config.pm21
-rw-r--r--extensions/AntiSpam/Extension.pm86
2 files changed, 107 insertions, 0 deletions
diff --git a/extensions/AntiSpam/Config.pm b/extensions/AntiSpam/Config.pm
new file mode 100644
index 000000000..92c32f629
--- /dev/null
+++ b/extensions/AntiSpam/Config.pm
@@ -0,0 +1,21 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# This Source Code Form is "Incompatible With Secondary Licenses", as
+# defined by the Mozilla Public License, v. 2.0.
+
+package Bugzilla::Extension::AntiSpam;
+use strict;
+
+use constant NAME => 'AntiSpam';
+use constant REQUIRED_MODULES => [
+ {
+ package => 'Email-Address',
+ module => 'Email::Address',
+ version => 0,
+ },
+];
+use constant OPTIONAL_MODULES => [];
+
+__PACKAGE__->NAME;
diff --git a/extensions/AntiSpam/Extension.pm b/extensions/AntiSpam/Extension.pm
new file mode 100644
index 000000000..5cb9928db
--- /dev/null
+++ b/extensions/AntiSpam/Extension.pm
@@ -0,0 +1,86 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# This Source Code Form is "Incompatible With Secondary Licenses", as
+# defined by the Mozilla Public License, v. 2.0.
+
+package Bugzilla::Extension::AntiSpam;
+
+use strict;
+use warnings;
+
+use base qw(Bugzilla::Extension);
+
+our $VERSION = '0';
+
+sub db_schema_abstract_schema {
+ my ($self, $args) = @_;
+ $args->{'schema'}->{'antispam_domain_blocklist'} = {
+ FIELDS => [
+ id => {
+ TYPE => 'MEDIUMSERIAL',
+ NOTNULL => 1,
+ PRIMARYKEY => 1,
+ },
+ domain => {
+ TYPE => 'VARCHAR(255)',
+ NOTNULL => 1,
+ },
+ comment => {
+ TYPE => 'VARCHAR(255)',
+ NOTNULL => 1,
+ },
+ ],
+ INDEXES => [
+ antispam_domain_blocklist_idx => {
+ FIELDS => [ 'domain' ],
+ TYPE => 'UNIQUE',
+ },
+ ],
+ };
+ $args->{'schema'}->{'antispam_comment_blocklist'} = {
+ FIELDS => [
+ id => {
+ TYPE => 'MEDIUMSERIAL',
+ NOTNULL => 1,
+ PRIMARYKEY => 1,
+ },
+ word => {
+ TYPE => 'VARCHAR(255)',
+ NOTNULL => 1,
+ },
+ ],
+ INDEXES => [
+ antispam_comment_blocklist_idx => {
+ FIELDS => [ 'word' ],
+ TYPE => 'UNIQUE',
+ },
+ ],
+ };
+ $args->{'schema'}->{'antispam_ip_blocklist'} = {
+ FIELDS => [
+ id => {
+ TYPE => 'MEDIUMSERIAL',
+ NOTNULL => 1,
+ PRIMARYKEY => 1,
+ },
+ ip_address => {
+ TYPE => 'VARCHAR(15)',
+ NOTNULL => 1,
+ },
+ comment => {
+ TYPE => 'VARCHAR(255)',
+ NOTNULL => 1,
+ },
+ ],
+ INDEXES => [
+ antispam_ip_blocklist_idx => {
+ FIELDS => [ 'ip_address' ],
+ TYPE => 'UNIQUE',
+ },
+ ],
+ };
+}
+
+__PACKAGE__->NAME;