r113582 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r113581‎ | r113582 | r113583 >
Date:18:59, 11 March 2012
Author:reedy
Status:deferred
Tags:
Comment:
Remove unused variables

Tidy up some older code
Modified paths:
  • /trunk/extensions/Sudo/SpecialSudo.php (modified) (history)
  • /trunk/extensions/Tasks/Tasks.hooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Sudo/SpecialSudo.php
@@ -27,14 +27,13 @@
2828 }
2929
3030 class SpecialSudo extends SpecialPage {
31 - protected $mode, $skin, $target, $reason, $errors;
 31+ protected $mode, $target, $reason, $errors;
3232
3333 /**
3434 * Constructor -- set up the new special page
3535 */
3636 public function __construct() {
3737 parent::__construct( 'Sudo', 'sudo' );
38 -
3938 }
4039
4140 /**
@@ -47,10 +46,12 @@
4847
4948 $this->mode = $wgRequest->getText( 'mode' );
5049 if( $this->mode == 'success' ) {
51 - return $this->showSuccessPage();
 50+ $this->showSuccessPage();
 51+ return;
5252 }
5353 if( $this->mode == 'unsudo' ) {
54 - return $this->showUnsudoPage();
 54+ $this->showUnsudoPage();
 55+ return;
5556 }
5657
5758 // Check that the user is allowed to access this special page...
@@ -74,7 +75,6 @@
7576 // Set page title and other stuff
7677 $this->setHeaders();
7778
78 - $this->skin = $wgUser->getSkin();
7979 $this->target = $wgRequest->getText( 'target', $par );
8080 $this->reason = $wgRequest->getText( 'reason', '' );
8181 $this->errors = array();
@@ -92,11 +92,10 @@
9393 $this->showError( 'sudo-error-nosudo' );
9494 } else {
9595 $this->setHeaders();
96 - $s = $wgUser->getSkin();
9796 $suUser = User::newFromId( $_SESSION['wsSudoId'] );
9897 $wgOut->addHTML( wfMsgExt( 'sudo-success', array( 'parse', 'replaceafter' ),
99 - $s->makeLinkObj( $suUser->getUserPage(), htmlspecialchars( $suUser->getName() ) ),
100 - $s->makeLinkObj( $wgUser->getUserPage(), htmlspecialchars( $wgUser->getName() ) ) )
 98+ Linker::makeLinkObj( $suUser->getUserPage(), htmlspecialchars( $suUser->getName() ) ),
 99+ Linker::makeLinkObj( $wgUser->getUserPage(), htmlspecialchars( $wgUser->getName() ) ) )
101100 );
102101 }
103102 }
@@ -115,7 +114,6 @@
116115 }
117116 $this->setHeaders();
118117 $wgOut->setPageTitle( wfMsg( 'unsudo' ) );
119 - $s = $wgUser->getSkin();
120118
121119 $wgOut->addHTML(
122120 Xml::openElement( 'form', array( 'method' => 'post',
@@ -124,8 +122,8 @@
125123 );
126124 $wgOut->addHTML(
127125 wfMsgExt( 'sudo-unsudo', array( 'parse', 'replaceafter' ),
128 - $s->makeLinkObj( $suUser->getUserPage(), htmlspecialchars( $suUser->getName() ) ),
129 - $s->makeLinkObj( $wgUser->getUserPage(), htmlspecialchars( $wgUser->getName() ) )
 126+ Linker::makeLinkObj( $suUser->getUserPage(), htmlspecialchars( $suUser->getName() ) ),
 127+ Linker::makeLinkObj( $wgUser->getUserPage(), htmlspecialchars( $wgUser->getName() ) )
130128 ) .
131129 Xml::submitButton( wfMsg( 'sudo-unsudo-submit' ) ) .
132130 Xml::closeElement( 'form' )
@@ -151,7 +149,6 @@
152150
153151 function addError( $error = '' ) {
154152 $this->errors[] = $error;
155 - return;
156153 }
157154
158155 function showError( $error ) {
@@ -172,22 +169,25 @@
173170
174171 $u = User::newFromName( $this->target );
175172 if( is_null( $u ) ) {
176 - return $this->addError( 'sudo-error-sudo-invaliduser' );
 173+ $this->addError( 'sudo-error-sudo-invaliduser' );
 174+ return;
177175 }
178176 if( User::isIP( $u->getName() ) ) {
179 - return $this->addError( 'sudo-error-ip' );
 177+ $this->addError( 'sudo-error-ip' );
 178+ return;
180179 }
181180 if( $u->isAnon() ) {
182 - return $this->addError( 'sudo-error-sudo-nonexistent' );
 181+ $this->addError( 'sudo-error-sudo-nonexistent' );
 182+ return;
183183 }
184184 if( $u->getName() === $wgUser->getName() ) {
185 - return $this->addError( 'sudo-error-sudo-self' );
 185+ $this->addError( 'sudo-error-sudo-self' );
 186+ return;
186187 }
187188
188 - $s = $wgUser->getSkin();
189189 $log = new LogPage( 'sudo' );
190190 $log->addEntry( 'sudo', $wgUser->getUserPage(), $this->reason,
191 - array( $s->makeLinkObj( $u->getUserPage(), $u->getName() ) ) );
 191+ array( Linker::makeLinkObj( $u->getUserPage(), $u->getName() ) ) );
192192
193193 if( !isset( $_SESSION['wsSudoId'] ) || $_SESSION['wsSudoId'] < 0 ) {
194194 $_SESSION['wsSudoId'] = $wgUser->getId();
Index: trunk/extensions/Tasks/Tasks.hooks.php
@@ -236,7 +236,6 @@
237237 $st->change_task_status( $task->task_id, MW_TASK_CLOSED );
238238 $st->set_new_article_id( $t );
239239
240 - $id = $t->getArticleId();
241240 # Nothing more to do
242241 break;
243242 }

Status & tagging log