Merge "Allow extensions to set a custom error message in the BlockIp hook"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Mon, 20 Jan 2014 15:22:03 +0000 (15:22 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 20 Jan 2014 15:22:03 +0000 (15:22 +0000)
docs/hooks.txt
includes/specials/SpecialBlock.php

index b617430..51cf65c 100644 (file)
@@ -772,6 +772,7 @@ $block: Block object (which is set to be autoblocking)
 'BlockIp': Before an IP address or user is blocked.
 $block: the Block object about to be saved
 $user: the user _doing_ the block (not the one being blocked)
+&$reason: if the hook is aborted, the error message to be returned in an array
 
 'BlockIpComplete': After an IP address or user is blocked.
 $block: the Block object that was saved
index 3780660..d2ee0df 100644 (file)
@@ -694,8 +694,9 @@ class SpecialBlock extends FormSpecialPage {
                $block->isAutoblocking( $data['AutoBlock'] );
                $block->mHideName = $data['HideUser'];
 
-               if ( !wfRunHooks( 'BlockIp', array( &$block, &$performer ) ) ) {
-                       return array( 'hookaborted' );
+               $reason = array( 'hookaborted' );
+               if ( !wfRunHooks( 'BlockIp', array( &$block, &$performer, &$reason ) ) ) {
+                       return $reason;
                }
 
                # Try to insert block. Is there a conflicting block?