r109085 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r109084‎ | r109085 | r109086 >
Date:00:16, 17 January 2012
Author:neilk
Status:ok
Tags:
Comment:
MFT 109081 - configurable caching for banners. Will help when developing SOPA banner on testwiki
Modified paths:
  • /branches/wmf/1.18wmf1/extensions/CentralNotice/CentralNotice.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/CentralNotice/special/SpecialBannerLoader.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.18wmf1/extensions/CentralNotice/special/SpecialBannerLoader.php
@@ -6,8 +6,6 @@
77 class SpecialBannerLoader extends UnlistedSpecialPage {
88 public $siteName = 'Wikipedia'; // Site name
99 public $language = 'en'; // User language
10 - protected $sharedMaxAge = 600; // Cache for 10 minutes on the server side
11 - protected $maxAge = 0; // No client-side banner caching so we get all impressions
1210
1311 function __construct() {
1412 // Register special page
@@ -49,9 +47,10 @@
5048 * Generate the HTTP response headers for the banner file
5149 */
5250 function sendHeaders() {
53 - global $wgJsMimeType;
 51+ global $wgJsMimeType, $wgNoticeBannerMaxAge;
5452 header( "Content-type: $wgJsMimeType; charset=utf-8" );
55 - header( "Cache-Control: public, s-maxage=$this->sharedMaxAge, max-age=$this->maxAge" );
 53+ // No client-side banner caching so we get all impressions
 54+ header( "Cache-Control: public, s-maxage=$wgNoticeBannerMaxAge, max-age=0" );
5655 }
5756
5857 /**
Property changes on: branches/wmf/1.18wmf1/extensions/CentralNotice/special/SpecialBannerLoader.php
___________________________________________________________________
Modified: svn:mergeinfo
5958 Merged /trunk/extensions/CentralNotice/special/SpecialBannerLoader.php:r109081
Index: branches/wmf/1.18wmf1/extensions/CentralNotice/CentralNotice.php
@@ -53,6 +53,9 @@
5454 // Example: '.wikipedia.org'
5555 $wgNoticeCookieDomain = '';
5656
 57+// Server-side banner cache timeout in seconds
 58+$wgNoticeBannerMaxAge = 600;
 59+
5760 // When the cookie set in SpecialHideBanners.php should expire
5861 // This would typically be the end date for a fundraiser
5962 // NOTE: This must be in UNIX timestamp format, for example, '1325462400'
Property changes on: branches/wmf/1.18wmf1/extensions/CentralNotice/CentralNotice.php
___________________________________________________________________
Modified: svn:mergeinfo
6063 Merged /trunk/extensions/CentralNotice/CentralNotice.php:r109081

Status & tagging log