r94191 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94190‎ | r94191 | r94192 >
Date:19:34, 10 August 2011
Author:ialex
Status:ok
Tags:
Comment:
* Use local context instead of global variables
* Call Linker methods statically
Modified paths:
  • /trunk/phase3/includes/specials/SpecialUnblock.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialUnblock.php
@@ -35,10 +35,8 @@
3636 }
3737
3838 public function execute( $par ){
39 - global $wgUser, $wgOut, $wgRequest;
40 -
4139 # Check permissions
42 - if( !$this->userCanExecute( $wgUser ) ) {
 40+ if( !$this->userCanExecute( $this->getUser() ) ) {
4341 $this->displayRestrictionError();
4442 return;
4543 }
@@ -48,11 +46,12 @@
4947 throw new ReadOnlyError;
5048 }
5149
52 - list( $this->target, $this->type ) = SpecialBlock::getTargetAndType( $par, $wgRequest );
 50+ list( $this->target, $this->type ) = SpecialBlock::getTargetAndType( $par, $this->getRequest() );
5351 $this->block = Block::newFromTarget( $this->target );
5452
55 - $wgOut->setPageTitle( wfMsg( 'unblockip' ) );
56 - $wgOut->addModules( 'mediawiki.special' );
 53+ $out = $this->getOutput();
 54+ $out->setPageTitle( wfMsg( 'unblockip' ) );
 55+ $out->addModules( 'mediawiki.special' );
5756
5857 $form = new HTMLForm( $this->getFields(), $this->getContext() );
5958 $form->setWrapperLegend( wfMsg( 'unblockip' ) );
@@ -64,14 +63,14 @@
6564 switch( $this->type ){
6665 case Block::TYPE_USER:
6766 case Block::TYPE_IP:
68 - $wgOut->addWikiMsg( 'unblocked', $this->target );
 67+ $out->addWikiMsg( 'unblocked', $this->target );
6968 break;
7069 case Block::TYPE_RANGE:
71 - $wgOut->addWikiMsg( 'unblocked-range', $this->target );
 70+ $out->addWikiMsg( 'unblocked-range', $this->target );
7271 break;
7372 case Block::TYPE_ID:
7473 case Block::TYPE_AUTO:
75 - $wgOut->addWikiMsg( 'unblocked-id', $this->target );
 74+ $out->addWikiMsg( 'unblocked-id', $this->target );
7675 break;
7776 }
7877 }
@@ -113,8 +112,7 @@
114113 switch( $type ){
115114 case Block::TYPE_USER:
116115 case Block::TYPE_IP:
117 - $skin = $this->getSkin();
118 - $fields['Name']['default'] = $skin->link(
 116+ $fields['Name']['default'] = Linker::link(
119117 $target->getUserPage(),
120118 $target->getName()
121119 );

Status & tagging log