MediaWiki  1.23.6
Interwiki Class Reference

The interwiki class All information is loaded on creation when called by Interwiki::fetch( $prefix ). More...

Collaboration diagram for Interwiki:

Public Member Functions

 __construct ( $prefix=null, $url='', $api='', $wikiId='', $local=0, $trans=0)
 
 getAPI ()
 Get the API URL for this wiki. More...
 
 getDescription ()
 Get a description for this interwiki. More...
 
 getName ()
 Get the name for the interwiki site. More...
 
 getURL ( $title=null)
 Get the URL for a particular title (or with $1 if no title given) More...
 
 getWikiID ()
 Get the DB name for this wiki. More...
 
 isLocal ()
 Is this a local link from a sister project, or is it something outside, like Google. More...
 
 isTranscludable ()
 Can pages from this wiki be transcluded? Still requires $wgEnableScaryTransclusion. More...
 

Static Public Member Functions

static fetch ( $prefix)
 Fetch an Interwiki object. More...
 
static getAllPrefixes ( $local=null)
 Returns all interwiki prefixes. More...
 
static isValidInterwiki ( $prefix)
 Check whether an interwiki prefix exists. More...
 
static selectFields ()
 Return the list of interwiki fields that should be selected to create a new Interwiki object. More...
 

Public Attributes

const CACHE_LIMIT = 100
 

Static Protected Member Functions

static getAllPrefixesCached ( $local)
 Fetch all interwiki prefixes from interwiki cache. More...
 
static getAllPrefixesDB ( $local)
 Fetch all interwiki prefixes from DB. More...
 
static getInterwikiCached ( $prefix)
 Fetch interwiki prefix data from local cache in constant database. More...
 
static getInterwikiCacheEntry ( $prefix)
 Get entry from interwiki cache. More...
 
static load ( $prefix)
 Load the interwiki, trying first memcached then the DB. More...
 
static loadFromArray ( $mc)
 Fill in member variables from an array (e.g. More...
 

Protected Attributes

string $mAPI
 The URL of the file api.php *. More...
 
bool $mLocal
 whether the wiki is in this project * More...
 
string $mPrefix
 The interwiki prefix, (e.g. More...
 
bool $mTrans
 Whether interwiki transclusions are allowed *. More...
 
string $mURL
 The URL of the wiki, with "$1" as a placeholder for an article name. More...
 
string $mWikiID
 The name of the database (for a connection to be established with wfGetLB( 'wikiid' )) More...
 

Static Protected Attributes

static $smCache = array()
 

Detailed Description

The interwiki class All information is loaded on creation when called by Interwiki::fetch( $prefix ).

All work is done on slave, because this should never change (except during schema updates etc, which aren't wiki-related)

Definition at line 29 of file Interwiki.php.

Constructor & Destructor Documentation

◆ __construct()

Interwiki::__construct (   $prefix = null,
  $url = '',
  $api = '',
  $wikiId = '',
  $local = 0,
  $trans = 0 
)

Definition at line 48 of file Interwiki.php.

Member Function Documentation

◆ fetch()

static Interwiki::fetch (   $prefix)
static

Fetch an Interwiki object.

Parameters
string$prefixInterwiki prefix to use
Returns
Interwiki|null|bool

Definition at line 77 of file Interwiki.php.

References $wgContLang, getInterwikiCached(), global, key, and load().

Referenced by Title\getLocalURL(), Title\getTransWikiID(), Title\isLocal(), Title\isTrans(), and isValidInterwiki().

◆ getAllPrefixes()

static Interwiki::getAllPrefixes (   $local = null)
static

Returns all interwiki prefixes.

Parameters
string | null$localIf set, limits output to local/non-local interwikis
Returns
array List of prefixes
Since
1.19

Definition at line 367 of file Interwiki.php.

References getAllPrefixesCached(), getAllPrefixesDB(), and global.

Referenced by NamespaceConflictChecker\getInterwikiList().

◆ getAllPrefixesCached()

static Interwiki::getAllPrefixesCached (   $local)
staticprotected

Fetch all interwiki prefixes from interwiki cache.

Parameters
null | string$localIf not null, limits output to local/non-local interwikis
Returns
array List of prefixes
Since
1.19

Definition at line 266 of file Interwiki.php.

References $e, $source, array(), as, global, list, CdbReader\open(), wfDebug(), and wfWikiID().

Referenced by getAllPrefixes().

◆ getAllPrefixesDB()

static Interwiki::getAllPrefixesDB (   $local)
staticprotected

Fetch all interwiki prefixes from DB.

Parameters
string | null$localIf not null, limits output to local/non-local interwikis
Returns
array List of prefixes
Since
1.19

Definition at line 334 of file Interwiki.php.

References $res, $retval, array(), as, DB_SLAVE, and wfGetDB().

Referenced by getAllPrefixes().

◆ getAPI()

Interwiki::getAPI ( )

Get the API URL for this wiki.

Returns
string The URL

Definition at line 400 of file Interwiki.php.

References $mAPI.

◆ getDescription()

Interwiki::getDescription ( )

Get a description for this interwiki.

Returns
string

Definition at line 449 of file Interwiki.php.

References wfMessage().

◆ getInterwikiCached()

static Interwiki::getInterwikiCached (   $prefix)
staticprotected

Fetch interwiki prefix data from local cache in constant database.

Note
More logic is explained in DefaultSettings.
Parameters
string$prefixInterwiki prefix
Returns
Interwiki object

Definition at line 117 of file Interwiki.php.

References $s, $value, getInterwikiCacheEntry(), and list.

Referenced by fetch().

◆ getInterwikiCacheEntry()

static Interwiki::getInterwikiCacheEntry (   $prefix)
staticprotected

Get entry from interwiki cache.

Note
More logic is explained in DefaultSettings.
Parameters
string$prefixDatabase key
Returns
string The interwiki entry

Definition at line 141 of file Interwiki.php.

References $e, $value, global, CdbReader\open(), wfDebug(), wfMemcKey(), and wfWikiID().

Referenced by getInterwikiCached().

◆ getName()

Interwiki::getName ( )

Get the name for the interwiki site.

Returns
string

Definition at line 438 of file Interwiki.php.

References wfMessage().

◆ getURL()

Interwiki::getURL (   $title = null)

Get the URL for a particular title (or with $1 if no title given)

Parameters
string$titleWhat text to put for the article name
Returns
string The URL
Note
Prior to 1.19 The getURL with an argument was broken. If you if you use this arg in an extension that supports MW earlier than 1.19 please wfUrlencode and substitute $1 on your own.

Definition at line 386 of file Interwiki.php.

References $mURL, $title, and wfUrlencode().

◆ getWikiID()

Interwiki::getWikiID ( )

Get the DB name for this wiki.

Returns
string The DB name

Definition at line 409 of file Interwiki.php.

References $mWikiID.

◆ isLocal()

Interwiki::isLocal ( )

Is this a local link from a sister project, or is it something outside, like Google.

Returns
bool

Definition at line 419 of file Interwiki.php.

References $mLocal.

◆ isTranscludable()

Interwiki::isTranscludable ( )

Can pages from this wiki be transcluded? Still requires $wgEnableScaryTransclusion.

Returns
bool

Definition at line 429 of file Interwiki.php.

References $mTrans.

◆ isValidInterwiki()

static Interwiki::isValidInterwiki (   $prefix)
static

Check whether an interwiki prefix exists.

Parameters
string$prefixInterwiki prefix to use
Returns
bool Whether it exists

Definition at line 65 of file Interwiki.php.

References fetch().

Referenced by MediaWikiTitleCodec\splitTitleString().

◆ load()

static Interwiki::load (   $prefix)
staticprotected

Load the interwiki, trying first memcached then the DB.

Parameters
string$prefixThe interwiki prefix
Returns
Interwiki|bool Interwiki if $prefix is valid, otherwise false

Definition at line 185 of file Interwiki.php.

References $wgMemc, array(), DB_SLAVE, global, loadFromArray(), wfGetDB(), wfMemcKey(), and wfRunHooks().

Referenced by fetch().

◆ loadFromArray()

static Interwiki::loadFromArray (   $mc)
staticprotected

Fill in member variables from an array (e.g.

memcached result, Database::fetchRow, etc)

Parameters
array$mcAssociative array: row from the interwiki table
Returns
Interwiki|bool Interwiki object or false if $mc['iw_url'] is not set

Definition at line 244 of file Interwiki.php.

Referenced by load().

◆ selectFields()

static Interwiki::selectFields ( )
static

Return the list of interwiki fields that should be selected to create a new Interwiki object.

Returns
string[]

Definition at line 460 of file Interwiki.php.

References array().

Member Data Documentation

◆ $mAPI

string Interwiki::$mAPI
protected

The URL of the file api.php *.

Definition at line 38 of file Interwiki.php.

Referenced by getAPI().

◆ $mLocal

bool Interwiki::$mLocal
protected

whether the wiki is in this project *

Definition at line 44 of file Interwiki.php.

Referenced by isLocal().

◆ $mPrefix

string Interwiki::$mPrefix
protected

The interwiki prefix, (e.g.

"Meatball", or the language prefix "de") *

Definition at line 34 of file Interwiki.php.

◆ $mTrans

bool Interwiki::$mTrans
protected

Whether interwiki transclusions are allowed *.

Definition at line 46 of file Interwiki.php.

Referenced by isTranscludable().

◆ $mURL

string Interwiki::$mURL
protected

The URL of the wiki, with "$1" as a placeholder for an article name.

Definition at line 36 of file Interwiki.php.

Referenced by getURL().

◆ $mWikiID

string Interwiki::$mWikiID
protected

The name of the database (for a connection to be established with wfGetLB( 'wikiid' ))

Definition at line 42 of file Interwiki.php.

Referenced by getWikiID().

◆ $smCache

Interwiki::$smCache = array()
staticprotected

Definition at line 31 of file Interwiki.php.

◆ CACHE_LIMIT

const Interwiki::CACHE_LIMIT = 100

Definition at line 32 of file Interwiki.php.


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