Rename setSquidMaxage() => setCdnMaxage()
authorAaron Schulz <aschulz@wikimedia.org>
Thu, 10 Dec 2015 01:07:05 +0000 (17:07 -0800)
committerAaron Schulz <aschulz@wikimedia.org>
Thu, 10 Dec 2015 01:11:23 +0000 (17:11 -0800)
Also updated the OutputPage member variable.

Change-Id: I0b41c66da58c6126c1bd96170c02d084a067383c

includes/MediaWiki.php
includes/OutputPage.php
includes/page/Article.php
includes/skins/Skin.php
includes/specials/SpecialRecentchanges.php

index c4ea536..50f2dad 100644 (file)
@@ -308,7 +308,7 @@ class MediaWiki {
                $targetUrl = wfExpandUrl( $title->getFullURL(), PROTO_CURRENT );
 
                if ( $targetUrl != $request->getFullRequestURL() ) {
-                       $output->setSquidMaxage( 1200 );
+                       $output->setCdnMaxage( 1200 );
                        $output->redirect( $targetUrl, '301' );
                        return true;
                }
@@ -451,7 +451,7 @@ class MediaWiki {
                                        $requestTitle->getSquidURLs()
                                )
                        ) {
-                               $output->setSquidMaxage( $this->config->get( 'SquidMaxage' ) );
+                               $output->setCdnMaxage( $this->config->get( 'SquidMaxage' ) );
                        }
 
                        $action->show();
index 00143c7..b7f5558 100644 (file)
@@ -233,8 +233,8 @@ class OutputPage extends ContextSource {
        private $mParseWarnings = array();
 
        /** @var int Cache stuff. Looks like mEnableClientCache */
-       protected $mSquidMaxage = 0;
-       /** @var int Upper limit on mSquidMaxage */
+       protected $mCdnMaxage = 0;
+       /** @var int Upper limit on mCdnMaxage */
        protected $mCdnMaxageLimit = INF;
 
        /**
@@ -1943,24 +1943,32 @@ class OutputPage extends ContextSource {
                return Parser::stripOuterParagraph( $parsed );
        }
 
+       /**
+        * @param $maxage
+        * @deprecated since 1.27 Use setCdnMaxage() instead
+        */
+       public function setSquidMaxage( $maxage ) {
+               $this->setCdnMaxage( $maxage );
+       }
+
        /**
         * Set the value of the "s-maxage" part of the "Cache-control" HTTP header
         *
-        * @param int $maxage Maximum cache time on the Squid, in seconds.
+        * @param int $maxage Maximum cache time on the CDN, in seconds.
         */
-       public function setSquidMaxage( $maxage ) {
-               $this->mSquidMaxage = min( $maxage, $this->mCdnMaxageLimit );
+       public function setCdnMaxage( $maxage ) {
+               $this->mCdnMaxage = min( $maxage, $this->mCdnMaxageLimit );
        }
 
        /**
         * Lower the value of the "s-maxage" part of the "Cache-control" HTTP header
         *
-        * @param int $maxage Maximum cache time on the Squid, in seconds
+        * @param int $maxage Maximum cache time on the CDN, in seconds
         * @since 1.27
         */
        public function lowerCdnMaxage( $maxage ) {
                $this->mCdnMaxageLimit = min( $maxage, $this->mCdnMaxageLimit );
-               $this->setSquidMaxage( $this->mSquidMaxage );
+               $this->setCdnMaxage( $this->mCdnMaxage );
        }
 
        /**
@@ -2181,7 +2189,7 @@ class OutputPage extends ContextSource {
                if ( $this->mEnableClientCache ) {
                        if (
                                $config->get( 'UseSquid' ) && session_id() == '' && !$this->isPrintable() &&
-                               $this->mSquidMaxage != 0 && !$this->haveCacheVaryCookies()
+                               $this->mCdnMaxage != 0 && !$this->haveCacheVaryCookies()
                        ) {
                                if ( $config->get( 'UseESI' ) ) {
                                        # We'll purge the proxy cache explicitly, but require end user agents
@@ -2191,7 +2199,7 @@ class OutputPage extends ContextSource {
                                        # start with a shorter timeout for initial testing
                                        # header( 'Surrogate-Control: max-age=2678400+2678400, content="ESI/1.0"');
                                        $response->header( 'Surrogate-Control: max-age=' . $config->get( 'SquidMaxage' )
-                                               . '+' . $this->mSquidMaxage . ', content="ESI/1.0"' );
+                                               . '+' . $this->mCdnMaxage . ', content="ESI/1.0"' );
                                        $response->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
@@ -2201,7 +2209,7 @@ class OutputPage extends ContextSource {
                                        wfDebug( __METHOD__ . ": local proxy caching; {$this->mLastModified} **\n", 'log' );
                                        # start with a shorter timeout for initial testing
                                        # header( "Cache-Control: s-maxage=2678400, must-revalidate, max-age=0" );
-                                       $response->header( 'Cache-Control: s-maxage=' . $this->mSquidMaxage
+                                       $response->header( 'Cache-Control: s-maxage=' . $this->mCdnMaxage
                                                . ', must-revalidate, max-age=0' );
                                }
                        } else {
index 5d6435e..35621a4 100644 (file)
@@ -696,7 +696,7 @@ class Article implements Page {
 
                                        # Don't cache a dirty ParserOutput object
                                        if ( $poolArticleView->getIsDirty() ) {
-                                               $outputPage->setSquidMaxage( 0 );
+                                               $outputPage->setCdnMaxage( 0 );
                                                $outputPage->addHTML( "<!-- parser cache is expired, " .
                                                        "sending anyway due to pool overload-->\n" );
                                        }
index 8177371..a6a6814 100644 (file)
@@ -1446,7 +1446,7 @@ abstract class Skin extends ContextSource {
                        }
                        $newMessagesAlert = $newMessagesAlert->text();
                        # Disable Squid cache
-                       $out->setSquidMaxage( 0 );
+                       $out->setCdnMaxage( 0 );
                } elseif ( count( $newtalks ) ) {
                        $sep = $this->msg( 'newtalkseparator' )->escaped();
                        $msgs = array();
@@ -1459,7 +1459,7 @@ abstract class Skin extends ContextSource {
                        }
                        $parts = implode( $sep, $msgs );
                        $newMessagesAlert = $this->msg( 'youhavenewmessagesmulti' )->rawParams( $parts )->escaped();
-                       $out->setSquidMaxage( 0 );
+                       $out->setCdnMaxage( 0 );
                }
 
                return $newMessagesAlert;
index 44c9987..3a1621a 100644 (file)
@@ -50,7 +50,7 @@ class SpecialRecentChanges extends ChangesListSpecialPage {
                }
 
                // 10 seconds server-side caching max
-               $this->getOutput()->setSquidMaxage( 10 );
+               $this->getOutput()->setCdnMaxage( 10 );
                // Check if the client has a cached version
                $lastmod = $this->checkLastModified();
                if ( $lastmod === false ) {