Move onUserMergeAccountFields to its own file

Sharing a handler class with UserRenameHandler means that attempting to
merge users fails due to a missing interface if AbuseFilter and MergeUser
are installed but Renameuser is not installed.

Change-Id: I1244ab1c446840ff2648248f943d7fc784b889a7
This commit is contained in:
Tim Starling 2021-05-06 11:23:03 +10:00
parent 8780749798
commit 2c939e28a9
3 changed files with 20 additions and 13 deletions

View file

@ -329,7 +329,7 @@
"UploadStashFile": "MediaWiki\\Extension\\AbuseFilter\\AbuseFilterHooks::onUploadStashFile",
"PageSaveComplete": "PageSave",
"RenameUserSQL": "UserRename",
"UserMergeAccountFields": "MediaWiki\\Extension\\AbuseFilter\\Hooks\\Handlers\\UserRenameHandler::onUserMergeAccountFields",
"UserMergeAccountFields": "MediaWiki\\Extension\\AbuseFilter\\Hooks\\Handlers\\UserMergeHandler::onUserMergeAccountFields",
"BeforeCreateEchoEvent": "MediaWiki\\Extension\\AbuseFilter\\Hooks\\Handlers\\EchoHandler::onBeforeCreateEchoEvent",
"ParserOutputStashForEdit": "MediaWiki\\Extension\\AbuseFilter\\AbuseFilterHooks::onParserOutputStashForEdit",
"UnitTestsAfterDatabaseSetup": "Tests",

View file

@ -0,0 +1,19 @@
<?php
namespace MediaWiki\Extension\AbuseFilter\Hooks\Handlers;
class UserMergeHandler {
/**
* Tables that Extension:UserMerge needs to update
* @todo Use new hook system once UserMerge is updated
*
* @param array &$updateFields
*/
public static function onUserMergeAccountFields( array &$updateFields ) {
$updateFields[] = [ 'abuse_filter', 'af_user', 'af_user_text' ];
$updateFields[] = [ 'abuse_filter_log', 'afl_user', 'afl_user_text' ];
$updateFields[] = [ 'abuse_filter_history', 'afh_user', 'afh_user_text' ];
}
}

View file

@ -25,16 +25,4 @@ class UserRenameHandler implements RenameUserSQLHook {
];
}
/**
* Tables that Extension:UserMerge needs to update
* @todo Use new hook system once UserMerge is updated
*
* @param array &$updateFields
*/
public static function onUserMergeAccountFields( array &$updateFields ) {
$updateFields[] = [ 'abuse_filter', 'af_user', 'af_user_text' ];
$updateFields[] = [ 'abuse_filter_log', 'afl_user', 'afl_user_text' ];
$updateFields[] = [ 'abuse_filter_history', 'afh_user', 'afh_user_text' ];
}
}