Fix unblocking autoblocks
[lhc/web/wiklou.git] / includes / specials / SpecialUnblock.php
index 4e683f6..0da9b7a 100644 (file)
@@ -59,7 +59,7 @@ class SpecialUnblock extends SpecialPage {
                $out->setPageTitle( $this->msg( 'unblockip' ) );
                $out->addModules( [ 'mediawiki.special', 'mediawiki.userSuggest' ] );
 
-               $form = new HTMLForm( $this->getFields(), $this->getContext() );
+               $form = HTMLForm::factory( 'ooui', $this->getFields(), $this->getContext() );
                $form->setWrapperLegendMsg( 'unblockip' );
                $form->setSubmitCallback( [ __CLASS__, 'processUIUnblock' ] );
                $form->setSubmitTextMsg( 'ipusubmit' );
@@ -186,7 +186,7 @@ class SpecialUnblock extends SpecialPage {
                        return [ [ 'ipb_cant_unblock', $target ] ];
                }
 
-               # bug 15810: blocked admins should have limited access here.  This
+               # T17810: blocked admins should have limited access here.  This
                # won't allow sysops to remove autoblocks on themselves, but they
                # should have ipblock-exempt anyway
                $status = SpecialBlock::checkUnblockSelf( $target, $performer );
@@ -209,11 +209,18 @@ class SpecialUnblock extends SpecialPage {
                        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?