Pcoombe has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/146970

Change subject: Disable caching of petition CSV download
......................................................................

Disable caching of petition CSV download

Set headers to explicitly disable caching of the CSV containing petition data.

Bug: 65850
Change-Id: I6fcbd175ad94f84203a36f6371a14df5b7977ac4
---
M SpecialPetitionData.php
1 file changed, 9 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Petition 
refs/changes/70/146970/1

diff --git a/SpecialPetitionData.php b/SpecialPetitionData.php
index 8d21d13..02cf089 100644
--- a/SpecialPetitionData.php
+++ b/SpecialPetitionData.php
@@ -30,8 +30,15 @@
                $filename = "petition_data_$ts.csv";
                $this->getOutput()->disable();
                wfResetOutputBuffers();
-               $this->getRequest()->response()->header( "Content-disposition: 
attachment;filename={$filename}" );
-               $this->getRequest()->response()->header( "Content-type: 
text/csv; charset=utf-8" );
+               $response = $this->getRequest()->response();
+
+               // Explicitly disable caching, just to be sure
+               $response->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) 
. ' GMT' );
+               $response->header( 'Cache-Control: no-cache, no-store, 
max-age=0, must-revalidate' );
+               $response->header( 'Pragma: no-cache' );
+
+               $response->header( "Content-disposition: 
attachment;filename={$filename}" );
+               $response->header( "Content-type: text/csv; charset=utf-8" );
                $fh = fopen( 'php://output', 'w' );
 
                fputcsv( $fh, array('id', 'petitionname', 'source', 'name',

-- 
To view, visit https://gerrit.wikimedia.org/r/146970
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6fcbd175ad94f84203a36f6371a14df5b7977ac4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Petition
Gerrit-Branch: master
Gerrit-Owner: Pcoombe <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to