24use Wikimedia\ScopedCallback;
30define(
'MSG_CACHE_VERSION', 2 );
103 if ( self::$instance ===
null ) {
105 self::$instance =
new self(
121 self::$instance =
null;
132 $lckey = strtr( $key,
' ',
'_' );
133 if ( ord( $lckey ) < 128 ) {
134 $lckey[0] = strtolower( $lckey[0] );
154 $this->mMemc = $memCached;
155 $this->mDisable = !$useDB;
156 $this->mExpiry = $expiry;
159 $this->localCache = MediaWikiServices::getInstance()->getLocalServerObjectCache();
164 $this->wanCache = ObjectCache::getMainWANInstance();
175 if ( !$this->mParserOptions ) {
176 if ( !
$wgUser->isSafeToLoad() ) {
181 $po->setEditSection(
false );
182 $po->setAllowUnsafeRawHtml(
false );
191 $this->mParserOptions->setAllowUnsafeRawHtml(
false );
206 return $this->localCache->get( $cacheKey );
217 $this->localCache->set( $cacheKey,
$cache );
242 if ( !is_string(
$code ) ) {
243 throw new InvalidArgumentException(
"Missing language code" );
246 # Don't do double loading...
247 if ( isset( $this->mLoadedLanguages[
$code] ) && $mode != self::FOR_UPDATE ) {
251 # 8 lines of code just to say (once) that message cache is disabled
252 if ( $this->mDisable ) {
253 static $shownDisabled =
false;
254 if ( !$shownDisabled ) {
255 wfDebug( __METHOD__ .
": disabled\n" );
256 $shownDisabled =
true;
262 # Loading code starts
264 $staleCache =
false; # a
cache array with expired
data,
or false if none has been loaded
265 $where = []; # Debug
info, delayed to avoid spamming debug log
too much
267 # Hash of the contents is stored in memcache, to detect if data-center cache
268 # or local cache goes out of date (e.g. due to replace() on some other server)
271 # Try the local cache and check against the cluster hash key...
274 $where[] =
'local cache is empty';
275 } elseif ( !isset(
$cache[
'HASH'] ) ||
$cache[
'HASH'] !== $hash ) {
276 $where[] =
'local cache has the wrong hash';
279 $where[] =
'local cache is expired';
281 } elseif ( $hashVolatile ) {
282 $where[] =
'local cache validation key is expired/volatile';
285 $where[] =
'got from local cache';
292 # Try the global cache. If it is empty, try to acquire a lock. If
293 # the lock can't be acquired, wait for the other thread to finish
294 # and then try the global cache a second time.
295 for ( $failedAttempts = 0; $failedAttempts <= 1; $failedAttempts++ ) {
296 if ( $hashVolatile && $staleCache ) {
297 # Do not bother fetching the whole cache blob to avoid I/O.
298 # Instead, just try to get the non-blocking $statusKey lock
299 # below, and use the local stale value if it was not acquired.
300 $where[] =
'global cache is presumed expired';
302 $cache = $this->mMemc->get( $cacheKey );
304 $where[] =
'global cache is empty';
306 $where[] =
'global cache is expired';
308 } elseif ( $hashVolatile ) {
309 # DB results are replica DB lag prone until the holdoff TTL passes.
310 # By then, updates should be reflected in loadFromDBWithLock().
311 # One thread renerates the cache while others use old values.
312 $where[] =
'global cache is expired/volatile';
315 $where[] =
'got from global cache';
323 # Done, no need to retry
327 # We need to call loadFromDB. Limit the concurrency to one process.
328 # This prevents the site from going down when the cache expires.
329 # Note that the DB slam protection lock here is non-blocking.
331 if ( $loadStatus ===
true ) {
334 } elseif ( $staleCache ) {
335 # Use the stale cache while some other thread constructs the new one
336 $where[] =
'using stale cache';
337 $this->mCache[
$code] = $staleCache;
340 } elseif ( $failedAttempts > 0 ) {
341 # Already blocked once, so avoid another lock/unlock cycle.
342 # This case will typically be hit if memcached is down, or if
343 # loadFromDB() takes longer than LOCK_WAIT.
344 $where[] =
"could not acquire status key.";
346 } elseif ( $loadStatus ===
'cantacquire' ) {
347 # Wait for the other thread to finish, then retry. Normally,
348 # the memcached get() will then yeild the other thread's result.
349 $where[] =
'waited for other thread to complete';
352 # Disable cache; $loadStatus is 'disabled'
359 $where[] =
'loading FAILED - cache is disabled';
360 $this->mDisable =
true;
361 $this->mCache =
false;
362 wfDebugLog(
'MessageCacheError', __METHOD__ .
": Failed to load $code\n" );
363 # This used to throw an exception, but that led to nasty side effects like
364 # the whole wiki being instantly down if the memcached server died
366 # All good, just record the success
367 $this->mLoadedLanguages[
$code] =
true;
370 $info = implode(
', ', $where );
371 wfDebugLog(
'MessageCache', __METHOD__ .
": Loading $code... $info\n" );
385 # If cache updates on all levels fail, give up on message overrides.
386 # This is to avoid easy site outages; see $saveSuccess comments below.
388 $status = $this->mMemc->get( $statusKey );
390 $where[] =
"could not load; method is still globally disabled";
394 # Now let's regenerate
395 $where[] =
'loading from database';
397 # Lock the cache to prevent conflicting writes.
398 # This lock is non-blocking so stale cache can quickly be used.
399 # Note that load() will call a blocking getReentrantScopedLock()
400 # after this if it really need to wait for any current thread.
403 if ( !$scopedLock ) {
404 $where[] =
'could not acquire main lock';
405 return 'cantacquire';
412 if ( !$saveSuccess ) {
427 $this->mMemc->set( $statusKey,
'error', 60 * 5 );
428 $where[] =
'could not save cache, disabled globally for 5 minutes';
430 $where[] =
"could not save global cache";
455 'page_is_redirect' => 0,
462 $this->
load( $wgLanguageCode );
465 foreach ( $mostused
as $key =>
$value ) {
466 $mostused[$key] =
"$value/$code";
470 if ( count( $mostused ) ) {
471 $conds[
'page_title'] = $mostused;
473 $conds[] =
'page_title' .
$dbr->buildLike(
$dbr->anyString(),
'/',
$code );
475 # Effectively disallows use of '/' character in NS_MEDIAWIKI for uses
476 # other than language code.
477 $conds[] =
'page_title NOT' .
$dbr->buildLike(
$dbr->anyString(),
'/',
$dbr->anyString() );
480 # Conditions to fetch oversized pages to ignore them
484 # Load titles for all oversized pages in the MediaWiki namespace
485 $res =
$dbr->select(
'page',
'page_title', $bigConds, __METHOD__ .
"($code)-big" );
486 foreach (
$res as $row ) {
487 $cache[$row->page_title] =
'!TOO BIG';
490 # Conditions to load the remaining pages with their contents
491 $smallConds = $conds;
492 $smallConds[] =
'page_latest=rev_id';
493 $smallConds[] =
'rev_text_id=old_id';
497 [
'page',
'revision',
'text' ],
498 [
'page_title',
'old_text',
'old_flags' ],
500 __METHOD__ .
"($code)-small"
503 foreach (
$res as $row ) {
505 if ( $text ===
false ) {
512 .
": failed to load message page text for {$row->page_title} ($code)"
515 $entry =
' ' . $text;
517 $cache[$row->page_title] = $entry;
537 if ( $this->mDisable ) {
557 if ( $text ===
false ) {
560 $this->wanCache->delete( $titleKey );
564 $this->wanCache->set( $titleKey,
' ' . $text, $this->mExpiry );
567 $this->wanCache->delete( $titleKey );
572 $this->mCache[
$code][
'LATEST'] = time();
579 ScopedCallback::consume( $scopedLock );
585 if (
$code ===
'en' ) {
588 $codes = array_keys( Language::fetchLanguageNames() );
593 $this->wanCache->delete( $sidebarKey );
598 $blobStore = $resourceloader->getMessageBlobStore();
599 $blobStore->updateMessage(
$wgContLang->lcfirst( $msg ) );
601 Hooks::run(
'MessageCacheReplace', [
$title, $text ] );
611 if ( !isset(
$cache[
'VERSION'] ) || !isset(
$cache[
'EXPIRY'] ) ) {
634 if ( $dest ===
'all' ) {
655 $value = $this->wanCache->get(
667 if ( ( time() -
$value[
'latest'] ) < WANObjectCache::HOLDOFF_TTL ) {
672 $expired = ( $curTTL < 0 );
676 return [ $hash, $expired ];
689 $this->wanCache->set(
693 'latest' => isset(
$cache[
'LATEST'] ) ?
$cache[
'LATEST'] : 0
695 WANObjectCache::TTL_INDEFINITE
705 return $this->mMemc->getScopedLock( $key, $timeout, self::LOCK_TTL, __METHOD__ );
742 function get( $key, $useDB =
true, $langcode =
true, $isFullKey =
false ) {
743 if ( is_int( $key ) ) {
747 } elseif ( !is_string( $key ) ) {
749 } elseif ( $key ===
'' ) {
755 $pos = strrpos( $key,
'/' );
756 if ( $isFullKey && $pos !==
false ) {
757 $langcode = substr( $key, $pos + 1 );
758 $key = substr( $key, 0, $pos );
764 Hooks::run(
'MessageCache::get', [ &$lckey ] );
771 !$this->mDisable && $useDB
775 if ( $message ===
false ) {
776 $parts = explode(
'/', $lckey );
780 if ( count( $parts ) == 2 && $parts[1] !==
'' ) {
781 $message = Language::getMessageFor( $parts[0], $parts[1] );
782 if ( $message ===
null ) {
789 if ( $message !==
false ) {
791 $message = str_replace(
793 # Fix
for trailing whitespace, removed
by textarea
795 # Fix
for NBSP, converted to space
by firefox
832 if ( $message !==
false ) {
837 $message = $this->
getMessageForLang( $wgContLang, $lckey, $useDB, $alreadyTried );
853 $langcode =
$lang->getCode();
859 if ( !isset( $alreadyTried[ $langcode ] ) ) {
865 if ( $message !==
false ) {
868 $alreadyTried[ $langcode ] =
true;
875 $message =
$lang->getMessage( $lckey );
876 if ( $message !==
null ) {
882 $fallbackChain = Language::getFallbacksFor( $langcode );
884 foreach ( $fallbackChain
as $code ) {
885 if ( isset( $alreadyTried[
$code ] ) ) {
892 if ( $message !==
false ) {
895 $alreadyTried[
$code ] =
true;
915 return "$uckey/$langcode";
935 if ( substr( $entry, 0, 1 ) ===
' ' ) {
938 return (
string)substr( $entry, 1 );
939 } elseif ( $entry ===
'!NONEXISTENT' ) {
941 } elseif ( $entry ===
'!TOO BIG' ) {
947 Hooks::run(
'MessagesPreLoad', [
$title, &$message ] );
948 if ( $message !==
false ) {
959 $entry = $this->wanCache->get(
964 $entry = ( $curTTL >= 0 ) ? $entry :
false;
967 if ( substr( $entry, 0, 1 ) ===
' ' ) {
970 return (
string)substr( $entry, 1 );
971 } elseif ( $entry ===
'!NONEXISTENT' ) {
977 $this->wanCache->delete( $titleKey );
983 $cacheOpts = Database::getCacheSetOptions(
$dbr );
986 if ( $titleObj->getLatestRevID() ) {
989 $titleObj->getArticleID(),
990 $titleObj->getLatestRevID()
1002 __METHOD__ .
": failed to load message page text for {$title} ($code)"
1010 $message =
$content->getWikitextForTransclusion();
1012 if ( $message ===
false || $message ===
null ) {
1015 __METHOD__ .
": message content doesn't provide wikitext "
1016 .
"(content model: " .
$content->getModel() .
")"
1022 $this->wanCache->set( $titleKey,
' ' . $message, $this->mExpiry, $cacheOpts );
1029 if ( $message ===
false ) {
1031 $this->wanCache->set( $titleKey,
'!NONEXISTENT', $this->mExpiry, $cacheOpts );
1044 function transform( $message, $interface =
false, $language =
null, $title =
null ) {
1046 if ( strpos( $message,
'{{' ) ===
false ) {
1050 if ( $this->mInParser ) {
1057 $popts->setInterfaceMessage( $interface );
1058 $popts->setTargetLanguage( $language );
1060 $userlang = $popts->setUserLang( $language );
1061 $this->mInParser =
true;
1062 $message =
$parser->transformMsg( $message, $popts,
$title );
1063 $this->mInParser =
false;
1064 $popts->setUserLang( $userlang );
1075 if ( !$this->mParser && isset(
$wgParser ) ) {
1076 # Do some initialisation so that we don't have to do it twice
1078 # Clone it and store it
1080 if ( $class ==
'ParserDiffTest' ) {
1099 public function parse( $text, $title =
null, $linestart =
true,
1100 $interface =
false, $language =
null
1102 if ( $this->mInParser ) {
1103 return htmlspecialchars( $text );
1108 $popts->setInterfaceMessage( $interface );
1110 if ( is_string( $language ) ) {
1111 $language = Language::factory( $language );
1113 $popts->setTargetLanguage( $language );
1117 wfDebugLog(
'GlobalTitleFail', __METHOD__ .
' called by ' .
1123 # It's not uncommon having a null $wgTitle in scripts. See r80898
1124 # Create a ghost title in such case
1125 $title = Title::makeTitle(
NS_SPECIAL,
'Badtitle/title not set in ' . __METHOD__ );
1128 $this->mInParser =
true;
1130 $this->mInParser =
false;
1136 $this->mDisable =
true;
1140 $this->mDisable =
false;
1163 $langs = Language::fetchLanguageNames(
null,
'mw' );
1164 foreach ( array_keys( $langs )
as $code ) {
1165 # Global and local caches
1166 $this->wanCache->touchCheckKey(
wfMemcKey(
'messages',
$code ) );
1169 $this->mLoadedLanguages = [];
1179 $pieces = explode(
'/', $key );
1180 if ( count( $pieces ) < 2 ) {
1184 $lang = array_pop( $pieces );
1185 if ( !Language::fetchLanguageName(
$lang,
null,
'mw' ) ) {
1189 $message = implode(
'/', $pieces );
1191 return [ $message,
$lang ];
1205 if ( !isset( $this->mCache[
$code] ) ) {
1211 unset(
$cache[
'VERSION'] );
1212 unset(
$cache[
'EXPIRY'] );
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for and distribution as defined by Sections through of this document Licensor shall mean the copyright owner or entity authorized by the copyright owner that is granting the License Legal Entity shall mean the union of the acting entity and all other entities that control are controlled by or are under common control with that entity For the purposes of this definition control direct or to cause the direction or management of such whether by contract or including but not limited to software source documentation and configuration files Object form shall mean any form resulting from mechanical transformation or translation of a Source including but not limited to compiled object generated and conversions to other media types Work shall mean the work of whether in Source or Object made available under the as indicated by a copyright notice that is included in or attached to the whether in Source or Object that is based or other modifications as a an original work of authorship For the purposes of this Derivative Works shall not include works that remain separable or merely the Work and Derivative Works thereof Contribution shall mean any work of including the original version of the Work and any modifications or additions to that Work or Derivative Works that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner For the purposes of this submitted means any form of or written communication sent to the Licensor or its including but not limited to communication on electronic mailing source code control and issue tracking systems that are managed by
$wgLanguageCode
Site language code.
$wgUseLocalMessageCache
Set this to true to maintain a copy of the message cache on the local server.
$wgAdaptiveMessageCache
Instead of caching everything, only cache those messages which have been customised in the site conte...
$wgUseDatabaseMessages
Translation using MediaWiki: namespace.
$wgMaxMsgCacheEntrySize
Maximum entry size in the message cache, in bytes.
$wgParserConf
Parser configuration.
$wgMsgCacheExpiry
Expiry time for the message cache key.
wfGetLangObj( $langcode=false)
Return a Language object from $langcode.
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
wfTimestampNow()
Convenience function; returns MediaWiki timestamp for the present time.
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
wfGetMessageCacheStorage()
Get the cache object used by the message cache.
wfMemcKey()
Make a cache key for the local wiki.
wfGetAllCallers( $limit=3)
Return a string consisting of callers in the stack.
wfDebugLog( $logGroup, $text, $dest='all', array $context=[])
Send a line to a supplementary debug log file, if configured, or main debug log if not.
wfGetCache( $cacheType)
Get a specific cache object.
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
const MSG_CACHE_VERSION
MediaWiki message cache structure version.
if(! $wgRequest->checkUrlExtension()) if(isset($_SERVER[ 'PATH_INFO']) &&$_SERVER[ 'PATH_INFO'] !='') if(! $wgEnableAPI) $wgTitle
interface is intended to be more or less compatible with the PHP memcached client.
A BagOStuff object with no objects in it.
Message cache Performs various MediaWiki namespace-related functions.
getValidationHash( $code)
Get the md5 used to validate the local APC cache.
loadFromDBWithLock( $code, array &$where, $mode=null)
const LOCK_TTL
How long memcached locks last.
loadFromDB( $code, $mode=null)
Loads cacheable messages from the database.
getMessageForLang( $lang, $lckey, $useDB, &$alreadyTried)
Given a language, try and fetch messages from that language and its fallbacks.
$mExpiry
Lifetime for cache, used by object caching.
saveToLocalCache( $code, $cache)
Save the cache to APC.
getMessagePageName( $langcode, $uckey)
Get the message page name for a given language.
static $instance
Singleton instance.
__construct( $memCached, $useDB, $expiry)
saveToCaches(array $cache, $dest, $code=false)
Shortcut to update caches.
setValidationHash( $code, array $cache)
Set the md5 used to validate the local disk cache.
isCacheExpired( $cache)
Is the given cache array expired due to time passing or a version change?
getMsgFromNamespace( $title, $code)
Get a message from the MediaWiki namespace, with caching.
getReentrantScopedLock( $key, $timeout=self::WAIT_SEC)
const WAIT_SEC
How long to wait for memcached locks.
$mDisable
Should mean that database cannot be used, but check.
getLocalCache( $code)
Try to load the cache from APC.
static destroyInstance()
Destroy the singleton instance.
load( $code, $mode=null)
Loads messages from caches or from database in this order: (1) local message cache (if $wgUseLocalMes...
transform( $message, $interface=false, $language=null, $title=null)
getMessageFromFallbackChain( $lang, $lckey, $useDB)
Given a language, try and fetch messages from that language.
$mLoadedLanguages
Variable for tracking which variables are already loaded.
isDisabled()
Whether DB/cache usage is disabled for determining messages.
clear()
Clear all stored messages.
static singleton()
Get the signleton instance of this class.
getAllMessageKeys( $code)
Get all message keys stored in the message cache for a given language.
$mParserOptions
Message cache has its own parser which it uses to transform messages.
$mCache
Process local cache of loaded messages that are defined in MediaWiki namespace.
static normalizeKey( $key)
Normalize message key input.
parse( $text, $title=null, $linestart=true, $interface=false, $language=null)
replace( $title, $text)
Updates cache as necessary when message page is changed.
getParserOptions()
ParserOptions is lazy initialised.
Set options of the Parser.
static newFromAnon()
Get a ParserOptions object for an anonymous user.
static getMain()
Static methods.
static newKnownCurrent(IDatabase $db, $pageId, $revId)
Load a revision based on a known page ID and current revision ID from the DB.
static getRevisionText( $row, $prefix='old_', $wiki=false)
Get revision text associated with an old or archive row $row is usually an object from wfFetchRow(),...
Represents a title within MediaWiki.
Multi-datacenter aware caching interface.
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
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the local content language as $wgContLang
I won t presume to tell you how to I m just describing the methods I chose to use for myself If you do choose to follow these it will probably be easier for you to collaborate with others on the but if you want to contribute without by all means do which work well I also use K &R brace matching style I know that s a religious issue for so if you want to use a style that puts opening braces on the next that s OK too
when a variable name is used in a it is silently declared as a new local masking the global
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
globals txt Globals are evil The original MediaWiki code relied on globals for processing context far too often MediaWiki development since then has been a story of slowly moving context out of global variables and into objects Storing processing context in object member variables allows those objects to be reused in a much more flexible way Consider the elegance of
database rows
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set $status
the array() calling protocol came about after MediaWiki 1.4rc1.
namespace are movable Hooks may change this value to override the return value of MWNamespace::isMovable(). 'NewDifferenceEngine' do that in ParserLimitReportFormat instead $parser
This code would result in ircNotify being run twice when an article is and once for brion Hooks can return three possible true was required This is the default since MediaWiki *some string
namespace and then decline to actually register it file or subcat img or subcat $title
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content $content
null for the local wiki Added in
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content as context as context the output can only depend on parameters provided to this hook not on global state indicating whether full HTML should be generated If generation of HTML may be but other information should still be present in the ParserOutput object to manipulate or replace but no entry for that model exists in $wgContentHandlers if desired whether it is OK to use $contentModel on $title Handler functions that modify $ok should generally return false to prevent further hooks from further modifying $ok inclusive false for true for descending in case the handler function wants to provide a converted Content object Note that $result getContentModel() must return $toModel. 'CustomEditor' $rcid is used in generating this variable which contains information about the new such as the revision s whether the revision was marked as a minor edit or etc which include things like revision author info
processing should stop and the error should be shown to the user * false
passed in as a query string parameter to the various URLs constructed here(i.e. $prevlink) $ldel you ll need to handle error messages
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output modifiable & $code
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 the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
you have access to all of the normal MediaWiki so you can get a DB use the cache
MediaWiki has optional support for a high distributed memory object caching system For general information on but for a larger site with heavy load
This document describes the state of Postgres support in and is fairly well maintained The main code is very well while extensions are very hit and miss it is probably the most supported database after MySQL Much of the work in making MediaWiki database agnostic came about through the work of creating Postgres as and are nearing end of but without copying over all the usage comments General notes on the but these can almost always be programmed around *Although Postgres has a true BOOLEAN boolean columns are always mapped to as the code does not always treat the column as a and VARBINARY columns should simply be TEXT The only exception is when VARBINARY is used to store true binary data
if(!isset( $args[0])) $lang
const TS_MW
MediaWiki concatenated string timestamp (YYYYMMDDHHMMSS)