MediaWiki REL1_34
CdnCacheUpdate Class Reference

Handles purging the appropriate CDN objects given a list of URLs or Title instances. More...

Inheritance diagram for CdnCacheUpdate:
Collaboration diagram for CdnCacheUpdate:

Public Member Functions

 __construct (array $urlArr)
 
 doUpdate ()
 Purges the list of URLs passed to the constructor.
 
 merge (MergeableUpdate $update)
 Merge this update with $update.
 

Static Public Member Functions

static newFromTitles ( $titles, $urlArr=[])
 Create an update object from an array of Title objects, or a TitleArray object.
 
static purge (array $urlArr)
 Purges a list of CDN nodes defined in $wgCdnServers.
 

Static Private Member Functions

static expand ( $url)
 Expand local URLs to fully-qualified URLs using the internal protocol and host defined in $wgInternalServer.
 
static getRuleForURL ( $url, $rules)
 Find the HTCP routing rule to use for a given URL.
 
static HTCPPurge (array $urlArr)
 Send Hyper Text Caching Protocol (HTCP) CLR requests.
 

Private Attributes

string[] $urls = []
 Collection of URLs to purge.
 

Detailed Description

Handles purging the appropriate CDN objects given a list of URLs or Title instances.

Definition at line 30 of file CdnCacheUpdate.php.

Constructor & Destructor Documentation

◆ __construct()

CdnCacheUpdate::__construct ( array  $urlArr)
Parameters
string[]$urlArrCollection of URLs to purge

Definition at line 37 of file CdnCacheUpdate.php.

Member Function Documentation

◆ doUpdate()

CdnCacheUpdate::doUpdate ( )

Purges the list of URLs passed to the constructor.

Implements DeferrableUpdate.

Definition at line 69 of file CdnCacheUpdate.php.

References $wgCdnReboundPurgeDelay, and purge().

◆ expand()

static CdnCacheUpdate::expand (   $url)
staticprivate

Expand local URLs to fully-qualified URLs using the internal protocol and host defined in $wgInternalServer.

Input that's already fully- qualified will be passed through unchanged.

This is used to generate purge URLs that may be either local to the main wiki or include a non-native host, such as images hosted on a second internal server.

Client functions should not need to call this.

Parameters
string$url
Returns
string

Definition at line 257 of file CdnCacheUpdate.php.

References PROTO_INTERNAL, and wfExpandUrl().

Referenced by HTCPPurge().

◆ getRuleForURL()

static CdnCacheUpdate::getRuleForURL (   $url,
  $rules 
)
staticprivate

Find the HTCP routing rule to use for a given URL.

Parameters
string$urlURL to match
array$rulesArray of rules, see $wgHTCPRouting for format and behavior
Returns
mixed Element of $rules that matched, or false if nothing matched

Definition at line 267 of file CdnCacheUpdate.php.

Referenced by HTCPPurge().

◆ HTCPPurge()

static CdnCacheUpdate::HTCPPurge ( array  $urlArr)
staticprivate

Send Hyper Text Caching Protocol (HTCP) CLR requests.

Exceptions
MWException
Parameters
string[]$urlArrCollection of URLs to purge

Definition at line 156 of file CdnCacheUpdate.php.

References $wgHTCPMulticastTTL, $wgHTCPRouting, expand(), getRuleForURL(), UIDGenerator\newSequentialPerNodeIDs(), UIDGenerator\QUICK_VOLATILE, and wfDebugLog().

Referenced by purge().

◆ merge()

CdnCacheUpdate::merge ( MergeableUpdate  $update)

Merge this update with $update.

Parameters
MergeableUpdate$updateUpdate of the same class type

Implements MergeableUpdate.

Definition at line 41 of file CdnCacheUpdate.php.

◆ newFromTitles()

static CdnCacheUpdate::newFromTitles (   $titles,
  $urlArr = [] 
)
static

Create an update object from an array of Title objects, or a TitleArray object.

Parameters
Traversable | Title[]$titles
string[]$urlArr
Returns
CdnCacheUpdate

Definition at line 56 of file CdnCacheUpdate.php.

References $title.

◆ purge()

static CdnCacheUpdate::purge ( array  $urlArr)
static

Purges a list of CDN nodes defined in $wgCdnServers.

$urlArr should contain the full URLs to purge as values (example: $urlArr[] = 'http://my.host/something')

Parameters
string[]$urlArrList of full URLs to purge

Definition at line 89 of file CdnCacheUpdate.php.

References $wgCdnServers, $wgHTCPRouting, HTCPPurge(), and wfDebugLog().

Referenced by BenchmarkPurge\benchCdn(), doUpdate(), HTMLCacheUpdateJob\invalidateTitles(), and CdnPurgeJob\run().

Member Data Documentation

◆ $urls

string [] CdnCacheUpdate::$urls = []
private

Collection of URLs to purge.

Definition at line 32 of file CdnCacheUpdate.php.


The documentation for this class was generated from the following file: