r103003 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r103002‎ | r103003 | r103004 >
Date:18:48, 14 November 2011
Author:awjrichards
Status:deferred (Comments)
Tags:
Comment:
Revert r102836
Modified paths:
  • /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface (modified) (history)
  • /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_common/DonationData.php (modified) (history)
  • /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_common/gateway.adapter.php (modified) (history)
  • /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/globalcollect_gateway/globalcollect_gateway.body.php (modified) (history)
  • /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/globalcollect_gateway/globalcollect_resultswitcher.body.php (modified) (history)
  • /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/payflowpro_gateway (modified) (history)
  • /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.body.php (modified) (history)

Diff [purge]

Index: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.body.php
@@ -64,8 +64,11 @@
6565 // Display form for the first time
6666 $this->displayForm( $this->errors );
6767 }
68 - } else {//token mismatch
69 - $this->errors['general']['token-mismatch'] = wfMsg( 'donate_interface-token-mismatch' );
 68+ } else {
 69+ if ( !$this->adapter->isCaching() ) {
 70+ // if we're not caching, there's a token mismatch
 71+ $this->errors['general']['token-mismatch'] = wfMsg( 'donate_interface-token-mismatch' );
 72+ }
7073 $this->displayForm( $this->errors );
7174 }
7275 }
Property changes on: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/payflowpro_gateway
___________________________________________________________________
Modified: svn:mergeinfo
7376 Reverse-merged /trunk/extensions/DonationInterface/payflowpro_gateway:r102836
Index: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/globalcollect_gateway/globalcollect_resultswitcher.body.php
@@ -59,6 +59,9 @@
6060 return;
6161 }
6262
 63+
 64+
 65+
6366 $wgOut->addExtensionStyle(
6467 $wgExtensionAssetsPath . '/DonationInterface/gateway_forms/css/gateway.css?284' .
6568 $this->adapter->getGlobal( 'CSSVersion' ) );
@@ -101,7 +104,12 @@
102105 } //TODO: There really should be an else here.
103106 }
104107 }
105 - }
 108+ } else {
 109+ if ( !$this->adapter->isCaching() ) {
 110+ // if we're not caching, there's a token mismatch
 111+ $this->errors['general']['token-mismatch'] = wfMsg( 'donate_interface-token-mismatch' );
 112+ }
 113+ }
106114 }
107115
108116 /**
Index: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/globalcollect_gateway/globalcollect_gateway.body.php
@@ -178,8 +178,11 @@
179179
180180 $this->displayForm( $this->errors );
181181 }
182 - } else { //token mismatch
183 - $this->errors['general']['token-mismatch'] = wfMsg( 'donate_interface-token-mismatch' );
 182+ } else {
 183+ if ( !$this->adapter->isCaching() ) {
 184+ // if we're not caching, there's a token mismatch
 185+ $this->errors['general']['token-mismatch'] = wfMsg( 'donate_interface-token-mismatch' );
 186+ }
184187 $this->displayForm( $this->errors );
185188 }
186189 }
Index: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_common/gateway.adapter.php
@@ -306,20 +306,24 @@
307307 * @return boolean true if match, else false.
308308 */
309309 public function checkTokens() {
310 - $checkResult = $this->dataObj->token_checkTokens();
 310+ if ( !$this->posted ) {
 311+ //we don't care, because we can't possibly have a good one at this
 312+ //point.
 313+ //Additional: If we try for this before we're posted, the squid log
 314+ //caching won't work.
 315+ return true;
 316+ } else {
 317+ $checkResult = $this->dataObj->token_checkTokens();
311318
312 - if ( $checkResult ) {
313 - if ($this->dataObj->isCaching()){
314 - $this->debugarray[] = 'Token Not Checked (Caching Enabled)';
 319+ if ( $checkResult ) {
 320+ $this->debugarray[] = 'Token Match';
315321 } else {
316 - $this->debugarray[] = 'Token Match';
 322+ $this->debugarray[] = 'Token MISMATCH';
317323 }
318 - } else {
319 - $this->debugarray[] = 'Token MISMATCH';
 324+
 325+ $this->refreshGatewayValueFromSource( 'token' );
 326+ return $checkResult;
320327 }
321 -
322 - $this->refreshGatewayValueFromSource( 'token' );
323 - return $checkResult;
324328 }
325329
326330 /**
Index: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_common/DonationData.php
@@ -357,16 +357,11 @@
358358 }
359359 }
360360
361 - /**
362 - * Tells us if we think we're in caching mode or not.
363 - * @staticvar string $cache Keeps track of the mode so we don't have to
364 - * calculate it from the data fields more than once.
365 - * @return boolean true if we are going to be caching, false if we aren't.
366 - */
 361+
367362 function isCaching(){
368 -
 363+ //I think it's safe to static this here. I don't want to calc this every
 364+ //time some outside object asks if we're caching.
369365 static $cache = null;
370 -
371366 if ( is_null( $cache ) ){
372367 if ( $this->getVal( '_cache_' ) === 'true' ){ //::head. hit. keyboard.::
373368 if ( $this->isSomething( 'utm_source_id' ) && !is_null( 'utm_source_id' ) ){
@@ -377,13 +372,6 @@
378373 $cache = false;
379374 }
380375 }
381 -
382 - //this business could change at any second, and it will prevent us from
383 - //caching, so we're going to keep asking if it's set.
384 - if (self::sessionExists()){
385 - $cache = false;
386 - }
387 -
388376 return $cache;
389377 }
390378
@@ -666,13 +654,6 @@
667655 static $match = null;
668656
669657 if ( $match === null ) {
670 - if ( $this->isCaching() ){
671 - //This makes sense.
672 - //If all three conditions for caching are currently true, the
673 - //last thing we want to do is screw it up by setting a session
674 - //token before the page loads.
675 - return true;
676 - }
677658
678659 // establish the edit token to prevent csrf
679660 $token = $this->token_getSaltedSessionToken();
Property changes on: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_common/DonationData.php
___________________________________________________________________
Modified: svn:mergeinfo
680661 Reverse-merged /trunk/extensions/DonationInterface/gateway_common/DonationData.php:r102836
Property changes on: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface
___________________________________________________________________
Modified: svn:mergeinfo
681662 Reverse-merged /trunk/extensions/DonationInterface:r102836

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r102836Bugfix for the session tokens and caching: The token was being handed out one...khorn01:12, 12 November 2011
r102994MFT r102836awjrichards17:19, 14 November 2011

Comments

#Comment by Awjrichards (talk | contribs)   18:57, 14 November 2011

Really a revert of r102994

Status & tagging log