MediaWiki  1.23.0
SquidUpdate Class Reference

Handles purging appropriate Squid URLs given a title (or titles) More...

Public Member Functions

 __construct ( $urlArr=array(), $maxTitles=false)
 
 doUpdate ()
 Purges the list of URLs passed to the constructor. More...
 

Static Public Member Functions

static expand ( $url)
 Expand local URLs to fully-qualified URLs using the internal protocol and host defined in $wgInternalServer. More...
 
static HTCPPurge ( $urlArr)
 Send Hyper Text Caching Protocol (HTCP) CLR requests. More...
 
static newFromLinksTo (Title $title)
 Create a SquidUpdate from the given Title object. More...
 
static newFromTitles ( $titles, $urlArr=array())
 Create a SquidUpdate from an array of Title objects, or a TitleArray object. More...
 
static newSimplePurge (Title $title)
 
static purge ( $urlArr)
 Purges a list of Squids defined in $wgSquidServers. More...
 

Protected Attributes

array $urlArr
 Collection of URLs to purge. More...
 

Static Private Member Functions

static getRuleForURL ( $url, $rules)
 Find the HTCP routing rule to use for a given URL. More...
 

Detailed Description

Handles purging appropriate Squid URLs given a title (or titles)

Definition at line 28 of file SquidUpdate.php.

Constructor & Destructor Documentation

◆ __construct()

SquidUpdate::__construct (   $urlArr = array(),
  $maxTitles = false 
)
Parameters
array$urlArrCollection of URLs to purge
bool | int$maxTitlesMaximum number of unique URLs to purge

Definition at line 38 of file SquidUpdate.php.

References $urlArr, and global.

Member Function Documentation

◆ doUpdate()

SquidUpdate::doUpdate ( )

Purges the list of URLs passed to the constructor.

Definition at line 122 of file SquidUpdate.php.

References purge().

◆ expand()

static SquidUpdate::expand (   $url)
static

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 291 of file SquidUpdate.php.

References PROTO_INTERNAL, and wfExpandUrl().

Referenced by HTCPPurge(), and SquidPurgeClient\queuePurge().

◆ getRuleForURL()

static SquidUpdate::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 301 of file SquidUpdate.php.

References as.

Referenced by HTCPPurge().

◆ HTCPPurge()

static SquidUpdate::HTCPPurge (   $urlArr)
static

Send Hyper Text Caching Protocol (HTCP) CLR requests.

Exceptions
MWException
Parameters
array$urlArrCollection of URLs to purge

Definition at line 183 of file SquidUpdate.php.

References $urlArr, array(), as, expand(), getRuleForURL(), global, UIDGenerator\newSequentialPerNodeIDs(), UIDGenerator\QUICK_VOLATILE, wfDebugLog(), wfProfileIn(), and wfProfileOut().

Referenced by purge().

◆ newFromLinksTo()

static SquidUpdate::newFromLinksTo ( Title  $title)
static

Create a SquidUpdate from the given Title object.

The resulting SquidUpdate will purge the given Title's URLs as well as the pages that link to it. Capped at $wgMaxSquidPurgeTitles total URLs.

Parameters
Title$title
Returns
SquidUpdate

Definition at line 62 of file SquidUpdate.php.

References $dbr, $res, $title, array(), as, DB_SLAVE, global, Title\makeTitle(), wfGetDB(), wfProfileIn(), and wfProfileOut().

◆ newFromTitles()

static SquidUpdate::newFromTitles (   $titles,
  $urlArr = array() 
)
static

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

Parameters
array$titles
array$urlArr
Returns
SquidUpdate

Definition at line 95 of file SquidUpdate.php.

References $title, $titles, $urlArr, as, and global.

Referenced by HTMLCacheUpdateJob\invalidateTitles().

◆ newSimplePurge()

static SquidUpdate::newSimplePurge ( Title  $title)
static
Parameters
Title$title
Returns
SquidUpdate

Definition at line 113 of file SquidUpdate.php.

References $title, and $urlArr.

Referenced by WikiPage\doPurge().

◆ purge()

static SquidUpdate::purge (   $urlArr)
static

Purges a list of Squids defined in $wgSquidServers.

$urlArr should contain the full URLs to purge as values (example: $urlArr[] = 'http://my.host/something') XXX report broken Squids per mail or log

Parameters
array$urlArrList of full URLs to purge

Definition at line 134 of file SquidUpdate.php.

References $urlArr, as, global, HTCPPurge(), wfDebugLog(), wfProfileIn(), and wfProfileOut().

Referenced by BenchmarkPurge\benchSquid(), LocalFile\delete(), LocalFile\deleteOld(), RevDel_FileList\doPostCommitUpdates(), doUpdate(), LocalFile\purgeCache(), LocalFile\purgeOldThumbnails(), LocalFile\purgeThumbnails(), LocalFile\recordUpload2(), and File\transform().

Member Data Documentation

◆ $urlArr

array SquidUpdate::$urlArr
protected

Collection of URLs to purge.

Definition at line 32 of file SquidUpdate.php.

Referenced by __construct(), HTCPPurge(), newFromTitles(), newSimplePurge(), and purge().


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