132 $result = $this->
fetch( $prefix );
144 if ( $prefix ==
'' ) {
148 $prefix = $this->contLang->lc( $prefix );
149 if ( $this->localCache->has( $prefix ) ) {
150 return $this->localCache->get( $prefix );
153 if ( $this->cdbData ) {
156 $iw = $this->
load( $prefix );
161 $this->localCache->set( $prefix, $iw );
172 $this->localCache->clear();
180 $this->localCache->clear( $prefix );
182 $key = $this->objectCache->makeKey(
'interwiki', $prefix );
183 $this->objectCache->delete( $key );
199 list( $local, $url ) = explode(
' ',
$value, 2 );
200 return new Interwiki( $prefix, $url,
'',
'', (
int)$local );
215 wfDebug( __METHOD__ .
"( $prefix )\n" );
217 $wikiId = WikiMap::getWikiIdFromDbDomain( WikiMap::getCurrentWikiDbDomain() );
222 if ( $this->interwikiScopes >= 3 && !$this->thisSite ) {
223 $this->thisSite = $this->
getCacheValue(
'__sites:' . $wikiId );
224 if ( $this->thisSite ==
'' ) {
231 if (
$value ==
'' && $this->interwikiScopes >= 3 ) {
235 if (
$value ==
'' && $this->interwikiScopes >= 2 ) {
238 if (
$value ==
'undef' ) {
241 }
catch ( CdbException
$e ) {
242 wfDebug( __METHOD__ .
": CdbException caught, error message was "
243 .
$e->getMessage() );
250 if ( $this->cdbReader ===
null ) {
252 $this->cdbReader = \Cdb\Reader::open( $this->cdbData );
256 $this->cdbReader =
false;
260 if ( $this->cdbReader ) {
261 return $this->cdbReader->get( $key );
273 private function load( $prefix ) {
275 if ( !
Hooks::run(
'InterwikiLoadPrefix', [ $prefix, &$iwData ] ) ) {
287 $iwData = $this->objectCache->getWithSetCallback(
288 $this->objectCache->makeKey(
'interwiki', $prefix ),
289 $this->objectCacheExpiry,
293 $setOpts += Database::getCacheSetOptions(
$dbr );
295 $row =
$dbr->selectRow(
297 self::selectFields(),
298 [
'iw_prefix' => $prefix ],
302 return $row ? (
array)$row :
'!NONEXISTENT';
320 if (
isset( $mc[
'iw_url'] ) ) {
321 $url = $mc[
'iw_url'];
322 $local = $mc[
'iw_local'] ?? 0;
323 $trans = $mc[
'iw_trans'] ?? 0;
324 $api = $mc[
'iw_api'] ??
'';
325 $wikiId = $mc[
'iw_wikiid'] ??
'';
327 return new Interwiki(
null, $url, $api, $wikiId, $local, $trans );
340 wfDebug( __METHOD__ .
"()\n" );
342 $wikiId = WikiMap::getWikiIdFromDbDomain( WikiMap::getCurrentWikiDbDomain() );
347 if ( $this->interwikiScopes >= 3 && !$this->thisSite ) {
353 $this->thisSite =
$site;
360 if ( $this->interwikiScopes >= 2 ) {
361 $sources[] =
'__global';
364 if ( $this->interwikiScopes >= 3 ) {
367 $sources[] = $wikiId;
369 foreach ( $sources as
$source ) {
371 foreach ( explode(
' ', $list ) as $iw_prefix ) {
377 list( $iw_local, $iw_url ) = explode(
' ', $row );
379 if ( $local !==
null && $local != $iw_local ) {
390 }
catch ( CdbException
$e ) {
391 wfDebug( __METHOD__ .
": CdbException caught, error message was "
392 .
$e->getMessage() );
409 if ( $local !==
null ) {
411 $where[
'iw_local'] = 1;
412 }
elseif ( $local == 0 ) {
413 $where[
'iw_local'] = 0;
417 $res = $db->select(
'interwiki',
418 self::selectFields(),
419 $where, __METHOD__, [
'ORDER BY' =>
'iw_prefix' ]
423 foreach (
$res as $row ) {
424 $retval[] = (
array)$row;
437 if ( $this->cdbData ) {
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
if(defined( 'MW_SETUP_CALLBACK')) $fname
Customization point after all loading (constants, functions, classes, DefaultSettings,...
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
Value object for representing interwiki records.
Internationalisation code.
Handles a simple LRU key/value map with a maximum number of entries.
Multi-datacenter aware caching interface.
Helper tools for dealing with other locally-hosted wikis.
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
namespace being checked & $result
returning false will NOT prevent logging $e
$data
Utility to generate mapping file used in mw.Title (phpCharToUpper.json)
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback function
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))
MediaWiki has optional support for a high distributed memory object caching system For general information on but for a larger site with heavy load