r62564 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r62563‎ | r62564 | r62565 >
Date:01:24, 16 February 2010
Author:reedy
Status:ok
Tags:
Comment:
Switch LiquidThreads ApiThreadAction to use base class token existance checking and validation (then we actually get 2 errors from it

Does mean we also get 2 errors - missing param of the token, and sessionfailure (bad token). Better for API Users
Modified paths:
  • /trunk/extensions/LiquidThreads/api/ApiThreadAction.php (modified) (history)

Diff [purge]

Index: trunk/extensions/LiquidThreads/api/ApiThreadAction.php
@@ -46,7 +46,6 @@
4747
4848 public function getPossibleErrors() {
4949 return array(
50 - array( 'sessionfailure' ),
5150 array( 'missingparam', 'action' ),
5251 array( 'missingparam', 'talkpage' ),
5352 array( 'missingparam', 'subject' ),
@@ -76,6 +75,10 @@
7776 return array(
7877 );
7978 }
 79+
 80+ public function getTokenSalt() {
 81+ return null;
 82+ }
8083
8184 public function getAllowedParams() {
8285 return array(
@@ -98,7 +101,9 @@
99102 );
100103 }
101104
102 - public function mustBePosted() { return true; }
 105+ public function mustBePosted() {
 106+ return true;
 107+ }
103108
104109 public function isWriteMode() {
105110 return true;
@@ -107,13 +112,6 @@
108113 public function execute() {
109114 $params = $this->extractRequestParams();
110115
111 - global $wgUser;
112 -
113 - if ( empty( $params['token'] ) ||
114 - !$wgUser->matchEditToken( $params['token'] ) ) {
115 - $this->dieUsageMsg( array( 'sessionfailure' ) );
116 - }
117 -
118116 if ( empty( $params['threadaction'] ) ) {
119117 $this->dieUsageMsg( array( 'missingparam', 'action' ) );
120118 }

Status & tagging log