r62715 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r62714‎ | r62715 | r62716 >
Date:19:44, 19 February 2010
Author:reedy
Status:ok
Tags:
Comment:
r65299 c5894 followup

Move isset check of gettoken upto level of $salt !== false. If gettoken is set, the module isn't going to do anything else (and therefore no point seeing if there is a token set, let alone attempting to validate it)
Modified paths:
  • /trunk/phase3/includes/api/ApiMain.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiMain.php
@@ -416,9 +416,9 @@
417417
418418 // Die if token required, but not provided (unless there is a gettoken parameter)
419419 $salt = $module->getTokenSalt();
420 - if ( $salt !== false )
 420+ if ( $salt !== false && !isset( $moduleParams['gettoken'] ) )
421421 {
422 - if ( !isset( $moduleParams['token'] ) && !isset( $moduleParams['gettoken'] ) ) {
 422+ if ( !isset( $moduleParams['token'] ) ) {
423423 $this->dieUsageMsg( array( 'missingparam', 'token' ) );
424424 } else {
425425 global $wgUser;

Status & tagging log