MediaWiki master
|
InterwikiLookup backed by the interwiki
database table or $wgInterwikiCache.
More...
Inherits MediaWiki\Interwiki\InterwikiLookup.
Public Member Functions | ||||
__construct (ServiceOptions $options, Language $contLang, WANObjectCache $wanCache, HookContainer $hookContainer, IConnectionProvider $dbProvider) | ||||
fetch ( $prefix) | ||||
Get the Interwiki object for a given prefix.
| ||||
getAllPrefixes ( $local=null) | ||||
Fetch all interwiki data. | ||||
invalidateCache ( $prefix) | ||||
Purge the instance cache and memcached for an interwiki prefix. | ||||
isValidInterwiki ( $prefix) | ||||
Check whether an interwiki prefix exists.
| ||||
Static Public Member Functions | |
static | buildCdbHash (array $allPrefixes, int $scope=1, ?string $thisSite=null) |
Build an array in the format accepted by $wgInterwikiCache. | |
Public Attributes | |
const | CONSTRUCTOR_OPTIONS |
InterwikiLookup backed by the interwiki
database table or $wgInterwikiCache.
By default this uses the SQL backend (interwiki
database table) and includes two levels of caching. When parsing a wiki page, many interwiki lookups may be required and thus there is in-class caching for repeat lookups. To reduce database pressure, there is also WANObjectCache for each prefix.
Optionally, a pregenerated dataset can be statically set via $wgInterwikiCache, in which case there are no calls to either database or WANObjectCache.
Definition at line 47 of file ClassicInterwikiLookup.php.
MediaWiki\Interwiki\ClassicInterwikiLookup::__construct | ( | ServiceOptions | $options, |
Language | $contLang, | ||
WANObjectCache | $wanCache, | ||
HookContainer | $hookContainer, | ||
IConnectionProvider | $dbProvider ) |
ServiceOptions | $options | |
Language | $contLang | Language object used to convert prefixes to lower case |
WANObjectCache | $wanCache | Cache for interwiki info retrieved from the database |
HookContainer | $hookContainer | |
IConnectionProvider | $dbProvider |
Definition at line 93 of file ClassicInterwikiLookup.php.
References MediaWiki\Config\ServiceOptions\assertRequiredOptions(), MediaWiki\Config\ServiceOptions\get(), MediaWiki\MainConfigNames\InterwikiCache, and MediaWiki\MainConfigNames\InterwikiScopes.
|
static |
Build an array in the format accepted by $wgInterwikiCache.
Given the array returned by getAllPrefixes(), build a PHP array which can be given to self::__construct() as $interwikiData, i.e. 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 325 of file ClassicInterwikiLookup.php.
MediaWiki\Interwiki\ClassicInterwikiLookup::fetch | ( | $prefix | ) |
Get the Interwiki object for a given prefix.
string | $prefix | Interwiki prefix |
string | null | $prefix |
Implements MediaWiki\Interwiki\InterwikiLookup.
Definition at line 131 of file ClassicInterwikiLookup.php.
Referenced by MediaWiki\Interwiki\ClassicInterwikiLookup\isValidInterwiki().
MediaWiki\Interwiki\ClassicInterwikiLookup::getAllPrefixes | ( | $local = null | ) |
Fetch all interwiki data.
string | null | $local | If set, limit returned data to local or non-local interwikis |
Implements MediaWiki\Interwiki\InterwikiLookup.
Definition at line 381 of file ClassicInterwikiLookup.php.
MediaWiki\Interwiki\ClassicInterwikiLookup::invalidateCache | ( | $prefix | ) |
Purge the instance cache and memcached for an interwiki prefix.
Note that memcached is not used when $wgInterwikiCache is enabled, as the pregenerated data will be used statically without need for memcached.
string | $prefix |
Implements MediaWiki\Interwiki\InterwikiLookup.
Definition at line 155 of file ClassicInterwikiLookup.php.
MediaWiki\Interwiki\ClassicInterwikiLookup::isValidInterwiki | ( | $prefix | ) |
Check whether an interwiki prefix exists.
string | $prefix | Interwiki prefix |
string | $prefix |
Implements MediaWiki\Interwiki\InterwikiLookup.
Definition at line 121 of file ClassicInterwikiLookup.php.
References MediaWiki\Interwiki\ClassicInterwikiLookup\fetch().
const MediaWiki\Interwiki\ClassicInterwikiLookup::CONSTRUCTOR_OPTIONS |
Definition at line 51 of file ClassicInterwikiLookup.php.