diff --git a/abusefilter.tables.pg.sql b/abusefilter.tables.pg.sql index 272eb50a2..f9562472a 100644 --- a/abusefilter.tables.pg.sql +++ b/abusefilter.tables.pg.sql @@ -49,8 +49,7 @@ CREATE TABLE abuse_filter_log ( afl_wiki TEXT NULL, afl_deleted SMALLINT NOT NULL DEFAULT 0, afl_patrolled_by INTEGER NULL, - afl_rev_id INTEGER NULL, - afl_log_id INTEGER NULL + afl_rev_id INTEGER NULL ); CREATE INDEX abuse_filter_log_filter_timestamp ON abuse_filter_log(afl_filter,afl_timestamp); @@ -59,7 +58,6 @@ CREATE INDEX abuse_filter_log_timestamp ON abuse_filter_log(afl_timestamp CREATE INDEX abuse_filter_log_page_timestamp ON abuse_filter_log(afl_namespace, afl_title, afl_timestamp); CREATE INDEX abuse_filter_log_ip_timestamp ON abuse_filter_log(afl_ip, afl_timestamp); CREATE INDEX abuse_filter_log_rev_id ON abuse_filter_log(afl_rev_id); -CREATE INDEX abuse_filter_log_log_id ON abuse_filter_log(afl_log_id); CREATE INDEX abuse_filter_log_wiki_timestamp ON abuse_filter_log(afl_wiki, afl_timestamp); CREATE SEQUENCE abuse_filter_history_afh_id_seq; diff --git a/abusefilter.tables.sql b/abusefilter.tables.sql index ff9bdb3dc..faedb1a31 100644 --- a/abusefilter.tables.sql +++ b/abusefilter.tables.sql @@ -47,7 +47,6 @@ CREATE TABLE /*$wgDBprefix*/abuse_filter_log ( afl_deleted tinyint(1) NOT NULL DEFAULT 0, afl_patrolled_by int unsigned NULL, afl_rev_id int unsigned, - afl_log_id int unsigned, PRIMARY KEY (afl_id), KEY filter_timestamp (afl_filter,afl_timestamp), @@ -56,7 +55,6 @@ CREATE TABLE /*$wgDBprefix*/abuse_filter_log ( KEY page_timestamp (afl_namespace, afl_title, afl_timestamp), KEY ip_timestamp (afl_ip, afl_timestamp), KEY (afl_rev_id), - KEY (afl_log_id), KEY wiki_timestamp (afl_wiki, afl_timestamp) ) /*$wgDBTableOptions*/; diff --git a/abusefilter.tables.sqlite.sql b/abusefilter.tables.sqlite.sql index d36c35ceb..170879aeb 100644 --- a/abusefilter.tables.sqlite.sql +++ b/abusefilter.tables.sqlite.sql @@ -44,8 +44,7 @@ CREATE TABLE /*$wgDBprefix*/abuse_filter_log ( afl_wiki varbinary(64) NULL, afl_deleted tinyint(1) NOT NULL DEFAULT 0, afl_patrolled_by int unsigned NULL, - afl_rev_id int unsigned, - afl_log_id int unsigned + afl_rev_id int unsigned ) /*$wgDBTableOptions*/; CREATE INDEX afl_filter_timestamp ON /*$wgDBprefix*/abuse_filter_log (afl_filter,afl_timestamp); CREATE INDEX afl_user_timestamp ON /*$wgDBprefix*/abuse_filter_log (afl_user,afl_user_text,afl_timestamp); @@ -54,7 +53,6 @@ CREATE INDEX afl_page_timestamp ON /*$wgDBprefix*/abuse_filter_log (afl_namespac CREATE INDEX afl_ip_timestamp ON /*$wgDBprefix*/abuse_filter_log (afl_ip, afl_timestamp); CREATE INDEX afl_wiki_timestamp ON /*$wgDBprefix*/abuse_filter_log (afl_wiki, afl_timestamp); CREATE INDEX afl_rev_id ON /*$wgDBprefix*/abuse_filter_log (afl_rev_id); -CREATE INDEX afl_log_id ON /*$wgDBprefix*/abuse_filter_log (afl_log_id); CREATE TABLE /*$wgDBprefix*/abuse_filter_history ( afh_id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, diff --git a/db_patches/patch-afl-namespace_int.sqlite.sql b/db_patches/patch-afl-namespace_int.sqlite.sql index d48f18108..52f222d11 100644 --- a/db_patches/patch-afl-namespace_int.sqlite.sql +++ b/db_patches/patch-afl-namespace_int.sqlite.sql @@ -18,17 +18,16 @@ CREATE TABLE /*_*/abuse_filter_log_tmp ( afl_wiki varbinary(64) NULL, afl_deleted tinyint(1) NOT NULL DEFAULT 0, afl_patrolled_by int unsigned NULL, - afl_rev_id int unsigned, - afl_log_id int unsigned + afl_rev_id int unsigned ) /*$wgDBTableOptions*/; INSERT OR IGNORE INTO /*_*/abuse_filter_log_tmp ( afl_id, afl_filter, afl_user, afl_user_text, afl_ip, afl_action, afl_actions, afl_var_dump, afl_timestamp, afl_namespace, afl_title, afl_wiki, afl_deleted, - afl_patrolled_by, afl_rev_id, afl_log_id) + afl_patrolled_by, afl_rev_id) SELECT afl_id, afl_filter, afl_user, afl_user_text, afl_ip, afl_action, afl_actions, afl_var_dump, afl_timestamp, afl_namespace, afl_title, afl_wiki, afl_deleted, - afl_patrolled_by, afl_rev_id, afl_log_id + afl_patrolled_by, afl_rev_id FROM /*_*/abuse_filter_log; DROP TABLE /*_*/abuse_filter_log; @@ -40,6 +39,5 @@ CREATE INDEX /*i*/afl_page_timestamp ON /*_*/abuse_filter_log (afl_namespace, af CREATE INDEX /*i*/afl_ip_timestamp ON /*_*/abuse_filter_log (afl_ip, afl_timestamp); CREATE INDEX /*i*/afl_wiki_timestamp ON /*_*/abuse_filter_log (afl_wiki, afl_timestamp); CREATE INDEX /*i*/afl_rev_id ON /*_*/abuse_filter_log (afl_rev_id); -CREATE INDEX /*i*/afl_log_id ON /*_*/abuse_filter_log (afl_log_id); COMMIT; \ No newline at end of file diff --git a/db_patches/patch-afl_action_id.sql b/db_patches/patch-afl_action_id.sql index 85eab8340..cd1ff1da8 100644 --- a/db_patches/patch-afl_action_id.sql +++ b/db_patches/patch-afl_action_id.sql @@ -1,8 +1,4 @@ -- Store the ID of successful actions in the abuse_filter_log table. ALTER TABLE /*_*/abuse_filter_log ADD COLUMN afl_rev_id int unsigned; -CREATE INDEX /*i*/afl_rev_id ON /*_*/abuse_filter_log (afl_rev_id); - -ALTER TABLE /*_*/abuse_filter_log - ADD COLUMN afl_log_id int unsigned; -CREATE INDEX /*i*/afl_log_id ON /*_*/abuse_filter_log (afl_log_id); \ No newline at end of file +CREATE INDEX /*i*/afl_rev_id ON /*_*/abuse_filter_log (afl_rev_id); \ No newline at end of file diff --git a/db_patches/patch-drop_afl_log_id.sql b/db_patches/patch-drop_afl_log_id.sql new file mode 100644 index 000000000..9dc7c24ca --- /dev/null +++ b/db_patches/patch-drop_afl_log_id.sql @@ -0,0 +1,2 @@ +ALTER TABLE /*_*/abuse_filter_log + DROP COLUMN afl_log_id; diff --git a/db_patches/patch-drop_afl_log_id.sqlite.sql b/db_patches/patch-drop_afl_log_id.sqlite.sql new file mode 100644 index 000000000..b5518dd49 --- /dev/null +++ b/db_patches/patch-drop_afl_log_id.sqlite.sql @@ -0,0 +1,44 @@ +-- This monster is just an `ALTER TABLE abuse_filter_log DROP COLUMN afl_log_id` + +BEGIN; + +DROP TABLE IF EXISTS /*_*/abuse_filter_log_tmp; +CREATE TABLE /*_*/abuse_filter_log_tmp ( + afl_id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + afl_filter varbinary(64) NOT NULL, + afl_user BIGINT unsigned NOT NULL, + afl_user_text varbinary(255) NOT NULL, + afl_ip varbinary(255) not null, + afl_action varbinary(255) not null, + afl_actions varbinary(255) not null, + afl_var_dump BLOB NOT NULL, + afl_timestamp varbinary(14) NOT NULL, + afl_namespace int NOT NULL, + afl_title varbinary(255) NOT NULL, + afl_wiki varbinary(64) NULL, + afl_deleted tinyint(1) NOT NULL DEFAULT 0, + afl_patrolled_by int unsigned NULL, + afl_rev_id int unsigned +) /*$wgDBTableOptions*/; + +INSERT INTO abuse_filter_log_tmp + + SELECT afl_id, afl_filter, afl_user, afl_user_text, afl_ip, afl_action, afl_actions, afl_var_dump, + afl_timestamp, afl_namespace, afl_title, afl_wiki, afl_deleted, afl_patrolled_by, afl_rev_id + + FROM /*_*/abuse_filter_log; + +DROP TABLE /*_*/abuse_filter_log; + +ALTER TABLE /*_*/abuse_filter_log_tmp RENAME TO /*_*/abuse_filter_log; + +CREATE INDEX /*i*/afl_filter_timestamp ON /*_*/abuse_filter_log (afl_filter,afl_timestamp); +CREATE INDEX /*i*/afl_user_timestamp ON /*_*/abuse_filter_log (afl_user,afl_user_text,afl_timestamp); +CREATE INDEX /*i*/afl_timestamp ON /*_*/abuse_filter_log (afl_timestamp); +CREATE INDEX /*i*/afl_page_timestamp ON /*_*/abuse_filter_log (afl_namespace, afl_title, afl_timestamp); +CREATE INDEX /*i*/afl_ip_timestamp ON /*_*/abuse_filter_log (afl_ip, afl_timestamp); +CREATE INDEX /*i*/afl_wiki_timestamp ON /*_*/abuse_filter_log (afl_wiki, afl_timestamp); +CREATE INDEX /*i*/afl_rev_id ON /*_*/abuse_filter_log (afl_rev_id); + + +COMMIT; \ No newline at end of file diff --git a/includes/AbuseFilterHooks.php b/includes/AbuseFilterHooks.php index caa818e2b..89d1eac23 100644 --- a/includes/AbuseFilterHooks.php +++ b/includes/AbuseFilterHooks.php @@ -585,8 +585,6 @@ class AbuseFilterHooks { 'addPgField', 'abuse_filter_log', 'afl_patrolled_by', 'INTEGER' ] ); $updater->addExtensionUpdate( [ 'addPgField', 'abuse_filter_log', 'afl_rev_id', 'INTEGER' ] ); - $updater->addExtensionUpdate( [ - 'addPgField', 'abuse_filter_log', 'afl_log_id', 'INTEGER' ] ); $updater->addExtensionUpdate( [ 'changeField', 'abuse_filter_log', 'afl_filter', 'TEXT', '' ] ); $updater->addExtensionUpdate( [ @@ -623,14 +621,12 @@ class AbuseFilterHooks { 'addPgExtIndex', 'abuse_filter_log', 'abuse_filter_log_rev_id', '(afl_rev_id)' ] ); - $updater->addExtensionUpdate( [ - 'addPgExtIndex', 'abuse_filter_log', 'abuse_filter_log_log_id', - '(afl_log_id)' - ] ); $updater->addExtensionUpdate( [ 'addPgExtIndex', 'abuse_filter_log', 'abuse_filter_log_wiki_timestamp', '(afl_wiki,afl_timestamp)' ] ); + $updater->addExtensionUpdate( [ + 'dropPgField', 'abuse_filter_log', 'afl_log_id' ] ); } $updater->addExtensionUpdate( [ [ __CLASS__, 'createAbuseFilterUser' ] ] ); diff --git a/includes/Views/AbuseFilterViewRevert.php b/includes/Views/AbuseFilterViewRevert.php index f4aadf6ee..bbc335c50 100644 --- a/includes/Views/AbuseFilterViewRevert.php +++ b/includes/Views/AbuseFilterViewRevert.php @@ -185,7 +185,6 @@ class AbuseFilterViewRevert extends AbuseFilterView { $conds[] = 'afl_timestamp <= ' . $dbr->addQuotes( $dbr->timestamp( $periodEnd ) ); } - // All but afl_filter, afl_ip, afl_deleted, afl_patrolled_by, afl_rev_id and afl_log_id $selectFields = [ 'afl_id', 'afl_user', diff --git a/includes/special/SpecialAbuseLog.php b/includes/special/SpecialAbuseLog.php index 448acf3b9..48a4dd328 100644 --- a/includes/special/SpecialAbuseLog.php +++ b/includes/special/SpecialAbuseLog.php @@ -507,10 +507,7 @@ class SpecialAbuseLog extends SpecialPage { } if ( in_array( $this->mSearchImpact, [ '1', '2' ] ) ) { - $unsuccessfulActionConds = $dbr->makeList( [ - 'afl_rev_id' => null, - 'afl_log_id' => null, - ], LIST_AND ); + $unsuccessfulActionConds = 'afl_rev_id IS NULL'; if ( $this->mSearchImpact === '1' ) { $conds[] = "NOT ( $unsuccessfulActionConds )"; } else {