Follow-up r78585: Make Token::PERSISTENT the default, so no need to specify it. ...
authorHappy-melon <happy-melon@users.mediawiki.org>
Sun, 19 Dec 2010 15:23:22 +0000 (15:23 +0000)
committerHappy-melon <happy-melon@users.mediawiki.org>
Sun, 19 Dec 2010 15:23:22 +0000 (15:23 +0000)
includes/Article.php
includes/Linker.php
includes/Token.php
includes/api/ApiQueryRevisions.php

index e371290..43dffbd 100644 (file)
@@ -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' );
                }
index 0d193b5..16e5359 100644 (file)
@@ -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';
index 8ab6a47..62627fe 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * Copyright © 2003 Brion Vibber <brion@pobox.com>
+ * 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 );
        }
index 385366b..2208c5b 100644 (file)
@@ -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() {