MediaWiki  1.23.15
LinkCache Class Reference

Cache for article titles (prefixed DB keys) and ids linked from one source. More...

Public Member Functions

 addBadLinkObj ( $title)
 
 addGoodLinkObj ( $id, $title, $len=-1, $redir=null, $revision=0, $model=0)
 Add a link for the title to the link cache. More...
 
 addGoodLinkObjFromRow ( $title, $row)
 Same as above with better interface. More...
 
 addLink ( $title)
 Add a title to the link cache, return the page_id or zero if non-existent. More...
 
 addLinkObj ( $nt)
 Add a title to the link cache, return the page_id or zero if non-existent. More...
 
 clear ()
 Clears cache. More...
 
 clearBadLink ( $title)
 
 clearLink ( $title)
 
 forUpdate ( $update=null)
 General accessor to get/set whether SELECT FOR UPDATE should be used. More...
 
 getBadLinks ()
 
 getGoodLinkFieldObj ( $title, $field)
 Get a field of a title object from cache. More...
 
 getGoodLinkID ( $title)
 
 getGoodLinks ()
 
 isBadLink ( $title)
 

Static Public Member Functions

static destroySingleton ()
 Destroy the singleton instance, a new one will be created next time singleton() is called. More...
 
static setSingleton (LinkCache $instance)
 Set the singleton instance to a given object. More...
 
static & singleton ()
 Get an instance of this class. More...
 

Static Protected Attributes

static $instance
 

Private Attributes

 $mBadLinks = array()
 
 $mClassVer = 4
 
 $mForUpdate = false
 
 $mGoodLinkFields = array()
 
 $mGoodLinks = array()
 

Detailed Description

Cache for article titles (prefixed DB keys) and ids linked from one source.

Definition at line 29 of file LinkCache.php.

Member Function Documentation

◆ addBadLinkObj()

LinkCache::addBadLinkObj (   $title)
Parameters
$titleTitle

Definition at line 168 of file LinkCache.php.

References $title, and isBadLink().

Referenced by addLinkObj().

◆ addGoodLinkObj()

LinkCache::addGoodLinkObj (   $id,
  $title,
  $len = -1,
  $redir = null,
  $revision = 0,
  $model = 0 
)

Add a link for the title to the link cache.

Parameters
int$idPage's ID
Title$title
int$lenText's length
int$redirWhether the page is a redirect
int$revisionLatest revision's ID
int$modelLatest revision's content model ID

Definition at line 134 of file LinkCache.php.

References $title, and array().

◆ addGoodLinkObjFromRow()

LinkCache::addGoodLinkObjFromRow (   $title,
  $row 
)

Same as above with better interface.

Since
1.19
Parameters
$titleTitle
$rowobject which has the fields page_id, page_is_redirect, page_latest and page_content_model

Definition at line 154 of file LinkCache.php.

References $title, and array().

Referenced by addLinkObj().

◆ addLink()

LinkCache::addLink (   $title)

Add a title to the link cache, return the page_id or zero if non-existent.

Parameters
string$titletitle to add
Returns
Integer

Definition at line 203 of file LinkCache.php.

References $title, addLinkObj(), and Title\newFromDBkey().

◆ addLinkObj()

LinkCache::addLinkObj (   $nt)

Add a title to the link cache, return the page_id or zero if non-existent.

Parameters
$ntTitle object to add
Returns
Integer

Definition at line 218 of file LinkCache.php.

References $f, $options, $s, addBadLinkObj(), addGoodLinkObjFromRow(), ALF_NO_LINK_LOCK, array(), DB_MASTER, DB_SLAVE, getGoodLinkID(), global, isBadLink(), wfGetDB(), wfProfileIn(), and wfProfileOut().

Referenced by addLink().

◆ clear()

LinkCache::clear ( )

Clears cache.

Definition at line 280 of file LinkCache.php.

References array().

◆ clearBadLink()

LinkCache::clearBadLink (   $title)

Definition at line 175 of file LinkCache.php.

References $title.

◆ clearLink()

LinkCache::clearLink (   $title)
Parameters
$titleTitle

Definition at line 182 of file LinkCache.php.

References $title.

◆ destroySingleton()

static LinkCache::destroySingleton ( )
static

Destroy the singleton instance, a new one will be created next time singleton() is called.

Since
1.22

Definition at line 63 of file LinkCache.php.

◆ forUpdate()

LinkCache::forUpdate (   $update = null)

General accessor to get/set whether SELECT FOR UPDATE should be used.

Parameters
$update
Returns
bool

Definition at line 84 of file LinkCache.php.

References wfSetVar().

◆ getBadLinks()

LinkCache::getBadLinks ( )

Definition at line 193 of file LinkCache.php.

◆ getGoodLinkFieldObj()

LinkCache::getGoodLinkFieldObj (   $title,
  $field 
)

Get a field of a title object from cache.

If this link is not good, it will return NULL.

Parameters
$titleTitle
string$field('length','redirect','revision','model')
Returns
mixed

Definition at line 107 of file LinkCache.php.

References $title.

◆ getGoodLinkID()

LinkCache::getGoodLinkID (   $title)
Parameters
$title
Returns
array|int

Definition at line 92 of file LinkCache.php.

References $title.

Referenced by addLinkObj().

◆ getGoodLinks()

LinkCache::getGoodLinks ( )

Definition at line 189 of file LinkCache.php.

References $mGoodLinks.

◆ isBadLink()

LinkCache::isBadLink (   $title)
Parameters
$title
Returns
bool

Definition at line 120 of file LinkCache.php.

References $title.

Referenced by addBadLinkObj(), and addLinkObj().

◆ setSingleton()

static LinkCache::setSingleton ( LinkCache  $instance)
static

Set the singleton instance to a given object.

Since we do not have an interface for LinkCache, you have to be sure the given object implements all the LinkCache public methods.

Parameters
LinkCache$instance
Since
1.22

Definition at line 74 of file LinkCache.php.

References $instance.

◆ singleton()

Member Data Documentation

◆ $instance

LinkCache::$instance
staticprotected

Definition at line 42 of file LinkCache.php.

Referenced by setSingleton(), and singleton().

◆ $mBadLinks

LinkCache::$mBadLinks = array()
private

Definition at line 36 of file LinkCache.php.

◆ $mClassVer

LinkCache::$mClassVer = 4
private

Definition at line 32 of file LinkCache.php.

◆ $mForUpdate

LinkCache::$mForUpdate = false
private

Definition at line 37 of file LinkCache.php.

◆ $mGoodLinkFields

LinkCache::$mGoodLinkFields = array()
private

Definition at line 35 of file LinkCache.php.

◆ $mGoodLinks

LinkCache::$mGoodLinks = array()
private

Definition at line 34 of file LinkCache.php.

Referenced by getGoodLinks().


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