X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FOutputPage.php;h=fea667e850327c7104a8204d3db14abf6d42df18;hb=9fbb5b9ea8f9e83ac2d5d3bb7fd3cee38b2eeff6;hp=00143c76f839cd9d37f2ea693a58affefd2bf554;hpb=764dc6ae51b301e25b0361d113990a01a1a44fa5;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 00143c76f8..fea667e850 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -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,27 +2189,27 @@ 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 # to revalidate against the proxy on each visit. - # Surrogate-Control controls our Squid, Cache-Control downstream caches + # Surrogate-Control controls our CDN, Cache-Control downstream caches wfDebug( __METHOD__ . ": proxy caching with ESI; {$this->mLastModified} **\n", 'log' ); # 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 # to revalidate against the proxy on each visit. - # IMPORTANT! The Squid needs to replace the Cache-Control header with + # IMPORTANT! The CDN needs to replace the Cache-Control header with # Cache-Control: s-maxage=0, must-revalidate, max-age=0 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 { @@ -2431,7 +2439,7 @@ class OutputPage extends ContextSource { # not especially useful as a returnto parameter. Use the title # from the request instead, if there was one. $request = $this->getRequest(); - $returnto = Title::newFromURL( $request->getVal( 'title', '' ) ); + $returnto = Title::newFromText( $request->getVal( 'title', '' ) ); if ( $action == 'edit' ) { $msg = 'whitelistedittext'; $displayReturnto = $returnto; @@ -2903,7 +2911,7 @@ class OutputPage extends ContextSource { // on-wiki like user pages, or user preferences; we need to find the highest // timestamp of these user-changeable modules so we can ensure cache misses on change // This should NOT be done for the site group (bug 27564) because anons get that too - // and we shouldn't be putting timestamps in Squid-cached HTML + // and we shouldn't be putting timestamps in CDN-cached HTML $version = null; if ( $group === 'user' ) { $query['version'] = $resourceLoader->getCombinedVersion( $context, array_keys( $grpModules ) );