Mjbmr has uploaded a new change for review.

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

Change subject: Explicit maximum age for action=raw
......................................................................

Explicit maximum age for action=raw

Change-Id: I1011ee64dd9013598d1969a79b869ee926928009
---
M includes/DefaultSettings.php
M includes/actions/RawAction.php
2 files changed, 19 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/20/189420/1

diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index 82011fe..28f401e 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -2440,6 +2440,13 @@
 $wgForcedRawSMaxage = 300;
 
 /**
+ * Explicit maximum age for raw accesses
+ */
+$wgExplicitRawSMaxageJS = null;
+$wgExplicitRawSMaxageCSS = null;
+$wgExplicitRawSMaxageContent = null;
+
+/**
  * List of proxy servers to purge on changes; default port is 80. Use IP 
addresses.
  *
  * When MediaWiki is running behind a proxy, it will trust X-Forwarded-For
diff --git a/includes/actions/RawAction.php b/includes/actions/RawAction.php
index 727bed2..e069ed6 100644
--- a/includes/actions/RawAction.php
+++ b/includes/actions/RawAction.php
@@ -90,6 +90,18 @@
                        }
                }
 
+               $explicitRawSMaxageCSS = $config->get( 'ExplicitRawSMaxageCSS' 
);
+               $explicitRawSMaxageJS = $config->get( 'ExplicitRawSMaxageJS' );
+               $explicitRawSMaxageContent = $config->get( 
'ExplicitRawSMaxageContent' );
+
+               if( $contentType == 'text/css' && !is_null( 
$explicitRawSMaxageCSS ) ) {
+                       $smaxage = $explicitRawSMaxageCSS;
+               } elseif( $contentType == 'text/javascript' && !is_null( 
$explicitRawSMaxageJS ) ) {
+                       $smaxage = $explicitRawSMaxageJS;
+               } elseif( $contentType == 'text/x-wiki' && !is_null( 
$explicitRawSMaxageContent ) ) {
+                       $smaxage = $explicitRawSMaxageContent;
+               }
+
                $maxage = $request->getInt( 'maxage', $config->get( 
'SquidMaxage' ) );
 
                $response = $request->response();

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1011ee64dd9013598d1969a79b869ee926928009
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Mjbmr <[email protected]>

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

Reply via email to