r78631 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r78630‎ | r78631 | r78632 >
Date:19:03, 20 December 2010
Author:happy-melon
Status:ok
Tags:
Comment:
Revert rollback implementation of r78585, r78599. The way the API is set up, it's not possible to have some tokens on the new system and some on the old.
Modified paths:
  • /trunk/phase3/includes/Article.php (modified) (history)
  • /trunk/phase3/includes/Linker.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryRevisions.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Article.php
@@ -3332,8 +3332,7 @@
33333333 $rollbackErrors = $this->mTitle->getUserPermissionsErrors( 'rollback', $wgUser );
33343334 $errors = array_merge( $editErrors, wfArrayDiff2( $rollbackErrors, $editErrors ) );
33353335
3336 - $t = new Token( array( $this->mTitle->getPrefixedText(), $fromP ) );
3337 - if ( !$t->match( $token ) ) {
 3336+ if ( !$wgUser->matchEditToken( $token, array( $this->mTitle->getPrefixedText(), $fromP ) ) ) {
33383337 $errors[] = array( 'sessionfailure' );
33393338 }
33403339
Index: trunk/phase3/includes/Linker.php
@@ -1500,7 +1500,7 @@
15011501 $query = array(
15021502 'action' => 'rollback',
15031503 'from' => $rev->getUserText(),
1504 - 'token' => Token::prepare( array( $title->getPrefixedText(), $rev->getUserText() ) ),
 1504+ 'token' => $wgUser->editToken( array( $title->getPrefixedText(), $rev->getUserText() ) ),
15051505 );
15061506 if ( $wgRequest->getBool( 'bot' ) ) {
15071507 $query['bot'] = '1';
Index: trunk/phase3/includes/api/ApiQueryRevisions.php
@@ -78,7 +78,8 @@
7979 if ( !$wgUser->isAllowed( 'rollback' ) ) {
8080 return false;
8181 }
82 - return Token::prepare( array( $title->getPrefixedText(), $rev->getUserText() ) );
 82+ return $wgUser->editToken( array( $title->getPrefixedText(),
 83+ $rev->getUserText() ) );
8384 }
8485
8586 public function execute() {

Follow-up revisions

RevisionCommit summaryAuthorDate
r82306Revert r78585. While I definitely think this is an area where there's scope ...happy-melon22:29, 16 February 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r78585Merge in Token class from my branch; would like some second opinions on the c...happy-melon23:07, 18 December 2010
r78599Follow-up r78585: Make Token::PERSISTENT the default, so no need to specify i...happy-melon15:23, 19 December 2010

Status & tagging log