X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=docs%2Fglobals.txt;h=5bdb31c15cfaac42d1059bdcda503042b9fd5b1e;hb=5490b1270a0a7447f28d2407736fc3c1deb41d44;hp=ecc5ab33fdb13f61a5af270a6f816e2a0b956722;hpb=f2a59db33f33f34a28704b9a47686d6d32abc0bc;p=lhc%2Fweb%2Fwiklou.git diff --git a/docs/globals.txt b/docs/globals.txt index ecc5ab33fd..5bdb31c15c 100644 --- a/docs/globals.txt +++ b/docs/globals.txt @@ -1,12 +1,10 @@ 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: +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: # Generate the article HTML as if viewed by a web request $article = new Article( Title::newFromText( $t ) ); @@ -27,48 +25,43 @@ versus $wgTitle = $oldTitle $wgArticle = $oldArticle -Some of the current MediaWiki developers have an idle -fantasy that some day, globals will be eliminated from -MediaWiki entirely, replaced by an application object which -would be passed to constructors. Whether that would be an -efficient, convenient solution remains to be seen, but -certainly PHP 5 makes such object-oriented programming -models easier than they were in previous versions. - -For the time being though, MediaWiki programmers will have -to work in an environment with some global context. At the -time of writing, 418 globals were initialised on startup by -MediaWiki. 304 of these were configuration settings, which -are documented in DefaultSettings.php. There is no -comprehensive documentation for the remaining 114 globals, -however some of the most important ones are listed below. -They are typically initialised either in index.php or in +Some of the current MediaWiki developers have an idle fantasy that some day, +globals will be eliminated from MediaWiki entirely, replaced by an application +object which would be passed to constructors. Whether that would be an +efficient, convenient solution remains to be seen, but certainly PHP 5 makes +such object-oriented programming models easier than they were in previous +versions. + +For the time being though, MediaWiki programmers will have to work in an +environment with some global context. At the time of writing, 418 globals were +initialised on startup by MediaWiki. 304 of these were configuration settings, +which are documented in DefaultSettings.php. There is no comprehensive +documentation for the remaining 114 globals, however some of the most important +ones are listed below. They are typically initialised either in index.php or in Setup.php. +For a description of the classes, see design.txt. + +$wgTitle + Title object created from the request URL. $wgOut OutputPage object for HTTP response. $wgUser - User object for the user associated with the current - request. - -$wgTitle - Title object created from the request URL. + User object for the user associated with the current request. $wgLang - Language object selected by user preferences + Language object selected by user preferences. $wgContLang - Language object associated with the wiki being - viewed. - -$wgArticle - Article object corresponding to $wgTitle. + Language object associated with the wiki being viewed. $wgParser - Parser object. Parser extensions register their - hooks here. + Parser object. Parser extensions register their hooks here. + +$wgRequest + WebRequest object, to get request data -$wgLoadBalancer - A LoadBalancer object, manages database connections. +$wgMemc, $messageMemc, $parserMemc + Object caches