r78599 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r78598‎ | r78599 | r78600 >
Date:15:23, 19 December 2010
Author:happy-melon
Status:reverted (Comments)
Tags:
Comment:
Follow-up r78585: Make Token::PERSISTENT the default, so no need to specify it. That will be more usual, I expect.
Modified paths:
  • /trunk/phase3/includes/Article.php (modified) (history)
  • /trunk/phase3/includes/Linker.php (modified) (history)
  • /trunk/phase3/includes/Token.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryRevisions.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Article.php
@@ -3332,7 +3332,7 @@
33333333 $rollbackErrors = $this->mTitle->getUserPermissionsErrors( 'rollback', $wgUser );
33343334 $errors = array_merge( $editErrors, wfArrayDiff2( $rollbackErrors, $editErrors ) );
33353335
3336 - $t = new Token( Token::PERSISTENT, array( $this->mTitle->getPrefixedText(), $fromP ) );
 3336+ $t = new Token( array( $this->mTitle->getPrefixedText(), $fromP ) );
33373337 if ( !$t->match( $token ) ) {
33383338 $errors[] = array( 'sessionfailure' );
33393339 }
Index: trunk/phase3/includes/Token.php
@@ -1,6 +1,6 @@
22 <?php
33 /**
4 - * Copyright © 2003 Brion Vibber <brion@pobox.com>
 4+ * Copyright © 2010
55 * http://www.mediawiki.org/
66 *
77 * This program is free software; you can redistribute it and/or modify
@@ -102,7 +102,7 @@
103103 * @param $request WebRequest most of the time you'll want to get/store
104104 * the tokens in $wgRequest, which is the default.
105105 */
106 - public function __construct( $salt, $type = self::ANONYMOUS, WebRequest $request = null ){
 106+ public function __construct( $salt, $type = self::PERSISTENT, WebRequest $request = null ){
107107 global $wgRequest;
108108 $this->type = $type;
109109
@@ -181,7 +181,7 @@
182182 * @param $type Token class constant identifier
183183 * @return String token string to store in HTML
184184 */
185 - public static function prepare( $salt, $type = self::ANONYMOUS ){
 185+ public static function prepare( $salt, $type = self::PERSISTENT ){
186186 $t = new Token( $salt, $type );
187187 return $t->set( false );
188188 }
Index: trunk/phase3/includes/Linker.php
@@ -1500,10 +1500,7 @@
15011501 $query = array(
15021502 'action' => 'rollback',
15031503 'from' => $rev->getUserText(),
1504 - 'token' => Token::prepare(
1505 - Token::PERSISTENT,
1506 - array( $title->getPrefixedText(), $rev->getUserText() )
1507 - ),
 1504+ 'token' => Token::prepare( array( $title->getPrefixedText(), $rev->getUserText() ) ),
15081505 );
15091506 if ( $wgRequest->getBool( 'bot' ) ) {
15101507 $query['bot'] = '1';
Index: trunk/phase3/includes/api/ApiQueryRevisions.php
@@ -78,10 +78,7 @@
7979 if ( !$wgUser->isAllowed( 'rollback' ) ) {
8080 return false;
8181 }
82 - return Token::prepare(
83 - Token::PERSISTENT,
84 - array( $title->getPrefixedText(), $rev->getUserText() )
85 - );
 82+ return Token::prepare( array( $title->getPrefixedText(), $rev->getUserText() ) );
8683 }
8784
8885 public function execute() {

Follow-up revisions

RevisionCommit summaryAuthorDate
r78631Revert rollback implementation of r78585, r78599. The way the API is set up,...happy-melon19:03, 20 December 2010
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

Comments

#Comment by Happy-melon (talk | contribs)   16:18, 14 March 2011

This was reverted piecemeal in r78631 and r82306.

Status & tagging log