MtDu has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/329725 )
Change subject: Add 'UnblockUser' and 'UnblockUserComplete' hooks to Special:Unblock ...................................................................... Add 'UnblockUser' and 'UnblockUserComplete' hooks to Special:Unblock Currently, there are two hooks ('BlockIP' and 'BlockIPComplete') that run when a user or IP is blocked in Special:Block, but no similar hooks when a user is unblocked in Special:Unblock. Adding these two hooks allows an extension to add and remove criteria about a user/IP unblock before it occurs and for possible action after an unblock is completed. Bug: T50546 Change-Id: I9d9888dc5f1bb6a8bc62e90e6a423bf56b05173b --- M docs/hooks.txt M includes/specials/SpecialUnblock.php 2 files changed, 16 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/25/329725/1 diff --git a/docs/hooks.txt b/docs/hooks.txt index b165285..b6d37e0 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -3379,6 +3379,15 @@ $title: Title object to purge &$urls: An array of URLs to purge from the caches, to be manipulated. +'UnblockUser': Before an IP address or user is unblocked. +&$block: The Block object about to be saved +&$user: The user performing the unblock (not the one being unblocked) +&$reason: If the hook is aborted, the error message to be returned in an array + +'UnblockUserComplete': After an IP address or user has been unblocked. +$block: The Block object that was saved +$user: The user who performed the unblock (not the one being unblocked) + 'UndeleteForm::showHistory': Called in UndeleteForm::showHistory, after a PageArchive object has been created but before any further processing is done. &$archive: PageArchive object diff --git a/includes/specials/SpecialUnblock.php b/includes/specials/SpecialUnblock.php index 4e683f6..0d42e3f 100644 --- a/includes/specials/SpecialUnblock.php +++ b/includes/specials/SpecialUnblock.php @@ -209,11 +209,18 @@ return [ 'unblock-hideuser' ]; } + $reason = [ 'hookaborted' ]; + if ( !Hooks::run( 'UnblockUser', [ &$block, &$performer, &$reason ] ) ) { + return $reason; + } + # Delete block if ( !$block->delete() ) { return [ [ 'ipb_cant_unblock', htmlspecialchars( $block->getTarget() ) ] ]; } + Hooks::run( 'UnblockUserComplete', [ $block, $performer ] ); + # Unset _deleted fields as needed if ( $block->mHideName ) { # Something is deeply FUBAR if this is not a User object, but who knows? -- To view, visit https://gerrit.wikimedia.org/r/329725 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9d9888dc5f1bb6a8bc62e90e6a423bf56b05173b Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: MtDu <justin.d...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits