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;
/**
array( &$this, $categories, &$this->mCategoryLinks ) )
) {
foreach ( $categories as $category => $type ) {
+ // array keys will cast numeric category names to ints, so cast back to string
+ $category = (string)$category;
$origcategory = $category;
$title = Title::makeTitleSafe( NS_CATEGORY, $category );
if ( !$title ) {
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 );
}
/**
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 {
# 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;
// 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 ) );
*/
public function userCanPreview() {
$request = $this->getRequest();
- if ( $request->getVal( 'action' ) !== 'submit' || !$request->wasPosted() ) {
+ if (
+ $request->getVal( 'action' ) !== 'submit' ||
+ !$request->getCheck( 'wpPreview' ) ||
+ !$request->wasPosted()
+ ) {
return false;
}