mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-23 21:53:35 +00:00
Actually apply patch-afl_change_deleted_patrolled.
This fixes the abuse_filter_log patch-afl_change_deleted_patrolled not being applied. The patch is provided for (and should work with) all the supported DBMS. Additionally, fix the base table files, which would report afl_patrolled_by as 'NULL', whereas on the WMF cluster it's 'NOT NULL DEFAULT 0'. The schema patch takes care of converting that column as well. Note that this schema change needs not be applied on the WMF cluster, as that's already up-to-date. Finally, note that this patch must be backported to 1.33 and 1.34 (and it might be fairly hard due to the recent schema changes on the abuse_filter_log table). Bug: T240895 Change-Id: Ibdbc9b50c25b9e871ebdeae93a54d10877b585f8
This commit is contained in:
parent
40c7ca43cb
commit
5ca3eac9aa
|
@ -48,7 +48,7 @@ CREATE TABLE abuse_filter_log (
|
|||
afl_title TEXT NOT NULL,
|
||||
afl_wiki TEXT NULL,
|
||||
afl_deleted SMALLINT NOT NULL DEFAULT 0,
|
||||
afl_patrolled_by INTEGER NULL,
|
||||
afl_patrolled_by INTEGER NOT NULL DEFAULT 0,
|
||||
afl_rev_id INTEGER NULL,
|
||||
afl_global SMALLINT NOT NULL DEFAULT 0,
|
||||
afl_filter_id INTEGER NOT NULL DEFAULT 0
|
||||
|
|
|
@ -47,7 +47,7 @@ CREATE TABLE /*$wgDBprefix*/abuse_filter_log (
|
|||
afl_title varchar(255) binary NOT NULL,
|
||||
afl_wiki varchar(64) binary NULL,
|
||||
afl_deleted tinyint(1) NOT NULL DEFAULT 0,
|
||||
afl_patrolled_by int unsigned NULL,
|
||||
afl_patrolled_by int unsigned NOT NULL DEFAULT 0,
|
||||
afl_rev_id int unsigned,
|
||||
|
||||
PRIMARY KEY (afl_id),
|
||||
|
|
|
@ -45,7 +45,7 @@ CREATE TABLE /*$wgDBprefix*/abuse_filter_log (
|
|||
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_patrolled_by int unsigned NOT NULL DEFAULT 0,
|
||||
afl_rev_id int unsigned
|
||||
) /*$wgDBTableOptions*/;
|
||||
CREATE INDEX afl_filter_timestamp ON /*$wgDBprefix*/abuse_filter_log (afl_filter,afl_timestamp);
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
UPDATE /*_*/abuse_filter_log SET afl_deleted = 0 WHERE afl_deleted IS NULL;
|
||||
UPDATE /*_*/abuse_filter_log SET afl_patrolled_by = 0 WHERE afl_patrolled_by IS NULL;
|
||||
ALTER TABLE /*_*/abuse_filter_log MODIFY afl_deleted tinyint(1) NOT NULL DEFAULT 0;
|
||||
ALTER TABLE /*_*/abuse_filter_log MODIFY afl_patrolled_by int unsigned NOT NULL DEFAULT 0;
|
||||
|
||||
ALTER TABLE /*_*/abuse_filter_log MODIFY afl_patrolled_by int unsigned NOT NULL DEFAULT 0;
|
48
db_patches/patch-afl_change_deleted_patrolled.sqlite.sql
Normal file
48
db_patches/patch-afl_change_deleted_patrolled.sqlite.sql
Normal file
|
@ -0,0 +1,48 @@
|
|||
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 DEFAULT '',
|
||||
afl_global tinyint(1) NOT NULL DEFAULT 0,
|
||||
afl_filter_id INTEGER NOT NULL DEFAULT 0,
|
||||
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 NOT NULL DEFAULT 0,
|
||||
afl_rev_id int unsigned
|
||||
) /*$wgDBTableOptions*/;
|
||||
|
||||
INSERT INTO abuse_filter_log_tmp
|
||||
|
||||
SELECT afl_id, afl_filter, afl_global, afl_filter_id, afl_user, afl_user_text, afl_ip, afl_action,
|
||||
afl_actions, afl_var_dump, afl_timestamp, afl_namespace, afl_title, afl_wiki,
|
||||
IFNULL(afl_deleted, 0),
|
||||
IFNULL(afl_patrolled_by, 0),
|
||||
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_filter_timestamp_full ON /*_*/abuse_filter_log (afl_global,afl_filter_id,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;
|
|
@ -542,6 +542,13 @@ class AbuseFilterHooks {
|
|||
"$dir/db_patches/patch-split-afl_filter.sqlite.sql", true
|
||||
] );
|
||||
}
|
||||
if ( $updater->getDB()->getType() == 'mysql' ) {
|
||||
$updater->addExtensionUpdate( [ 'modifyField', 'abuse_filter_log', 'afl_patrolled_by',
|
||||
"$dir/db_patches/patch-afl_change_deleted_patrolled.sql", true ] );
|
||||
} else {
|
||||
$updater->addExtensionUpdate( [ 'modifyField', 'abuse_filter_log', 'afl_patrolled_by',
|
||||
"$dir/db_patches/patch-afl_change_deleted_patrolled.sqlite.sql", true ] );
|
||||
}
|
||||
} elseif ( $updater->getDB()->getType() === 'postgres' ) {
|
||||
$updater->addExtensionUpdate( [
|
||||
'addTable', 'abuse_filter', "$dir/abusefilter.tables.pg.sql", true ] );
|
||||
|
@ -627,6 +634,12 @@ class AbuseFilterHooks {
|
|||
$updater->addExtensionUpdate( [
|
||||
'addPgIndex', 'abuse_filter_log', 'abuse_filter_log_filter_timestamp_full',
|
||||
'(afl_global, afl_filter_id, afl_timestamp)' ] );
|
||||
$updater->addExtensionUpdate( [ 'setDefault', 'abuse_filter_log', 'afl_deleted', 0 ] );
|
||||
$updater->addExtensionUpdate( [
|
||||
'changeNullableField', 'abuse_filter_log', 'afl_deleted', 'NOT NULL', true ] );
|
||||
$updater->addExtensionUpdate( [ 'setDefault', 'abuse_filter_log', 'afl_patrolled_by', 0 ] );
|
||||
$updater->addExtensionUpdate( [
|
||||
'changeNullableField', 'abuse_filter_log', 'afl_patrolled_by', 'NOT NULL', true ] );
|
||||
}
|
||||
|
||||
$updater->addExtensionUpdate( [ [ __CLASS__, 'createAbuseFilterUser' ] ] );
|
||||
|
|
Loading…
Reference in a new issue