made setSquidMaxage an accessor, default mSquidMaxage = 0
authorGabriel Wicke <gwicke@users.mediawiki.org>
Sat, 13 Mar 2004 13:42:17 +0000 (13:42 +0000)
committerGabriel Wicke <gwicke@users.mediawiki.org>
Sat, 13 Mar 2004 13:42:17 +0000 (13:42 +0000)
includes/OutputPage.php

index 7288b24..dd2cfd6 100644 (file)
@@ -32,6 +32,7 @@ class OutputPage {
                $this->mDoNothing = false;
                $this->mContainsOldMagic = $this->mContainsNewMagic = 0;
                $this->mParserOptions = ParserOptions::newFromUser( $temp = NULL );
+               $this->mSquidMaxage = 0;
        }
 
        function addHeader( $name, $val ) { array_push( $this->mHeaders, "$name: $val" ) ; }
@@ -173,12 +174,11 @@ class OutputPage {
 
        # Set the maximum cache time on the Squid in seconds
        function setSquidMaxage( $maxage ) {
-               global $wgSquidMaxage;
-               $wgSquidMaxage = $maxage;
+               $this->mSquidMaxage = $maxage;
        }
        
        function sendCacheControl() {
-               global $wgUseSquid, $wgUseESI, $wgSquidMaxage;
+               global $wgUseSquid, $wgUseESI;
                # FIXME: This header may cause trouble with some versions of Internet Explorer
                header( "Vary: Accept-Encoding, Cookie" );
                if( $this->mLastModified != "" ) {
@@ -192,7 +192,7 @@ class OutputPage {
                                        wfDebug( "** proxy caching with ESI; {$this->mLastModified} **\n", false );
                                        # start with a shorter timeout for initial testing
                                        # header( 'Surrogate-Control: max-age=2678400+2678400, content="ESI/1.0"');
-                                       header( 'Surrogate-Control: max-age='.$wgSquidMaxage.'+'.$wgSquidMaxage.', content="ESI/1.0"');
+                                       header( 'Surrogate-Control: max-age='.$wgSquidMaxage.'+'.$this->mSquidMaxage.', content="ESI/1.0"');
                                        header( 'Cache-Control: s-maxage=0, must-revalidate, max-age=0' );
                                } else {
                                        # We'll purge the proxy cache for anons explicitly, but require end user agents
@@ -202,7 +202,7 @@ class OutputPage {
                                        wfDebug( "** local proxy caching; {$this->mLastModified} **\n", false );
                                        # start with a shorter timeout for initial testing
                                        # header( "Cache-Control: s-maxage=2678400, must-revalidate, max-age=0" );
-                                       header( 'Cache-Control: s-maxage='.$wgSquidMaxage.', must-revalidate, max-age=0' );
+                                       header( 'Cache-Control: s-maxage='.$this->mSquidMaxage.', must-revalidate, max-age=0' );
                                }
                        } else {
                                # We do want clients to cache if they can, but they *must* check for updates