Index: trunk/extensions/DonationInterface/tests/DonationDataTestCase.php |
— | — | @@ -303,7 +303,6 @@ |
304 | 304 | /** |
305 | 305 | * TODO: Make sure ALL these functions in DonationData are tested, either directly or through a calling function. |
306 | 306 | * I know that's more regression-ish, but I stand by it. :p |
307 | | - function isCache(){ |
308 | 307 | function setNormalizedOrderIDs(){ |
309 | 308 | function generateOrderId() { |
310 | 309 | public function sanitizeInput( &$value, $key, $flags=ENT_COMPAT, $double_encode=false ) { |
Index: trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.body.php |
— | — | @@ -65,7 +65,7 @@ |
66 | 66 | $this->displayForm( $this->errors ); |
67 | 67 | } |
68 | 68 | } else { |
69 | | - if ( !$this->adapter->isCache() ) { |
| 69 | + if ( !$this->adapter->isCaching() ) { |
70 | 70 | // if we're not caching, there's a token mismatch |
71 | 71 | $this->errors['general']['token-mismatch'] = wfMsg( 'donate_interface-token-mismatch' ); |
72 | 72 | } |
Index: trunk/extensions/DonationInterface/globalcollect_gateway/globalcollect_resultswitcher.body.php |
— | — | @@ -92,7 +92,7 @@ |
93 | 93 | } |
94 | 94 | } |
95 | 95 | } else { |
96 | | - if ( !$this->adapter->isCache() ) { |
| 96 | + if ( !$this->adapter->isCaching() ) { |
97 | 97 | // if we're not caching, there's a token mismatch |
98 | 98 | $this->errors['general']['token-mismatch'] = wfMsg( 'donate_interface-token-mismatch' ); |
99 | 99 | } |
Index: trunk/extensions/DonationInterface/globalcollect_gateway/globalcollect_gateway.body.php |
— | — | @@ -133,7 +133,7 @@ |
134 | 134 | $this->displayForm( $this->errors ); |
135 | 135 | } |
136 | 136 | } else { |
137 | | - if ( !$this->adapter->isCache() ) { |
| 137 | + if ( !$this->adapter->isCaching() ) { |
138 | 138 | // if we're not caching, there's a token mismatch |
139 | 139 | $this->errors['general']['token-mismatch'] = wfMsg( 'donate_interface-token-mismatch' ); |
140 | 140 | } |
Index: trunk/extensions/DonationInterface/gateway_common/gateway.adapter.php |
— | — | @@ -294,8 +294,8 @@ |
295 | 295 | } |
296 | 296 | } |
297 | 297 | |
298 | | - function isCache() { |
299 | | - return $this->dataObj->isCache(); |
| 298 | + function isCaching() { |
| 299 | + return $this->dataObj->isCaching(); |
300 | 300 | } |
301 | 301 | |
302 | 302 | /** |
Index: trunk/extensions/DonationInterface/gateway_common/DonationData.php |
— | — | @@ -143,10 +143,6 @@ |
144 | 144 | return $this->normalized; |
145 | 145 | } |
146 | 146 | |
147 | | - function isCache() { |
148 | | - return $this->cache; |
149 | | - } |
150 | | - |
151 | 147 | function populateData_Test( $testdata = false ) { |
152 | 148 | // define arrays of cc's and cc #s for random selection |
153 | 149 | $cards = array( 'american' ); |
— | — | @@ -273,19 +269,27 @@ |
274 | 270 | */ |
275 | 271 | function handleContributionTrackingID(){ |
276 | 272 | if ( !$this->isSomething( 'contribution_tracking_id' ) && |
277 | | - ( !$this->canCache() ) ){ |
| 273 | + ( !$this->isCaching() ) ){ |
278 | 274 | $this->saveContributionTracking(); |
279 | 275 | } |
280 | 276 | } |
281 | 277 | |
282 | 278 | |
283 | | - function canCache(){ |
284 | | - if ( $this->getVal( '_cache_' ) === 'true' ){ //::head. hit. keyboard.:: |
285 | | - if ( $this->isSomething( 'utm_source_id' ) && !is_null( 'utm_source_id' ) ){ |
286 | | - return true; |
| 279 | + function isCaching(){ |
| 280 | + //I think it's safe to static this here. I don't want to calc this every |
| 281 | + //time some outside object asks if we're caching. |
| 282 | + static $cache = null; |
| 283 | + if ( is_null( $cache ) ){ |
| 284 | + if ( $this->getVal( '_cache_' ) === 'true' ){ //::head. hit. keyboard.:: |
| 285 | + if ( $this->isSomething( 'utm_source_id' ) && !is_null( 'utm_source_id' ) ){ |
| 286 | + $cache = true; |
| 287 | + } |
287 | 288 | } |
| 289 | + if ( is_null( $cache ) ){ |
| 290 | + $cache = false; |
| 291 | + } |
288 | 292 | } |
289 | | - return false; |
| 293 | + return $cache; |
290 | 294 | } |
291 | 295 | |
292 | 296 | /** |
— | — | @@ -404,9 +408,8 @@ |
405 | 409 | function doCacheStuff() { |
406 | 410 | //TODO: Wow, name. |
407 | 411 | // if _cache_ is requested by the user, do not set a session/token; dynamic data will be loaded via ajax |
408 | | - if ( $this->isSomething( '_cache_' ) ) { |
| 412 | + if ( $this->isCaching() ) { |
409 | 413 | self::log( $this->getAnnoyingOrderIDLogLinePrefix() . ' Cache requested', LOG_DEBUG ); |
410 | | - $this->cache = true; //TODO: If we don't need this, kill it in the face. |
411 | 414 | $this->setVal( 'token', 'cache' ); |
412 | 415 | |
413 | 416 | // if we have squid caching enabled, set the maxage |
— | — | @@ -417,8 +420,6 @@ |
418 | 421 | self::log( $this->getAnnoyingOrderIDLogLinePrefix() . ' Setting s-max-age: ' . $maxAge, LOG_DEBUG ); |
419 | 422 | $wgOut->setSquidMaxage( $maxAge ); |
420 | 423 | } |
421 | | - } else { |
422 | | - $this->cache = false; //TODO: Kill this one in the face, too. (see above) |
423 | 424 | } |
424 | 425 | } |
425 | 426 | |