[MediaWiki-commits] [Gerrit] Remove some cache control complexity - change (mediawiki...DonationInterface)
Katie Horn has submitted this change and it was merged. Change subject: Remove some cache control complexity .. Remove some cache control complexity We've never used this code, its rotting, and I'm about to tear apart contribution tracking so I figured some cleaning was in order. Change-Id: I2fc18aa3d9a841e159507ed4888e30e176ce6e6f --- M DonationInterface.php M gateway_common/DonationData.php M gateway_common/gateway.adapter.php M tests/DonationDataTestCase.php 4 files changed, 2 insertions(+), 103 deletions(-) Approvals: Katie Horn: Looks good to me, approved jenkins-bot: Verified diff --git a/DonationInterface.php b/DonationInterface.php index 613c7b4..b6b17e0 100644 --- a/DonationInterface.php +++ b/DonationInterface.php @@ -267,15 +267,6 @@ $wgDonationInterfaceNoScriptRedirect = null; /** - * Set the max-age value for Squid - * - * If you have Squid enabled for caching, use this variable to configure - * the s-max-age for cached requests. - * @var int Time in seconds - */ -$wgDonationInterfaceSMaxAge = 6000; - -/** * Configure price ceiling and floor for valid contribution amount. Values * should be in USD. */ diff --git a/gateway_common/DonationData.php b/gateway_common/DonationData.php index 2b86f1a..73c467a 100644 --- a/gateway_common/DonationData.php +++ b/gateway_common/DonationData.php @@ -87,7 +87,6 @@ // Pull both of these here. We can logic out which one to use in the normalize bits. 'language' => $wgRequest->getText( 'language', null ), 'uselang' => $wgRequest->getText( 'uselang', null ), - '_cache_' => $wgRequest->getText( '_cache_', null ), 'token' => $wgRequest->getText( 'token', null ), 'contribution_tracking_id' => $wgRequest->getText( 'contribution_tracking_id' ), 'data_hash' => $wgRequest->getText( 'data_hash' ), @@ -124,8 +123,6 @@ //if we have saved any donation data to the session, pull them in as well. $this->integrateDataFromSession(); - - $this->doCacheStuff(); $this->normalize(); @@ -440,43 +437,8 @@ */ protected function handleContributionTrackingID(){ if ( !$this->isSomething( 'contribution_tracking_id' ) ) { - if ( !$this->isCaching() ) { - $this->saveContributionTracking(); - } else { - $this->log( "Declining to create a contribution_tracking record, because we are in cache mode." ); - } + $this->saveContributionTracking(); } - } - - /** -* Tells us if we think we're in caching mode or not. -* @staticvar string $cache Keeps track of the mode so we don't have to -* calculate it from the data fields more than once. -* @return boolean true if we are going to be caching, false if we aren't. -*/ - public function isCaching(){ - - static $cache = null; - - if ( is_null( $cache ) ){ - if ( $this->getVal( '_cache_' ) === 'true' ){ //::head. hit. keyboard.:: - if ( $this->isSomething( 'utm_source_id' ) && !is_null( 'utm_source_id' ) ){ - $cache = true; - } - } - if ( is_null( $cache ) ){ - $cache = false; - } - } - -//this business could change at any second, and it will prevent us from -//caching, so we're going to keep asking if it's set. - $c = $this->getAdapterClass(); - if ( $c::session_exists() ) { - $cache = false; - } - - return $cache; } /** @@ -741,34 +703,6 @@ $this->setVal( 'email', $email ); $this->expunge( 'emailAdd' ); - } - - /** -* This function sets the token to the string 'cache' if we're caching, and -* then sets the s-maxage header to whatever you specify for the SMaxAge. -* NOTES: The bit where we setSquidMaxage will not work at all, under two -* conditions: -* The user has a session ID. -* The mediawiki_session cookie is set in the user's browser. -* @global bool $wgUseSquid -* @global type $wgOut -*/ - protected function doCacheStuff() { - //TODO: Wow, name. - // if _cache_ is requested by the us
[MediaWiki-commits] [Gerrit] Remove some cache control complexity - change (mediawiki...DonationInterface)
Mwalker has uploaded a new change for review. https://gerrit.wikimedia.org/r/130669 Change subject: Remove some cache control complexity .. Remove some cache control complexity We've never used this code, its rotting, and I'm about to tear apart contribution tracking so I figured some cleaning was in order. Change-Id: I2fc18aa3d9a841e159507ed4888e30e176ce6e6f --- M DonationInterface.php M gateway_common/DonationData.php M gateway_common/gateway.adapter.php M tests/DonationDataTestCase.php 4 files changed, 2 insertions(+), 101 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DonationInterface refs/changes/69/130669/1 diff --git a/DonationInterface.php b/DonationInterface.php index 613c7b4..b6b17e0 100644 --- a/DonationInterface.php +++ b/DonationInterface.php @@ -267,15 +267,6 @@ $wgDonationInterfaceNoScriptRedirect = null; /** - * Set the max-age value for Squid - * - * If you have Squid enabled for caching, use this variable to configure - * the s-max-age for cached requests. - * @var int Time in seconds - */ -$wgDonationInterfaceSMaxAge = 6000; - -/** * Configure price ceiling and floor for valid contribution amount. Values * should be in USD. */ diff --git a/gateway_common/DonationData.php b/gateway_common/DonationData.php index 2b86f1a..73c467a 100644 --- a/gateway_common/DonationData.php +++ b/gateway_common/DonationData.php @@ -87,7 +87,6 @@ // Pull both of these here. We can logic out which one to use in the normalize bits. 'language' => $wgRequest->getText( 'language', null ), 'uselang' => $wgRequest->getText( 'uselang', null ), - '_cache_' => $wgRequest->getText( '_cache_', null ), 'token' => $wgRequest->getText( 'token', null ), 'contribution_tracking_id' => $wgRequest->getText( 'contribution_tracking_id' ), 'data_hash' => $wgRequest->getText( 'data_hash' ), @@ -124,8 +123,6 @@ //if we have saved any donation data to the session, pull them in as well. $this->integrateDataFromSession(); - - $this->doCacheStuff(); $this->normalize(); @@ -440,43 +437,8 @@ */ protected function handleContributionTrackingID(){ if ( !$this->isSomething( 'contribution_tracking_id' ) ) { - if ( !$this->isCaching() ) { - $this->saveContributionTracking(); - } else { - $this->log( "Declining to create a contribution_tracking record, because we are in cache mode." ); - } + $this->saveContributionTracking(); } - } - - /** -* Tells us if we think we're in caching mode or not. -* @staticvar string $cache Keeps track of the mode so we don't have to -* calculate it from the data fields more than once. -* @return boolean true if we are going to be caching, false if we aren't. -*/ - public function isCaching(){ - - static $cache = null; - - if ( is_null( $cache ) ){ - if ( $this->getVal( '_cache_' ) === 'true' ){ //::head. hit. keyboard.:: - if ( $this->isSomething( 'utm_source_id' ) && !is_null( 'utm_source_id' ) ){ - $cache = true; - } - } - if ( is_null( $cache ) ){ - $cache = false; - } - } - -//this business could change at any second, and it will prevent us from -//caching, so we're going to keep asking if it's set. - $c = $this->getAdapterClass(); - if ( $c::session_exists() ) { - $cache = false; - } - - return $cache; } /** @@ -741,34 +703,6 @@ $this->setVal( 'email', $email ); $this->expunge( 'emailAdd' ); - } - - /** -* This function sets the token to the string 'cache' if we're caching, and -* then sets the s-maxage header to whatever you specify for the SMaxAge. -* NOTES: The bit where we setSquidMaxage will not work at all, under two -* conditions: -* The user has a session ID. -* The mediawiki_session cookie is set in the user's browser. -* @global bool $wgUseSquid -* @global type $wgOut -*/ - protected function doCacheStuff() { - //TODO: