r103294 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r103293‎ | r103294 | r103295 >
Date:04:37, 16 November 2011
Author:johnduhart
Status:resolved
Tags:
Comment:
Following r100264, update usages in core
Modified paths:
  • /trunk/phase3/includes/Article.php (modified) (history)
  • /trunk/phase3/includes/EditPage.php (modified) (history)
  • /trunk/phase3/includes/FileDeleteForm.php (modified) (history)
  • /trunk/phase3/includes/HTMLForm.php (modified) (history)
  • /trunk/phase3/includes/ImagePage.php (modified) (history)
  • /trunk/phase3/includes/Linker.php (modified) (history)
  • /trunk/phase3/includes/User.php (modified) (history)
  • /trunk/phase3/includes/actions/WatchAction.php (modified) (history)
  • /trunk/phase3/includes/diff/DifferenceEngine.php (modified) (history)
  • /trunk/phase3/includes/resourceloader/ResourceLoaderUserTokensModule.php (modified) (history)
  • /trunk/phase3/includes/revisiondelete/RevisionDelete.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialChangeEmail.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialChangePassword.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialConfirmemail.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialImport.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialMergeHistory.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialMovepage.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialRevisiondelete.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialUndelete.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialUserrights.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/User.php
@@ -3199,7 +3199,7 @@
32003200 * @param $request WebRequest object to use or null to use $wgRequest
32013201 * @return String The new edit token
32023202 */
3203 - public function editToken( $salt = '', $request = null ) {
 3203+ public function editToken( $salt = '', $request = null ) {
32043204 return $this->getEditToken( $salt, $request );
32053205 }
32063206
@@ -3258,7 +3258,7 @@
32593259 * @return Boolean: Whether the token matches
32603260 */
32613261 public function matchEditToken( $val, $salt = '', $request = null ) {
3262 - $sessionToken = $this->editToken( $salt, $request );
 3262+ $sessionToken = $this->getEditToken( $salt, $request );
32633263 if ( $val != $sessionToken ) {
32643264 wfDebug( "User::matchEditToken: broken session data\n" );
32653265 }
@@ -3275,7 +3275,7 @@
32763276 * @return Boolean: Whether the token matches
32773277 */
32783278 public function matchEditTokenNoSuffix( $val, $salt = '', $request = null ) {
3279 - $sessionToken = $this->editToken( $salt, $request );
 3279+ $sessionToken = $this->getEditToken( $salt, $request );
32803280 return substr( $sessionToken, 0, 32 ) == substr( $val, 0, 32 );
32813281 }
32823282
Index: trunk/phase3/includes/diff/DifferenceEngine.php
@@ -435,7 +435,7 @@
436436 // Build the link
437437 if ( $rcid ) {
438438 $this->getOutput()->preventClickjacking();
439 - $token = $this->getUser()->editToken( $rcid );
 439+ $token = $this->getUser()->getEditToken( $rcid );
440440 $this->mMarkPatrolledLink = ' <span class="patrollink">[' . Linker::linkKnown(
441441 $this->mNewPage,
442442 $this->msg( 'markaspatrolleddiff' )->escaped(),
Index: trunk/phase3/includes/Article.php
@@ -873,7 +873,7 @@
874874 return;
875875 }
876876
877 - $token = $wgUser->editToken( $rcid );
 877+ $token = $wgUser->getEditToken( $rcid );
878878 $wgOut->preventClickjacking();
879879
880880 $wgOut->addHTML(
@@ -1287,7 +1287,7 @@
12881288
12891289 if ( $this->getContext()->getUser()->isAllowed( 'trackback' ) ) {
12901290 $delurl = $this->getTitle()->getFullURL( "action=deletetrackback&tbid=" .
1291 - $o->tb_id . "&token=" . urlencode( $this->getContext()->getUser()->editToken() ) );
 1291+ $o->tb_id . "&token=" . urlencode( $this->getContext()->getUser()->getEditToken() ) );
12921292 $rmvtxt = wfMsg( 'trackbackremove', htmlspecialchars( $delurl ) );
12931293 }
12941294
@@ -1524,7 +1524,7 @@
15251525 </tr>" .
15261526 Xml::closeElement( 'table' ) .
15271527 Xml::closeElement( 'fieldset' ) .
1528 - Html::hidden( 'wpEditToken', $user->editToken( array( 'delete', $this->getTitle()->getPrefixedText() ) ) ) .
 1528+ Html::hidden( 'wpEditToken', $user->getEditToken( array( 'delete', $this->getTitle()->getPrefixedText() ) ) ) .
15291529 Xml::closeElement( 'form' );
15301530
15311531 if ( $user->isAllowed( 'editinterface' ) ) {
Index: trunk/phase3/includes/ImagePage.php
@@ -988,7 +988,7 @@
989989 array(
990990 'action' => 'revert',
991991 'oldimage' => $img,
992 - 'wpEditToken' => $wgUser->editToken( $img )
 992+ 'wpEditToken' => $wgUser->getEditToken( $img )
993993 ),
994994 array( 'known', 'noclasses' )
995995 );
@@ -1016,7 +1016,7 @@
10171017 array(
10181018 'target' => $this->title->getPrefixedText(),
10191019 'file' => $img,
1020 - 'token' => $wgUser->editToken( $img )
 1020+ 'token' => $wgUser->getEditToken( $img )
10211021 ),
10221022 array( 'known', 'noclasses' )
10231023 );
Index: trunk/phase3/includes/Linker.php
@@ -1581,7 +1581,7 @@
15821582 $query = array(
15831583 'action' => 'rollback',
15841584 'from' => $rev->getUserText(),
1585 - 'token' => $wgUser->editToken( array( $title->getPrefixedText(), $rev->getUserText() ) ),
 1585+ 'token' => $wgUser->getEditToken( array( $title->getPrefixedText(), $rev->getUserText() ) ),
15861586 );
15871587 if ( $wgRequest->getBool( 'bot' ) ) {
15881588 $query['bot'] = '1';
Index: trunk/phase3/includes/EditPage.php
@@ -1955,7 +1955,7 @@
19561956 * include the constant suffix to prevent editing from
19571957 * broken text-mangling proxies.
19581958 */
1959 - $wgOut->addHTML( "\n" . Html::hidden( "wpEditToken", $wgUser->editToken() ) . "\n" );
 1959+ $wgOut->addHTML( "\n" . Html::hidden( "wpEditToken", $wgUser->getEditToken() ) . "\n" );
19601960 }
19611961
19621962 /**
Index: trunk/phase3/includes/HTMLForm.php
@@ -493,7 +493,7 @@
494494
495495 $html = '';
496496 if( $this->getMethod() == 'post' ){
497 - $html .= Html::hidden( 'wpEditToken', $this->getUser()->editToken(), array( 'id' => 'wpEditToken' ) ) . "\n";
 497+ $html .= Html::hidden( 'wpEditToken', $this->getUser()->getEditToken(), array( 'id' => 'wpEditToken' ) ) . "\n";
498498 $html .= Html::hidden( 'title', $this->getTitle()->getPrefixedText() ) . "\n";
499499 }
500500
Index: trunk/phase3/includes/revisiondelete/RevisionDelete.php
@@ -584,7 +584,7 @@
585585 array(
586586 'target' => $this->list->title->getPrefixedText(),
587587 'file' => $this->file->getArchiveName(),
588 - 'token' => $this->list->getUser()->editToken(
 588+ 'token' => $this->list->getUser()->getEditToken(
589589 $this->file->getArchiveName() )
590590 )
591591 );
@@ -733,7 +733,7 @@
734734 array(
735735 'target' => $this->list->title->getPrefixedText(),
736736 'file' => $key,
737 - 'token' => $this->list->getUser()->editToken( $key )
 737+ 'token' => $this->list->getUser()->getEditToken( $key )
738738 )
739739 );
740740 }
Index: trunk/phase3/includes/actions/WatchAction.php
@@ -123,7 +123,7 @@
124124
125125 // This token stronger salted and not compatible with ApiWatch
126126 // It's title/action specific because index.php is GET and API is POST
127 - return $user->editToken( $salt );
 127+ return $user->getEditToken( $salt );
128128 }
129129
130130 /**
Index: trunk/phase3/includes/resourceloader/ResourceLoaderUserTokensModule.php
@@ -40,7 +40,7 @@
4141 global $wgUser;
4242
4343 return array(
44 - 'editToken' => $wgUser->edittoken(),
 44+ 'editToken' => $wgUser->getEditToken(),
4545 'watchToken' => ApiQueryInfo::getWatchToken(null, null),
4646 );
4747 }
Index: trunk/phase3/includes/FileDeleteForm.php
@@ -194,7 +194,7 @@
195195 'id' => 'mw-img-deleteconfirm' ) ) .
196196 Xml::openElement( 'fieldset' ) .
197197 Xml::element( 'legend', null, wfMsg( 'filedelete-legend' ) ) .
198 - Html::hidden( 'wpEditToken', $wgUser->editToken( $this->oldimage ) ) .
 198+ Html::hidden( 'wpEditToken', $wgUser->getEditToken( $this->oldimage ) ) .
199199 $this->prepareMessage( 'filedelete-intro' ) .
200200 Xml::openElement( 'table', array( 'id' => 'mw-img-deleteconfirm-table' ) ) .
201201 "<tr>
Index: trunk/phase3/includes/specials/SpecialUserrights.php
@@ -439,7 +439,7 @@
440440 $this->getOutput()->addHTML(
441441 Xml::openElement( 'form', array( 'method' => 'post', 'action' => $this->getTitle()->getLocalURL(), 'name' => 'editGroup', 'id' => 'mw-userrights-form2' ) ) .
442442 Html::hidden( 'user', $this->mTarget ) .
443 - Html::hidden( 'wpEditToken', $this->getUser()->editToken( $this->mTarget ) ) .
 443+ Html::hidden( 'wpEditToken', $this->getUser()->getEditToken( $this->mTarget ) ) .
444444 Xml::openElement( 'fieldset' ) .
445445 Xml::element( 'legend', array(), wfMsg( 'userrights-editusergroup' ) ) .
446446 wfMessage( 'editinguser' )->params( wfEscapeWikiText( $user->getName() ) )->rawParams( $userToolLinks )->parse() .
Index: trunk/phase3/includes/specials/SpecialUndelete.php
@@ -862,7 +862,7 @@
863863 Xml::element( 'input', array(
864864 'type' => 'hidden',
865865 'name' => 'wpEditToken',
866 - 'value' => $user->editToken() ) ) .
 866+ 'value' => $user->getEditToken() ) ) .
867867 Xml::element( 'input', array(
868868 'type' => 'submit',
869869 'name' => 'preview',
@@ -968,7 +968,7 @@
969969 'action' => $this->getTitle()->getLocalURL(
970970 'target=' . urlencode( $this->mTarget ) .
971971 '&file=' . urlencode( $key ) .
972 - '&token=' . urlencode( $this->getUser()->editToken( $key ) ) )
 972+ '&token=' . urlencode( $this->getUser()->getEditToken( $key ) ) )
973973 )
974974 ) .
975975 Xml::submitButton( wfMsg( 'undelete-show-file-submit' ) ) .
@@ -1143,7 +1143,7 @@
11441144 if ( $this->mAllowed ) {
11451145 # Slip in the hidden controls here
11461146 $misc = Html::hidden( 'target', $this->mTarget );
1147 - $misc .= Html::hidden( 'wpEditToken', $this->getUser()->editToken() );
 1147+ $misc .= Html::hidden( 'wpEditToken', $this->getUser()->getEditToken() );
11481148 $misc .= Xml::closeElement( 'form' );
11491149 $out->addHTML( $misc );
11501150 }
@@ -1301,7 +1301,7 @@
13021302 array(
13031303 'target' => $this->mTargetObj->getPrefixedText(),
13041304 'file' => $key,
1305 - 'token' => $this->getUser()->editToken( $key )
 1305+ 'token' => $this->getUser()->getEditToken( $key )
13061306 )
13071307 );
13081308 if( $file->isDeleted( File::DELETED_FILE ) ) {
Index: trunk/phase3/includes/specials/SpecialImport.php
@@ -210,7 +210,7 @@
211211 "</td>
212212 </tr>" .
213213 Xml::closeElement( 'table' ).
214 - Html::hidden( 'editToken', $user->editToken() ) .
 214+ Html::hidden( 'editToken', $user->getEditToken() ) .
215215 Xml::closeElement( 'form' ) .
216216 Xml::closeElement( 'fieldset' )
217217 );
@@ -240,7 +240,7 @@
241241 wfMsgExt( 'import-interwiki-text', array( 'parse' ) ) .
242242 Html::hidden( 'action', 'submit' ) .
243243 Html::hidden( 'source', 'interwiki' ) .
244 - Html::hidden( 'editToken', $user->editToken() ) .
 244+ Html::hidden( 'editToken', $user->getEditToken() ) .
245245 Xml::openElement( 'table', array( 'id' => 'mw-import-table' ) ) .
246246 "<tr>
247247 <td class='mw-label'>" .
Index: trunk/phase3/includes/specials/SpecialRevisiondelete.php
@@ -294,7 +294,7 @@
295295 'action' => $this->getTitle()->getLocalUrl(
296296 'target=' . urlencode( $oimage->getName() ) .
297297 '&file=' . urlencode( $archiveName ) .
298 - '&token=' . urlencode( $this->getUser()->editToken( $archiveName ) ) )
 298+ '&token=' . urlencode( $this->getUser()->getEditToken( $archiveName ) ) )
299299 )
300300 ) .
301301 Xml::submitButton( wfMsg( 'revdelete-show-file-submit' ) ) .
@@ -404,7 +404,7 @@
405405 '</td>' .
406406 "</tr>\n" .
407407 Xml::closeElement( 'table' ) .
408 - Html::hidden( 'wpEditToken', $this->getUser()->editToken() ) .
 408+ Html::hidden( 'wpEditToken', $this->getUser()->getEditToken() ) .
409409 Html::hidden( 'target', $this->targetObj->getPrefixedText() ) .
410410 Html::hidden( 'type', $this->typeName ) .
411411 Html::hidden( 'ids', implode( ',', $this->ids ) ) .
Index: trunk/phase3/includes/specials/SpecialChangeEmail.php
@@ -118,7 +118,7 @@
119119 'method' => 'post',
120120 'action' => $this->getTitle()->getLocalUrl(),
121121 'id' => 'mw-changeemail-form' ) ) . "\n" .
122 - Html::hidden( 'token', $user->editToken() ) . "\n" .
 122+ Html::hidden( 'token', $user->getEditToken() ) . "\n" .
123123 Html::hidden( 'returnto', $this->getRequest()->getVal( 'returnto' ) ) . "\n" .
124124 wfMsgExt( 'changeemail-text', array( 'parse' ) ) . "\n" .
125125 Xml::openElement( 'table', array( 'id' => 'mw-changeemail-table' ) ) . "\n" .
Index: trunk/phase3/includes/specials/SpecialMovepage.php
@@ -189,7 +189,7 @@
190190 $out->addWikiMsg( 'movepagetalktext' );
191191 }
192192
193 - $token = htmlspecialchars( $user->editToken() );
 193+ $token = htmlspecialchars( $user->getEditToken() );
194194
195195 if ( !empty($err) ) {
196196 $out->addSubtitle( $this->msg( 'formerror' ) );
Index: trunk/phase3/includes/specials/SpecialConfirmemail.php
@@ -97,7 +97,7 @@
9898 }
9999 $out->addWikiMsg( 'confirmemail_text' );
100100 $form = Xml::openElement( 'form', array( 'method' => 'post', 'action' => $this->getTitle()->getLocalUrl() ) );
101 - $form .= Html::hidden( 'token', $user->editToken() );
 101+ $form .= Html::hidden( 'token', $user->getEditToken() );
102102 $form .= Xml::submitButton( wfMsg( 'confirmemail_send' ) );
103103 $form .= Xml::closeElement( 'form' );
104104 $out->addHTML( $form );
Index: trunk/phase3/includes/specials/SpecialChangePassword.php
@@ -143,7 +143,7 @@
144144 'method' => 'post',
145145 'action' => $this->getTitle()->getLocalUrl(),
146146 'id' => 'mw-resetpass-form' ) ) . "\n" .
147 - Html::hidden( 'token', $user->editToken() ) . "\n" .
 147+ Html::hidden( 'token', $user->getEditToken() ) . "\n" .
148148 Html::hidden( 'wpName', $this->mUserName ) . "\n" .
149149 Html::hidden( 'wpDomain', $this->mDomain ) . "\n" .
150150 Html::hidden( 'returnto', $this->getRequest()->getVal( 'returnto' ) ) . "\n" .
Index: trunk/phase3/includes/specials/SpecialMergeHistory.php
@@ -235,7 +235,7 @@
236236 $misc .= Html::hidden( 'destID', $this->mDestObj->getArticleID() );
237237 $misc .= Html::hidden( 'target', $this->mTarget );
238238 $misc .= Html::hidden( 'dest', $this->mDest );
239 - $misc .= Html::hidden( 'wpEditToken', $this->getUser()->editToken() );
 239+ $misc .= Html::hidden( 'wpEditToken', $this->getUser()->getEditToken() );
240240 $misc .= Xml::closeElement( 'form' );
241241 $out->addHTML( $misc );
242242

Follow-up revisions

RevisionCommit summaryAuthorDate
r103295Followup r103294, remove a space that got added on the end of the methodjohnduhart04:39, 16 November 2011
r108336Calls to editToken() that r103294 missed.platonides23:26, 7 January 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r100264we want to get the edit token, not edit the token...jeroendedauw19:38, 19 October 2011

Status & tagging log