From: Happy-melon Date: Sun, 19 Dec 2010 15:23:22 +0000 (+0000) Subject: Follow-up r78585: Make Token::PERSISTENT the default, so no need to specify it. ... X-Git-Tag: 1.31.0-rc.0~33229 X-Git-Url: http://git.cyclocoop.org/%24action?a=commitdiff_plain;h=ff2f6606b0a00cde712524adb5770f193978cf5c;p=lhc%2Fweb%2Fwiklou.git Follow-up r78585: Make Token::PERSISTENT the default, so no need to specify it. That will be more usual, I expect. --- diff --git a/includes/Article.php b/includes/Article.php index e371290813..43dffbde72 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -3332,7 +3332,7 @@ class Article { $rollbackErrors = $this->mTitle->getUserPermissionsErrors( 'rollback', $wgUser ); $errors = array_merge( $editErrors, wfArrayDiff2( $rollbackErrors, $editErrors ) ); - $t = new Token( Token::PERSISTENT, array( $this->mTitle->getPrefixedText(), $fromP ) ); + $t = new Token( array( $this->mTitle->getPrefixedText(), $fromP ) ); if ( !$t->match( $token ) ) { $errors[] = array( 'sessionfailure' ); } diff --git a/includes/Linker.php b/includes/Linker.php index 0d193b5aba..16e53598eb 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -1500,10 +1500,7 @@ class Linker { $query = array( 'action' => 'rollback', 'from' => $rev->getUserText(), - 'token' => Token::prepare( - Token::PERSISTENT, - array( $title->getPrefixedText(), $rev->getUserText() ) - ), + 'token' => Token::prepare( array( $title->getPrefixedText(), $rev->getUserText() ) ), ); if ( $wgRequest->getBool( 'bot' ) ) { $query['bot'] = '1'; diff --git a/includes/Token.php b/includes/Token.php index 8ab6a47c57..62627feed9 100644 --- a/includes/Token.php +++ b/includes/Token.php @@ -1,6 +1,6 @@ + * Copyright © 2010 * http://www.mediawiki.org/ * * This program is free software; you can redistribute it and/or modify @@ -102,7 +102,7 @@ class Token { * @param $request WebRequest most of the time you'll want to get/store * the tokens in $wgRequest, which is the default. */ - public function __construct( $salt, $type = self::ANONYMOUS, WebRequest $request = null ){ + public function __construct( $salt, $type = self::PERSISTENT, WebRequest $request = null ){ global $wgRequest; $this->type = $type; @@ -181,7 +181,7 @@ class Token { * @param $type Token class constant identifier * @return String token string to store in HTML */ - public static function prepare( $salt, $type = self::ANONYMOUS ){ + public static function prepare( $salt, $type = self::PERSISTENT ){ $t = new Token( $salt, $type ); return $t->set( false ); } diff --git a/includes/api/ApiQueryRevisions.php b/includes/api/ApiQueryRevisions.php index 385366b716..2208c5b8a7 100644 --- a/includes/api/ApiQueryRevisions.php +++ b/includes/api/ApiQueryRevisions.php @@ -78,10 +78,7 @@ class ApiQueryRevisions extends ApiQueryBase { if ( !$wgUser->isAllowed( 'rollback' ) ) { return false; } - return Token::prepare( - Token::PERSISTENT, - array( $title->getPrefixedText(), $rev->getUserText() ) - ); + return Token::prepare( array( $title->getPrefixedText(), $rev->getUserText() ) ); } public function execute() {