MediaWiki r1424 - Code Review

Jump to: navigation, search
Repository:MediaWiki
Revision:r1423‎ | r1424 (on ViewVC)‎ | r1425 >
Date:10:18, 3 July 2003
Author:vibber
Status:old
Tags:
Comment:
Fixes missing cache-control and last-modified headers with file cached pages.
HOWEVER, the session cookie seems to override our cache control. May need to
mess with this to get things working smoothly.

Also, caching + gzip may be a difficult combination.
Modified paths:

Diff [purge]

Index: trunk/phase3/includes/Article.php
===================================================================
--- trunk/phase3/includes/Article.php	(revision 1423)
+++ trunk/phase3/includes/Article.php	(revision 1424)
@@ -1640,7 +1640,7 @@
 	}
 
 	function loadFromFileCache() {
-		global $wgUseGzip;
+		global $wgUseGzip, $wgOut;
 		wfDebug(" loadFromFileCache()\n");
 		$filename=$this->fileCacheName();
 		$filenamegz = "{$filename}.gz";
@@ -1653,6 +1653,7 @@
 			header( "Vary: Accept-Encoding" );
 			$filename = $filenamegz;
 		}
+		$wgOut->sendCacheControl();
 		readfile( $filename );
 	}
 	
Index: trunk/phase3/includes/OutputPage.php
===================================================================
--- trunk/phase3/includes/OutputPage.php	(revision 1423)
+++ trunk/phase3/includes/OutputPage.php	(revision 1424)
@@ -303,6 +303,18 @@
 		wfProfileOut();
 	}
 
+	function sendCacheControl() {
+		if( $this->mLastModified != "" ) {
+			header( "Cache-Control: private, must-revalidate, max-age=0" );
+			header( "Last-modified: {$this->mLastModified}" );
+		} else {
+			header( "Cache-Control: no-cache" ); # Experimental - see below
+			header( "Pragma: no-cache" );
+			header( "Last-modified: " . gmdate( "D, j M Y H:i:s" ) . " GMT" );
+		}
+		header( "Expires: Mon, 15 Jan 2001 00:00:00 GMT" ); # Cachers always validate the page!
+	}
+	
 	# Finally, all the text has been munged and accumulated into
 	# the object, let's actually output it:
 	#
@@ -314,15 +326,7 @@
 		$sk = $wgUser->getSkin();
 
 		wfProfileIn( "OutputPage::output-headers" );
-		if( $this->mLastModified != "" ) {
-			header( "Cache-Control: private, must-revalidate, max-age=0" );
-			header( "Last-modified: {$this->mLastModified}" );
-		} else {
-			header( "Cache-Control: no-cache" ); # Experimental - see below
-			header( "Pragma: no-cache" );
-			header( "Last-modified: " . gmdate( "D, j M Y H:i:s" ) . " GMT" );
-		}
-		header( "Expires: Mon, 15 Jan 2001 00:00:00 GMT" ); # Cachers always validate the page!
+		$this->sendCacheControl();
 
 		header( "Content-type: text/html; charset={$wgOutputEncoding}" );
 		header( "Content-language: {$wgLanguageCode}" );
@@ -649,7 +653,7 @@
 	#
 	function doWikiPass2( $text, $linestart )
 	{
-		global $wgUser, $wgLang;
+		global $wgUser, $wgLang, $wgMungeDates;
 		wfProfileIn( "OutputPage::doWikiPass2" );
 		
 		$text = $this->removeHTMLtags( $text );
@@ -662,7 +666,8 @@
 		$text = $this->doHeadings( $text );
 		$text = $this->doBlockLevels( $text, $linestart );
 		
-		$text = $wgLang->replaceDates( $text );
+		if($wgMungeDates)
+			$text = $wgLang->replaceDates( $text );
 		$text = $this->replaceExternalLinks( $text );
 		$text = $this->replaceInternalLinks ( $text );
 

Status & tagging log

  • 21:41, 11 October 2010 Reedy (Talk | contribs) changed the status of r1424 [removed: new added: old]
Personal tools
Namespaces
Variants
Views
Actions
Site
Support
Download
Development
Communication
Toolbox