MediaWiki
1.33.0
|
InterwikiLookup implementing the "classic" interwiki storage (hardcoded up to MW 1.26). More...
Public Member Functions | |
__construct (Language $contLang, WANObjectCache $objectCache, $objectCacheExpiry, $cdbData, $interwikiScopes, $fallbackSite) | |
fetch ( $prefix) | |
Fetch an Interwiki object. More... | |
getAllPrefixes ( $local=null) | |
Returns all interwiki prefixes. More... | |
invalidateCache ( $prefix) | |
Purge the in-process and object cache for an interwiki prefix. More... | |
isValidInterwiki ( $prefix) | |
Check whether an interwiki prefix exists. More... | |
resetLocalCache () | |
Resets locally cached Interwiki objects. More... | |
Private Member Functions | |
getAllPrefixesCached ( $local) | |
Fetch all interwiki prefixes from interwiki cache. More... | |
getAllPrefixesDB ( $local) | |
Fetch all interwiki prefixes from DB. More... | |
getCacheValue ( $key) | |
getInterwikiCached ( $prefix) | |
Fetch interwiki prefix data from local cache in constant database. More... | |
getInterwikiCacheEntry ( $prefix) | |
Get entry from interwiki cache. More... | |
load ( $prefix) | |
Load the interwiki, trying first memcached then the DB. More... | |
loadFromArray ( $mc) | |
Fill in member variables from an array (e.g. More... | |
Static Private Member Functions | |
static | selectFields () |
Return the list of interwiki fields that should be selected to create a new Interwiki object. More... | |
Private Attributes | |
bool array string | $cdbData |
CdbReader null | $cdbReader = null |
Language | $contLang |
string | $fallbackSite |
int | $interwikiScopes |
MapCacheLRU | $localCache |
WANObjectCache | $objectCache |
int | $objectCacheExpiry |
string null | $thisSite = null |
InterwikiLookup implementing the "classic" interwiki storage (hardcoded up to MW 1.26).
This implements two levels of caching (in-process array and a WANObjectCache) and tree storage backends (SQL, CDB, and plain PHP arrays).
All information is loaded on creation when called by $this->fetch( $prefix ). All work is done on replica DB, because this should never change (except during schema updates etc, which aren't wiki-related)
Definition at line 47 of file ClassicInterwikiLookup.php.
MediaWiki\Interwiki\ClassicInterwikiLookup::__construct | ( | Language | $contLang, |
WANObjectCache | $objectCache, | ||
$objectCacheExpiry, | |||
$cdbData, | |||
$interwikiScopes, | |||
$fallbackSite | |||
) |
Language | $contLang | Language object used to convert prefixes to lower case |
WANObjectCache | $objectCache | Cache for interwiki info retrieved from the database |
int | $objectCacheExpiry | Expiry time for $objectCache, in seconds |
bool | array | string | $cdbData | The path of a CDB file, or an array resembling the contents of a CDB file, or false to use the database. |
int | $interwikiScopes | Specify number of domains to check for messages:
|
string | $fallbackSite | The code to assume for the local site, |
Definition at line 107 of file ClassicInterwikiLookup.php.
References MediaWiki\Interwiki\ClassicInterwikiLookup\$cdbData, MediaWiki\Interwiki\ClassicInterwikiLookup\$contLang, MediaWiki\Interwiki\ClassicInterwikiLookup\$fallbackSite, MediaWiki\Interwiki\ClassicInterwikiLookup\$interwikiScopes, MediaWiki\Interwiki\ClassicInterwikiLookup\$objectCache, and MediaWiki\Interwiki\ClassicInterwikiLookup\$objectCacheExpiry.
MediaWiki\Interwiki\ClassicInterwikiLookup::fetch | ( | $prefix | ) |
Fetch an Interwiki object.
string | $prefix | Interwiki prefix to use |
Implements MediaWiki\Interwiki\InterwikiLookup.
Definition at line 143 of file ClassicInterwikiLookup.php.
References MediaWiki\Interwiki\ClassicInterwikiLookup\getInterwikiCached(), and MediaWiki\Interwiki\ClassicInterwikiLookup\load().
Referenced by MediaWiki\Interwiki\ClassicInterwikiLookup\isValidInterwiki().
MediaWiki\Interwiki\ClassicInterwikiLookup::getAllPrefixes | ( | $local = null | ) |
Returns all interwiki prefixes.
string | null | $local | If set, limits output to local/non-local interwikis |
Implements MediaWiki\Interwiki\InterwikiLookup.
Definition at line 436 of file ClassicInterwikiLookup.php.
References MediaWiki\Interwiki\ClassicInterwikiLookup\getAllPrefixesCached(), and MediaWiki\Interwiki\ClassicInterwikiLookup\getAllPrefixesDB().
|
private |
Fetch all interwiki prefixes from interwiki cache.
null | string | $local | If not null, limits output to local/non-local interwikis |
Definition at line 339 of file ClassicInterwikiLookup.php.
References $data, $e, MediaWiki\Interwiki\ClassicInterwikiLookup\$fallbackSite, $source, MediaWiki\Interwiki\ClassicInterwikiLookup\$thisSite, as, MediaWiki\Interwiki\ClassicInterwikiLookup\getCacheValue(), WikiMap\getCurrentWikiDbDomain(), WikiMap\getWikiIdFromDbDomain(), list, and wfDebug().
Referenced by MediaWiki\Interwiki\ClassicInterwikiLookup\getAllPrefixes().
|
private |
Fetch all interwiki prefixes from DB.
string | null | $local | If not null, limits output to local/non-local interwikis |
Definition at line 404 of file ClassicInterwikiLookup.php.
References $res, array(), as, DB_REPLICA, and wfGetDB().
Referenced by MediaWiki\Interwiki\ClassicInterwikiLookup\getAllPrefixes().
|
private |
Definition at line 249 of file ClassicInterwikiLookup.php.
References Makefile\open.
Referenced by MediaWiki\Interwiki\ClassicInterwikiLookup\getAllPrefixesCached(), and MediaWiki\Interwiki\ClassicInterwikiLookup\getInterwikiCacheEntry().
|
private |
Fetch interwiki prefix data from local cache in constant database.
string | $prefix | Interwiki prefix |
Definition at line 194 of file ClassicInterwikiLookup.php.
References $value, MediaWiki\Interwiki\ClassicInterwikiLookup\getInterwikiCacheEntry(), and list.
Referenced by MediaWiki\Interwiki\ClassicInterwikiLookup\fetch().
|
private |
Get entry from interwiki cache.
string | $prefix | Database key |
Definition at line 214 of file ClassicInterwikiLookup.php.
References $e, MediaWiki\Interwiki\ClassicInterwikiLookup\$fallbackSite, $value, MediaWiki\Interwiki\ClassicInterwikiLookup\getCacheValue(), WikiMap\getCurrentWikiDbDomain(), WikiMap\getWikiIdFromDbDomain(), and wfDebug().
Referenced by MediaWiki\Interwiki\ClassicInterwikiLookup\getInterwikiCached().
MediaWiki\Interwiki\ClassicInterwikiLookup::invalidateCache | ( | $prefix | ) |
Purge the in-process and object cache for an interwiki prefix.
string | $prefix |
Implements MediaWiki\Interwiki\InterwikiLookup.
Definition at line 179 of file ClassicInterwikiLookup.php.
MediaWiki\Interwiki\ClassicInterwikiLookup::isValidInterwiki | ( | $prefix | ) |
Check whether an interwiki prefix exists.
string | $prefix | Interwiki prefix to use |
Implements MediaWiki\Interwiki\InterwikiLookup.
Definition at line 131 of file ClassicInterwikiLookup.php.
References MediaWiki\Interwiki\ClassicInterwikiLookup\fetch().
|
private |
Load the interwiki, trying first memcached then the DB.
string | $prefix | The interwiki prefix |
Definition at line 273 of file ClassicInterwikiLookup.php.
References $dbr, $fname, MediaWiki\Interwiki\ClassicInterwikiLookup\$objectCacheExpiry, array(), DB_REPLICA, Wikimedia\Rdbms\Database\getCacheSetOptions(), MediaWiki\Interwiki\ClassicInterwikiLookup\loadFromArray(), Hooks\run(), use, and wfGetDB().
Referenced by MediaWiki\Interwiki\ClassicInterwikiLookup\fetch().
|
private |
Fill in member variables from an array (e.g.
memcached result, Database::fetchRow, etc)
array | $mc | Associative array: row from the interwiki table |
Definition at line 319 of file ClassicInterwikiLookup.php.
Referenced by MediaWiki\Interwiki\ClassicInterwikiLookup\load().
MediaWiki\Interwiki\ClassicInterwikiLookup::resetLocalCache | ( | ) |
Resets locally cached Interwiki objects.
This is intended for use during testing only. This does not invalidate entries in the persistent cache, as invalidateCache() does.
Definition at line 171 of file ClassicInterwikiLookup.php.
|
staticprivate |
Return the list of interwiki fields that should be selected to create a new Interwiki object.
Definition at line 449 of file ClassicInterwikiLookup.php.
Definition at line 72 of file ClassicInterwikiLookup.php.
Referenced by MediaWiki\Interwiki\ClassicInterwikiLookup\__construct().
Definition at line 87 of file ClassicInterwikiLookup.php.
|
private |
Definition at line 57 of file ClassicInterwikiLookup.php.
Referenced by MediaWiki\Interwiki\ClassicInterwikiLookup\__construct().
|
private |
|
private |
Definition at line 77 of file ClassicInterwikiLookup.php.
Referenced by MediaWiki\Interwiki\ClassicInterwikiLookup\__construct().
|
private |
Definition at line 52 of file ClassicInterwikiLookup.php.
|
private |
Definition at line 62 of file ClassicInterwikiLookup.php.
Referenced by MediaWiki\Interwiki\ClassicInterwikiLookup\__construct().
|
private |
Definition at line 67 of file ClassicInterwikiLookup.php.
Referenced by MediaWiki\Interwiki\ClassicInterwikiLookup\__construct(), and MediaWiki\Interwiki\ClassicInterwikiLookup\load().
Definition at line 92 of file ClassicInterwikiLookup.php.
Referenced by MediaWiki\Interwiki\ClassicInterwikiLookup\getAllPrefixesCached().