MediaWiki REL1_37
|
InterwikiLookup implementing the "classic" interwiki storage (hardcoded up to MW 1.26). More...
Public Member Functions | |
__construct (Language $contLang, WANObjectCache $objectCache, HookContainer $hookContainer, ILoadBalancer $loadBalancer, $objectCacheExpiry, $cdbData, $interwikiScopes, $fallbackSite) | |
fetch ( $prefix) | |
Fetch an Interwiki object. | |
getAllPrefixes ( $local=null) | |
Returns all interwiki prefixes. | |
invalidateCache ( $prefix) | |
Purge the in-process and object cache for an interwiki prefix. | |
isValidInterwiki ( $prefix) | |
Check whether an interwiki prefix exists. | |
resetLocalCache () | |
Resets locally cached Interwiki objects. | |
Static Public Member Functions | |
static | buildCdbHash (array $allPrefixes, int $scope=1, ?string $thisSite=null) |
Given the array returned by getAllPrefixes(), build a PHP hash which can be given to \Cdb\Reader\Hash() as $this->cdbData, ie as the value of $wgInterwikiCache. | |
Private Member Functions | |
getAllPrefixesCached ( $local) | |
Fetch all interwiki prefixes from interwiki cache. | |
getAllPrefixesDB ( $local) | |
Fetch all interwiki prefixes from DB. | |
getCacheValue ( $key) | |
getInterwikiCached ( $prefix) | |
Fetch interwiki prefix data from local cache in constant database. | |
getInterwikiCacheEntry ( $prefix) | |
Get entry from interwiki cache. | |
load ( $prefix) | |
Load the interwiki, trying first memcached then the DB. | |
loadFromArray ( $mc) | |
Fill in member variables from an array (e.g. | |
Static Private Member Functions | |
static | selectFields () |
Return the list of interwiki fields that should be selected to create a new Interwiki object. | |
Private Attributes | |
bool array string | $cdbData |
CdbReader null | $cdbReader = null |
Language | $contLang |
string | $fallbackSite |
HookRunner | $hookRunner |
int | $interwikiScopes |
ILoadBalancer | $loadBalancer |
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 three 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 49 of file ClassicInterwikiLookup.php.
MediaWiki\Interwiki\ClassicInterwikiLookup::__construct | ( | Language | $contLang, |
WANObjectCache | $objectCache, | ||
HookContainer | $hookContainer, | ||
ILoadBalancer | $loadBalancer, | ||
$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 |
HookContainer | $hookContainer | |
ILoadBalancer | $loadBalancer | |
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 117 of file ClassicInterwikiLookup.php.
References MediaWiki\Interwiki\ClassicInterwikiLookup\$cdbData, MediaWiki\Interwiki\ClassicInterwikiLookup\$contLang, MediaWiki\Interwiki\ClassicInterwikiLookup\$fallbackSite, MediaWiki\Interwiki\ClassicInterwikiLookup\$interwikiScopes, MediaWiki\Interwiki\ClassicInterwikiLookup\$loadBalancer, MediaWiki\Interwiki\ClassicInterwikiLookup\$objectCache, and MediaWiki\Interwiki\ClassicInterwikiLookup\$objectCacheExpiry.
|
static |
Given the array returned by getAllPrefixes(), build a PHP hash which can be given to \Cdb\Reader\Hash() as $this->cdbData, ie as the value of $wgInterwikiCache.
This is used to construct mock interwiki lookup services for testing (in particular, parsertests).
array | $allPrefixes | An array of interwiki information such as would be returned by ::getAllPrefixes() |
int | $scope | The scope at which to insert interwiki prefixes. See the $interwikiScopes parameter to ::__construct(). |
?string | $thisSite The value of $thisSite, if $scope is 3. |
Definition at line 425 of file ClassicInterwikiLookup.php.
MediaWiki\Interwiki\ClassicInterwikiLookup::fetch | ( | $prefix | ) |
Fetch an Interwiki object.
string | $prefix | Interwiki prefix to use |
Implements MediaWiki\Interwiki\InterwikiLookup.
Definition at line 157 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 486 of file ClassicInterwikiLookup.php.
|
private |
Fetch all interwiki prefixes from interwiki cache.
null | string | $local | If not null, limits output to local/non-local interwikis |
Definition at line 353 of file ClassicInterwikiLookup.php.
References MediaWiki\Interwiki\ClassicInterwikiLookup\$fallbackSite, $source, MediaWiki\Interwiki\ClassicInterwikiLookup\$thisSite, MediaWiki\Interwiki\ClassicInterwikiLookup\getCacheValue(), and wfDebug().
|
private |
Fetch all interwiki prefixes from DB.
string | null | $local | If not null, limits output to local/non-local interwikis |
Definition at line 454 of file ClassicInterwikiLookup.php.
References $res, and DB_REPLICA.
|
private |
Definition at line 263 of file ClassicInterwikiLookup.php.
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 208 of file ClassicInterwikiLookup.php.
References MediaWiki\Interwiki\ClassicInterwikiLookup\getInterwikiCacheEntry().
Referenced by MediaWiki\Interwiki\ClassicInterwikiLookup\fetch().
|
private |
Get entry from interwiki cache.
string | $prefix | Database key |
Definition at line 228 of file ClassicInterwikiLookup.php.
References MediaWiki\Interwiki\ClassicInterwikiLookup\$fallbackSite, MediaWiki\Interwiki\ClassicInterwikiLookup\getCacheValue(), 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 193 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 145 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 287 of file ClassicInterwikiLookup.php.
References $dbr, DB_REPLICA, and MediaWiki\Interwiki\ClassicInterwikiLookup\loadFromArray().
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 333 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 185 of file ClassicInterwikiLookup.php.
|
staticprivate |
Return the list of interwiki fields that should be selected to create a new Interwiki object.
Definition at line 499 of file ClassicInterwikiLookup.php.
|
private |
Definition at line 74 of file ClassicInterwikiLookup.php.
Referenced by MediaWiki\Interwiki\ClassicInterwikiLookup\__construct().
|
private |
Definition at line 89 of file ClassicInterwikiLookup.php.
|
private |
Definition at line 59 of file ClassicInterwikiLookup.php.
Referenced by MediaWiki\Interwiki\ClassicInterwikiLookup\__construct().
|
private |
|
private |
Definition at line 97 of file ClassicInterwikiLookup.php.
|
private |
Definition at line 79 of file ClassicInterwikiLookup.php.
Referenced by MediaWiki\Interwiki\ClassicInterwikiLookup\__construct().
|
private |
Definition at line 100 of file ClassicInterwikiLookup.php.
Referenced by MediaWiki\Interwiki\ClassicInterwikiLookup\__construct().
|
private |
Definition at line 54 of file ClassicInterwikiLookup.php.
|
private |
Definition at line 64 of file ClassicInterwikiLookup.php.
Referenced by MediaWiki\Interwiki\ClassicInterwikiLookup\__construct().
|
private |
Definition at line 69 of file ClassicInterwikiLookup.php.
Referenced by MediaWiki\Interwiki\ClassicInterwikiLookup\__construct().
|
private |
Definition at line 94 of file ClassicInterwikiLookup.php.
Referenced by MediaWiki\Interwiki\ClassicInterwikiLookup\getAllPrefixesCached().