r108108 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108107‎ | r108108 | r108109 >
Date:01:39, 5 January 2012
Author:reedy
Status:ok
Tags:
Comment:
Update deprecated code

Add documentation

Remove unused globals
Modified paths:
  • /trunk/extensions/CentralAuth/ApiQueryGlobalUserInfo.php (modified) (history)
  • /trunk/extensions/CentralAuth/CentralAuthUser.php (modified) (history)
  • /trunk/extensions/CentralAuth/specials/SpecialCentralAuth.php (modified) (history)
  • /trunk/extensions/CentralAuth/specials/SpecialGlobalGroupMembership.php (modified) (history)
  • /trunk/extensions/CentralAuth/specials/SpecialGlobalGroupPermissions.php (modified) (history)
  • /trunk/extensions/CentralAuth/specials/SpecialMergeAccount.php (modified) (history)
  • /trunk/extensions/CentralAuth/specials/SpecialWikiSets.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CentralAuth/ApiQueryGlobalUserInfo.php
@@ -87,7 +87,7 @@
8888 );
8989 if ( $account['blocked'] ) {
9090 $a['blocked'] = array(
91 - 'expiry' => Block::decodeExpiry( $account['block-expiry'], TS_ISO_8601 ),
 91+ 'expiry' => $this->getLanguage()->formatExpiry( $account['block-expiry'], TS_ISO_8601 ),
9292 'reason' => $account['block-reason']
9393 );
9494 }
@@ -104,7 +104,7 @@
105105 );
106106 if ( $account['blocked'] ) {
107107 $a['blocked'] = array(
108 - 'expiry' => Block::decodeExpiry( $account['block-expiry'], TS_ISO_8601 ),
 108+ 'expiry' => $this->getLanguage()->formatExpiry( $account['block-expiry'], TS_ISO_8601 ),
109109 'reason' => $account['block-reason']
110110 );
111111 }
Index: trunk/extensions/CentralAuth/CentralAuthUser.php
@@ -48,6 +48,9 @@
4949 const HIDDEN_LISTS = 'lists';
5050 const HIDDEN_OVERSIGHT = 'suppressed';
5151
 52+ /**
 53+ * @param $username string
 54+ */
5255 function __construct( $username ) {
5356 $this->mName = $username;
5457 $this->resetState();
@@ -1167,7 +1170,7 @@
11681171 /* $reason */ $blockReason,
11691172 /* $timestamp */ wfTimestampNow(),
11701173 /* $auto */ false,
1171 - /* $expiry */ Block::infinity(),
 1174+ /* $expiry */ $dbw->getInfinity(),
11721175 /* anonOnly */ false,
11731176 /* $createAccount */ true,
11741177 /* $enableAutoblock */ true,
Index: trunk/extensions/CentralAuth/specials/SpecialGlobalGroupMembership.php
@@ -103,7 +103,7 @@
104104
105105 /**
106106 * @param $user User
107 - * @param $output
 107+ * @param $output OutputPage
108108 */
109109 protected function showLogFragment( $user, $output ) {
110110 $pageTitle = Title::makeTitleSafe( NS_USER, $user->getName() );
Index: trunk/extensions/CentralAuth/specials/SpecialGlobalGroupPermissions.php
@@ -123,7 +123,7 @@
124124 if ( $editable ) {
125125 $html .= Xml::openElement( 'form', array( 'method' => 'post', 'action' => SpecialPage::getTitleFor( 'GlobalGroupPermissions', $group )->getLocalUrl(), 'name' => 'centralauth-globalgroups-newgroup' ) );
126126 $html .= Html::hidden( 'wpGroup', $group );
127 - $html .= Html::hidden( 'wpEditToken', $this->getUser()->editToken() );
 127+ $html .= Html::hidden( 'wpEditToken', $this->getUser()->getEditToken() );
128128 }
129129
130130 $fields = array();
@@ -323,7 +323,7 @@
324324
325325 /**
326326 * @param $group
327 - * @param $output
 327+ * @param $output OutputPage
328328 */
329329 protected function showLogFragment( $group, $output ) {
330330 $title = SpecialPage::getTitleFor( 'GlobalUsers', $group );
Index: trunk/extensions/CentralAuth/specials/SpecialCentralAuth.php
@@ -328,7 +328,7 @@
329329 $this->getTitle( $this->mUserName )->getLocalUrl( 'action=submit' ),
330330 'id' => 'mw-centralauth-merged' ) ) .
331331 Html::hidden( 'wpMethod', 'unmerge' ) .
332 - Html::hidden( 'wpEditToken', $this->getUser()->editToken() ) .
 332+ Html::hidden( 'wpEditToken', $this->getUser()->getEditToken() ) .
333333 Xml::openElement( 'table', array( 'class' => 'wikitable sortable mw-centralauth-wikislist' ) ) . "\n" .
334334 '<thead><tr>' .
335335 ( $this->mCanUnmerge ? '<th></th>' : '' ) .
@@ -570,7 +570,7 @@
571571 'action' => $this->getTitle()->getFullUrl( 'target=' . urlencode( $this->mUserName ) ),
572572 'id' => "mw-centralauth-$action" ) ) .
573573 Html::hidden( 'wpMethod', $action ) .
574 - Html::hidden( 'wpEditToken', $this->getUser()->editToken() ) .
 574+ Html::hidden( 'wpEditToken', $this->getUser()->getEditToken() ) .
575575 wfMsgExt( "centralauth-admin-{$action}-description", 'parse' ) .
576576 Xml::buildForm(
577577 array( 'centralauth-admin-reason' => Xml::input( 'reason',
@@ -585,7 +585,7 @@
586586 $form = '';
587587 $form .= Xml::fieldset( wfMsg( 'centralauth-admin-status' ) );
588588 $form .= Html::hidden( 'wpMethod', 'set-status' );
589 - $form .= Html::hidden( 'wpEditToken', $this->getUser()->editToken() );
 589+ $form .= Html::hidden( 'wpEditToken', $this->getUser()->getEditToken() );
590590 $form .= wfMsgExt( 'centralauth-admin-status-intro', 'parse' );
591591
592592 // Radio buttons
Index: trunk/extensions/CentralAuth/specials/SpecialMergeAccount.php
@@ -94,7 +94,6 @@
9595 * data, so they won't be found floating in the same place.
9696 */
9797 private function initSession() {
98 - global $wgUser;
9998 $this->mSessionToken = $this->getUser()->generateToken();
10099
101100 // Generate a random binary string
@@ -219,7 +218,7 @@
220219 }
221220
222221 function doInitialMerge() {
223 - global $wgUser, $wgCentralAuthDryRun;
 222+ global $wgCentralAuthDryRun;
224223 $globalUser = new CentralAuthUser( $this->getUser()->getName() );
225224
226225 if ( $wgCentralAuthDryRun ) {
@@ -326,7 +325,6 @@
327326 }
328327
329328 function showCleanupForm() {
330 - global $wgUser;
331329 $globalUser = new CentralAuthUser( $this->getUser()->getName() );
332330
333331 $merged = $globalUser->listAttached();
@@ -467,7 +465,6 @@
468466 * @return string
469467 */
470468 private function actionForm( $action, $title, $text ) {
471 - global $wgUser;
472469 return
473470 '<div id="userloginForm">' .
474471 Xml::openElement( 'form',
@@ -475,7 +472,7 @@
476473 'method' => 'post',
477474 'action' => $this->getTitle()->getLocalUrl( 'action=submit' ) ) ) .
478475 Xml::element( 'h2', array(), $title ) .
479 - Html::hidden( 'wpEditToken', $this->getUser()->editToken() ) .
 476+ Html::hidden( 'wpEditToken', $this->getUser()->getEditToken() ) .
480477 Html::hidden( 'wpMergeAction', $action ) .
481478 Html::hidden( 'wpMergeSessionToken', $this->mSessionToken ) .
482479 Html::hidden( 'wpMergeSessionKey', bin2hex( $this->mSessionKey ) ) .
@@ -542,7 +539,6 @@
543540 * @return string
544541 */
545542 private function step2PasswordForm( $unattached ) {
546 - global $wgUser;
547543 return $this->passwordForm(
548544 'dryrun',
549545 wfMsg( 'centralauth-merge-step2-title' ),
@@ -558,7 +554,6 @@
559555 * @return string
560556 */
561557 private function step3ActionForm( $home, $attached, $methods ) {
562 - global $wgUser;
563558 return $this->actionForm(
564559 'initial',
565560 wfMsg( 'centralauth-merge-step3-title' ),
Index: trunk/extensions/CentralAuth/specials/SpecialWikiSets.php
@@ -167,7 +167,7 @@
168168
169169 $this->getOutput()->addHTML( Xml::buildForm( $form, 'centralauth-editset-submit' ) );
170170
171 - $edittoken = Html::hidden( 'wpEditToken', $this->getUser()->editToken() );
 171+ $edittoken = Html::hidden( 'wpEditToken', $this->getUser()->getEditToken() );
172172 $this->getOutput()->addHTML( "<p>{$edittoken}</p></form></fieldset>" );
173173 } else {
174174 $form = array();
@@ -220,7 +220,7 @@
221221 $i++;
222222 }
223223 $body = '';
224 - foreach( $splitLists as $column => $splitList ) {
 224+ foreach( $splitLists as $splitList ) {
225225 $body .= '<td width="' . round( 100 / $columns ) . '%"><ul>';
226226 foreach( $splitList as $listitem ) {
227227 $body .= Html::element( 'li', array(), $listitem );
@@ -250,7 +250,7 @@
251251 $legend = wfMsgHtml( 'centralauth-editset-legend-delete', $set->getName() );
252252 $form = array( 'centralauth-editset-reason' => Xml::input( 'wpReason' ) );
253253 $url = htmlspecialchars( SpecialPage::getTitleFor( 'WikiSets', "delete/{$subpage}" )->getLocalUrl() );
254 - $edittoken = Html::hidden( 'wpEditToken', $this->getUser()->editToken() );
 254+ $edittoken = Html::hidden( 'wpEditToken', $this->getUser()->getEditToken() );
255255
256256 $this->getOutput()->addHTML( "<fieldset><legend>{$legend}</legend><form action='{$url}' method='post'>" );
257257 $this->getOutput()->addHTML( Xml::buildForm( $form, 'centralauth-editset-submit-delete' ) );

Status & tagging log