MediaWiki  REL1_22
Interwiki Class Reference

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

List of all members.

Public Member Functions

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

Static Public Member Functions

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

Public Attributes

 $mAPI
 $mLocal
 $mTrans
 $mURL
 $mWikiID
const CACHE_LIMIT = 100

Static Protected Member Functions

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

Protected Attributes

 $mPrefix

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

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

Definition at line 36 of file Interwiki.php.


Member Function Documentation

static Interwiki::fetch ( prefix) [static]

Fetch an Interwiki object.

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

Definition at line 64 of file Interwiki.php.

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

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

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 325 of file Interwiki.php.

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

Referenced by ApiQuerySiteinfo\appendInterwikiMap().

static Interwiki::getAllPrefixesCached ( local) [static, protected]

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 230 of file Interwiki.php.

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

Referenced by getAllPrefixes().

static Interwiki::getAllPrefixesDB ( local) [static, protected]

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 294 of file Interwiki.php.

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

Referenced by getAllPrefixes().

Get the API URL for this wiki.

Returns:
string The URL

Definition at line 357 of file Interwiki.php.

Get a description for this interwiki.

Returns:
string

Definition at line 405 of file Interwiki.php.

References wfMessage().

static Interwiki::getInterwikiCached ( prefix) [static, protected]

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 98 of file Interwiki.php.

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

Referenced by fetch().

static Interwiki::getInterwikiCacheEntry ( prefix) [static, protected]

Get entry from interwiki cache.

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

Definition at line 121 of file Interwiki.php.

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

Referenced by getInterwikiCached().

Get the name for the interwiki site.

Returns:
string

Definition at line 395 of file Interwiki.php.

References wfMessage().

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 344 of file Interwiki.php.

References $title, and wfUrlencode().

Get the DB name for this wiki.

Returns:
string The DB name

Definition at line 366 of file Interwiki.php.

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

Returns:
bool

Definition at line 376 of file Interwiki.php.

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

Returns:
bool

Definition at line 386 of file Interwiki.php.

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 53 of file Interwiki.php.

References $result, and fetch().

Referenced by Title\secureAndSplit().

static Interwiki::load ( prefix) [static, protected]

Load the interwiki, trying first memcached then the DB.

Parameters:
string$prefixThe interwiki prefix
Returns:
bool If $prefix is valid

Definition at line 159 of file Interwiki.php.

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

Referenced by fetch().

static Interwiki::loadFromArray ( mc) [static, protected]

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 209 of file Interwiki.php.

Referenced by load().

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 415 of file Interwiki.php.

References array().


Member Data Documentation

Interwiki::$mAPI

Definition at line 34 of file Interwiki.php.

Interwiki::$mLocal

Definition at line 34 of file Interwiki.php.

Interwiki::$mPrefix [protected]

Definition at line 34 of file Interwiki.php.

Interwiki::$mTrans

Definition at line 34 of file Interwiki.php.

Interwiki::$mURL

Definition at line 34 of file Interwiki.php.

Interwiki::$mWikiID

Definition at line 34 of file Interwiki.php.

Interwiki::$smCache = array() [static, protected]

Definition at line 31 of file Interwiki.php.

Definition at line 32 of file Interwiki.php.


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