Change-Id: Idcc528daf28e119349155d36e30a9bcf61b2e7d5
19 files changed:
}
if ( $this->mCacheDuration ) {
}
if ( $this->mCacheDuration ) {
- # If squid caches are configured, tell them to cache the response,
- # and tell the client to always check with the squid. Otherwise,
+ # If CDN caches are configured, tell them to cache the response,
+ # and tell the client to always check with the CDN. Otherwise,
# tell the client to use a cached copy, without a way to purge it.
if ( $this->mConfig->get( 'UseSquid' ) ) {
# Expect explicit purge of the proxy cache, but require end user agents
# to revalidate against the proxy on each visit.
# tell the client to use a cached copy, without a way to purge it.
if ( $this->mConfig->get( 'UseSquid' ) ) {
# Expect explicit purge of the proxy cache, 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
if ( $this->mConfig->get( 'UseESI' ) ) {
header( 'Surrogate-Control: max-age=' . $this->mCacheDuration . ', content="ESI/1.0"' );
if ( $this->mConfig->get( 'UseESI' ) ) {
header( 'Surrogate-Control: max-age=' . $this->mCacheDuration . ', content="ESI/1.0"' );
/** @} */ # end of cache settings
/************************************************************************//**
/** @} */ # end of cache settings
/************************************************************************//**
- * @name HTTP proxy (Squid) settings
+ * @name HTTP proxy (CDN) settings
*
* Many of these settings apply to any HTTP proxy used in front of MediaWiki,
* although they are referred to as Squid settings for historical reasons.
*
* Many of these settings apply to any HTTP proxy used in front of MediaWiki,
* although they are referred to as Squid settings for historical reasons.
- * Enable/disable Squid.
* See https://www.mediawiki.org/wiki/Manual:Squid_caching
*/
$wgUseSquid = false;
* See https://www.mediawiki.org/wiki/Manual:Squid_caching
*/
$wgUseSquid = false;
$wgVaryOnXFP = false;
/**
$wgVaryOnXFP = false;
/**
- * Internal server name as known to Squid, if different.
+ * Internal server name as known to CDN, if different.
*
* @par Example:
* @code
*
* @par Example:
* @code
/**
* Cache TTL for the CDN sent as s-maxage (without ESI) or
* Surrogate-Control (with ESI). Without ESI, you should strip
/**
* Cache TTL for the CDN sent as s-maxage (without ESI) or
* Surrogate-Control (with ESI). Without ESI, you should strip
- * out s-maxage in the Squid config.
+ * out s-maxage in the CDN config.
*
* 18000 seconds = 5 hours, more cache hits with 2678400 = 31 days.
*/
*
* 18000 seconds = 5 hours, more cache hits with 2678400 = 31 days.
*/
$this->page->getComment() == $this->newSectionSummary()
) {
// Probably a duplicate submission of a new comment.
$this->page->getComment() == $this->newSectionSummary()
) {
// Probably a duplicate submission of a new comment.
- // This can happen when squid resends a request after
+ // This can happen when CDN resends a request after
// a timeout but the first one actually went through.
wfDebug( __METHOD__
. ": duplicate new section submission; trigger edit conflict!\n" );
// a timeout but the first one actually went through.
wfDebug( __METHOD__
. ": duplicate new section submission; trigger edit conflict!\n" );
/**
* Checks if an IP is a trusted proxy provider.
* Useful to tell if X-Forwarded-For data is possibly bogus.
/**
* Checks if an IP is a trusted proxy provider.
* Useful to tell if X-Forwarded-For data is possibly bogus.
- * Squid cache servers for the site are whitelisted.
+ * CDN cache servers for the site are whitelisted.
* @deprecated Since 1.24, use IP::isTrustedProxy()
*
* @param string $ip
* @deprecated Since 1.24, use IP::isTrustedProxy()
*
* @param string $ip
$action = Action::factory( $act, $page, $this->context );
if ( $action instanceof Action ) {
$action = Action::factory( $act, $page, $this->context );
if ( $action instanceof Action ) {
- # Let Squid cache things if we can purge them.
+ # Let CDN cache things if we can purge them.
if ( $this->config->get( 'UseSquid' ) &&
in_array(
// Use PROTO_INTERNAL because that's what getSquidURLs() uses
if ( $this->config->get( 'UseSquid' ) &&
in_array(
// Use PROTO_INTERNAL because that's what getSquidURLs() uses
- * Add a Content-Length header if possible. This makes it cooperate with squid better.
+ * Add a Content-Length header if possible. This makes it cooperate with CDN better.
*
* @param int $length
*/
*
* @param int $length
*/
if ( $config->get( 'UseESI' ) ) {
# We'll purge the proxy cache explicitly, but require end user agents
# to revalidate against the proxy on each visit.
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"');
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"');
} else {
# We'll purge the proxy cache for anons explicitly, but require end user agents
# to revalidate against the proxy on each visit.
} 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
# 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
// 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
// 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 ) );
$version = null;
if ( $group === 'user' ) {
$query['version'] = $resourceLoader->getCombinedVersion( $context, array_keys( $grpModules ) );
$wgContLanguageCode = $wgLanguageCode;
// Easy to forget to falsify $wgDebugToolbar for static caches.
$wgContLanguageCode = $wgLanguageCode;
// Easy to forget to falsify $wgDebugToolbar for static caches.
-// If file cache or squid cache is on, just disable this (DWIMD).
+// If file cache or CDN cache is on, just disable this (DWIMD).
if ( $wgUseFileCache || $wgUseSquid ) {
$wgDebugToolbar = false;
}
if ( $wgUseFileCache || $wgUseSquid ) {
$wgDebugToolbar = false;
}
/**
* Get the URL form for an internal link.
/**
* Get the URL form for an internal link.
- * - Used in various Squid-related code, in case we have a different
+ * - Used in various CDN-related code, in case we have a different
* internal hostname for the server from the exposed one.
*
* This uses $wgInternalServer to qualify the path, or $wgServer
* internal hostname for the server from the exposed one.
*
* This uses $wgInternalServer to qualify the path, or $wgServer
- * Get a list of URLs to purge from the Squid cache when this
+ * Get a list of URLs to purge from the CDN cache when this
* page changes
*
* @return string[] Array of String the URLs
* page changes
*
* @return string[] Array of String the URLs
- * Purge all applicable Squid URLs
+ * Purge all applicable CDN URLs
*/
public function purgeSquid() {
DeferredUpdates::addUpdate(
*/
public function purgeSquid() {
DeferredUpdates::addUpdate(
- * Update page_touched timestamps and send squid purge messages for
+ * Update page_touched timestamps and send CDN purge messages for
* pages linking to this title. May be sent to the job queue depending
* on the number of links. Typically called on create and delete.
*/
* pages linking to this title. May be sent to the job queue depending
* on the number of links. Typically called on create and delete.
*/
if ( $this->gen ) {
$smaxage = $config->get( 'SquidMaxage' );
} elseif ( $contentType == 'text/css' || $contentType == 'text/javascript' ) {
if ( $this->gen ) {
$smaxage = $config->get( 'SquidMaxage' );
} elseif ( $contentType == 'text/css' || $contentType == 'text/javascript' ) {
- // CSS/JS raw content has its own squid max age configuration.
+ // CSS/JS raw content has its own CDN max age configuration.
// Note: Title::getSquidURLs() includes action=raw for css/js pages,
// so if using the canonical url, this will get HTCP purges.
$smaxage = intval( $config->get( 'ForcedRawSMaxage' ) );
} else {
// Note: Title::getSquidURLs() includes action=raw for css/js pages,
// so if using the canonical url, this will get HTCP purges.
$smaxage = intval( $config->get( 'ForcedRawSMaxage' ) );
} else {
- // No squid cache for anything else
+ // No CDN cache for anything else
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
use Wikimedia\Assert\Assert;
/**
use Wikimedia\Assert\Assert;
/**
- * Handles purging appropriate Squid URLs given a title (or titles)
+ * Handles purging appropriate CDN URLs given a title (or titles)
* @ingroup Cache
*/
class CdnCacheUpdate implements DeferrableUpdate, MergeableUpdate {
* @ingroup Cache
*/
class CdnCacheUpdate implements DeferrableUpdate, MergeableUpdate {
- * Purges a list of Squids defined in $wgSquidServers.
+ * Purges a list of CDN nodes defined in $wgSquidServers.
* $urlArr should contain the full URLs to purge as values
* (example: $urlArr[] = 'http://my.host/something')
* $urlArr should contain the full URLs to purge as values
* (example: $urlArr[] = 'http://my.host/something')
- * XXX report broken Squids per mail or log
*
* @param string[] $urlArr List of full URLs to purge
*/
*
* @param string[] $urlArr List of full URLs to purge
*/
- * Refresh metadata in memcached, but don't touch thumbnails or squid
+ * Refresh metadata in memcached, but don't touch thumbnails or CDN
*/
function purgeMetadataCache() {
$this->invalidateCache();
}
/**
*/
function purgeMetadataCache() {
$this->invalidateCache();
}
/**
- * Delete all previously generated thumbnails, refresh metadata in memcached and purge the squid.
+ * Delete all previously generated thumbnails, refresh metadata in memcached and purge the CDN.
*
* @param array $options An array potentially with the key forThumbRefresh.
*
*
* @param array $options An array potentially with the key forThumbRefresh.
*
// Delete thumbnails
$this->purgeThumbnails( $options );
// Delete thumbnails
$this->purgeThumbnails( $options );
- // Purge squid cache for this file
+ // Purge CDN cache for this file
DeferredUpdates::addUpdate(
new CdnCacheUpdate( array( $this->getUrl() ) ),
DeferredUpdates::PRESEND
DeferredUpdates::addUpdate(
new CdnCacheUpdate( array( $this->getUrl() ) ),
DeferredUpdates::PRESEND
$dir = array_shift( $files );
$this->purgeThumbList( $dir, $files );
$dir = array_shift( $files );
$this->purgeThumbList( $dir, $files );
$urls = array();
foreach ( $files as $file ) {
$urls[] = $this->getArchiveThumbUrl( $archiveName, $file );
$urls = array();
foreach ( $files as $file ) {
$urls[] = $this->getArchiveThumbUrl( $archiveName, $file );
public function purgeThumbnails( $options = array() ) {
// Delete thumbnails
$files = $this->getThumbnails();
public function purgeThumbnails( $options = array() ) {
// Delete thumbnails
$files = $this->getThumbnails();
- // Always purge all files from squid regardless of handler filters
+ // Always purge all files from CDN regardless of handler filters
$urls = array();
foreach ( $files as $file ) {
$urls[] = $this->getThumbUrl( $file );
$urls = array();
foreach ( $files as $file ) {
$urls[] = $this->getThumbUrl( $file );
$dir = array_shift( $files );
$this->purgeThumbList( $dir, $files );
$dir = array_shift( $files );
$this->purgeThumbList( $dir, $files );
DeferredUpdates::addUpdate( new CdnCacheUpdate( $urls ), DeferredUpdates::PRESEND );
}
DeferredUpdates::addUpdate( new CdnCacheUpdate( $urls ), DeferredUpdates::PRESEND );
}
if ( $newPageContent ) {
# New file page; create the description page.
# There's already a log entry, so don't make a second RC entry
if ( $newPageContent ) {
# New file page; create the description page.
# There's already a log entry, so don't make a second RC entry
- # Squid and file cache for the description page are purged by doEditContent.
+ # CDN and file cache for the description page are purged by doEditContent.
$status = $wikiPage->doEditContent(
$newPageContent,
$comment,
$status = $wikiPage->doEditContent(
$newPageContent,
$comment,
if ( $reupload ) {
# Delete old thumbnails
$that->purgeThumbnails();
if ( $reupload ) {
# Delete old thumbnails
$that->purgeThumbnails();
- # Remove the old file from the squid cache
+ # Remove the old file from the CDN cache
DeferredUpdates::addUpdate(
new CdnCacheUpdate( array( $that->getUrl() ) ),
DeferredUpdates::PRESEND
DeferredUpdates::addUpdate(
new CdnCacheUpdate( array( $that->getUrl() ) ),
DeferredUpdates::PRESEND
$purgeUrls = array();
foreach ( $archiveNames as $archiveName ) {
$purgeUrls[] = $this->getArchiveUrl( $archiveName );
$purgeUrls = array();
foreach ( $archiveNames as $archiveName ) {
$purgeUrls[] = $this->getArchiveUrl( $archiveName );
background. All jobs subclass the Job object and put the main logic in the
function called run().
* The JobQueue object represents a particular queue of jobs of a certain type.
background. All jobs subclass the Job object and put the main logic in the
function called run().
* The JobQueue object represents a particular queue of jobs of a certain type.
- For example there may be a queue for email jobs and a queue for squid purge
+ For example there may be a queue for email jobs and a queue for CDN purge
jobs.
\section jobqueue Job queues
jobs.
\section jobqueue Job queues
settings (including journal fsync() frequency). Some queue types may totally remove
jobs when dequeued while leaving the ack() function as a no-op; if a job is
dequeued by a job runner, which crashes before completion, the job will be
settings (including journal fsync() frequency). Some queue types may totally remove
jobs when dequeued while leaving the ack() function as a no-op; if a job is
dequeued by a job runner, which crashes before completion, the job will be
-lost. Some jobs, like purging squid caches after a template change, may not
+lost. Some jobs, like purging CDN caches after a template change, may not
require durable queues, whereas other jobs might be more important.
\section aggregator Job queue aggregator
require durable queues, whereas other jobs might be more important.
\section aggregator Job queue aggregator
$u = CdnCacheUpdate::newFromTitles( $titleArray );
$u->doUpdate();
$u = CdnCacheUpdate::newFromTitles( $titleArray );
$u->doUpdate();
// Invalidate the caches of all pages which redirect here
DeferredUpdates::addUpdate( new HTMLCacheUpdate( $title, 'redirect' ) );
// Invalidate the caches of all pages which redirect here
DeferredUpdates::addUpdate( new HTMLCacheUpdate( $title, 'redirect' ) );
- // Purge squid for this page only
+ // Purge CDN for this page only
$title->purgeSquid();
// Clear file cache for this page only
HTMLFileCache::clearFileCache( $title );
$title->purgeSquid();
// Clear file cache for this page only
HTMLFileCache::clearFileCache( $title );
)->numParams( $plural );
}
$newMessagesAlert = $newMessagesAlert->text();
)->numParams( $plural );
}
$newMessagesAlert = $newMessagesAlert->text();
$out->setCdnMaxage( 0 );
} elseif ( count( $newtalks ) ) {
$sep = $this->msg( 'newtalkseparator' )->escaped();
$out->setCdnMaxage( 0 );
} elseif ( count( $newtalks ) ) {
$sep = $this->msg( 'newtalkseparator' )->escaped();
return;
}
$this->getOutput()->disable();
return;
}
$this->getOutput()->disable();
- # We mustn't allow the output to be Squid cached, otherwise
+ # We mustn't allow the output to be CDN cached, otherwise
# if an admin previews a deleted image, and it's cached, then
# a user without appropriate permissions can toddle off and
# if an admin previews a deleted image, and it's cached, then
# a user without appropriate permissions can toddle off and
- # nab the image, and Squid will serve it
+ # nab the image, and CDN will serve it
$this->getRequest()->response()->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' );
$this->getRequest()->response()->header(
'Cache-Control: no-cache, no-store, max-age=0, must-revalidate'
$this->getRequest()->response()->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' );
$this->getRequest()->response()->header(
'Cache-Control: no-cache, no-store, max-age=0, must-revalidate'
private function showFile( $key ) {
$this->getOutput()->disable();
private function showFile( $key ) {
$this->getOutput()->disable();
- # We mustn't allow the output to be Squid cached, otherwise
+ # We mustn't allow the output to be CDN cached, otherwise
# if an admin previews a deleted image, and it's cached, then
# a user without appropriate permissions can toddle off and
# if an admin previews a deleted image, and it's cached, then
# a user without appropriate permissions can toddle off and
- # nab the image, and Squid will serve it
+ # nab the image, and CDN will serve it
$response = $this->getRequest()->response();
$response->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' );
$response->header( 'Cache-Control: no-cache, no-store, max-age=0, must-revalidate' );
$response = $this->getRequest()->response();
$response->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' );
$response->header( 'Cache-Control: no-cache, no-store, max-age=0, must-revalidate' );
/**
* Checks if an IP is a trusted proxy provider.
* Useful to tell if X-Forwarded-For data is possibly bogus.
/**
* Checks if an IP is a trusted proxy provider.
* Useful to tell if X-Forwarded-For data is possibly bogus.
- * Squid cache servers for the site are whitelisted.
+ * CDN cache servers for the site are whitelisted.
* @since 1.24
*
* @param string $ip
* @since 1.24
*
* @param string $ip