r99328 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r99327‎ | r99328 | r99329 >
Date:23:41, 8 October 2011
Author:aaron
Status:deferred
Tags:
Comment:
Cleaned up RequestAccountPage::execute() and fixed "Catchable fatal error: Argument 1 passed to UserBlockedError::__construct() must be an instance of Block, null given"
Modified paths:
  • /trunk/extensions/ConfirmAccount/presentation/specialpages/actions/RequestAccount_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ConfirmAccount/presentation/specialpages/actions/RequestAccount_body.php
@@ -15,21 +15,20 @@
1616 }
1717
1818 function execute( $par ) {
19 - global $wgUseRealNamesOnly,
20 - $wgAccountRequestToS, $wgAccountRequestExtraInfo, $wgAccountRequestTypes;
21 - # If a user cannot make accounts, don't let them request them either
22 - global $wgAccountRequestWhileBlocked;
 19+ global $wgUseRealNamesOnly, $wgAccountRequestToS, $wgAccountRequestExtraInfo;
 20+ global $wgAccountRequestTypes, $wgAccountRequestWhileBlocked;
2321
2422 $reqUser = $this->getUser();
2523 $request = $this->getRequest();
26 - $out = $this->getOutput();
27 - if ( !$wgAccountRequestWhileBlocked && $reqUser->isBlockedFromCreateAccount() ) {
28 - $out->blockedPage();
29 - return;
 24+
 25+ # If a user cannot make accounts, don't let them request them either
 26+ if ( !$wgAccountRequestWhileBlocked ) {
 27+ if ( ( $block = $reqUser->isBlockedFromCreateAccount() ) ) {
 28+ throw new UserBlockedError( $block );
 29+ }
3030 }
3131 if ( wfReadOnly() ) {
32 - $out->readOnlyPage();
33 - return;
 32+ throw new ReadOnlyError();
3433 }
3534
3635 $this->setHeaders();
@@ -52,7 +51,8 @@
5352 $this->mToS = $wgAccountRequestToS ?
5453 $request->getBool( 'wpToS' ) : false;
5554 $this->mType = $request->getInt( 'wpType' );
56 - $this->mType = isset( $wgAccountRequestTypes[$this->mType] ) ? $this->mType : 0;
 55+ $this->mType = isset( $wgAccountRequestTypes[$this->mType] ) ?
 56+ $this->mType : 0;
5757 # Load areas user plans to be active in...
5858 $this->mAreas = $this->mAreaSet = array();
5959 foreach ( ConfirmAccount::getUserAreaConfig() as $name => $conf ) {
@@ -75,7 +75,8 @@
7676 } else {
7777 $this->showForm();
7878 }
79 - $out->addModules( 'ext.confirmAccount' ); // CSS
 79+
 80+ $this->getOutput()->addModules( 'ext.confirmAccount' ); // CSS
8081 }
8182
8283 protected function showForm( $msg = '', $forgotFile = 0 ) {

Status & tagging log