MediaWiki  1.23.1
ParserOutput.php
Go to the documentation of this file.
1 <?php
2 
24 class ParserOutput extends CacheTime {
25  var $mText, # The output text
26  $mLanguageLinks, # List of the full text of language links, in the order they appear
27  $mCategories, # Map of category names to sort keys
28  $mTitleText, # title text of the chosen language variant
29  $mLinks = array(), # 2-D map of NS/DBK to ID for the links in the document. ID=zero for broken.
30  $mTemplates = array(), # 2-D map of NS/DBK to ID for the template references. ID=zero for broken.
31  $mTemplateIds = array(), # 2-D map of NS/DBK to rev ID for the template references. ID=zero for broken.
32  $mImages = array(), # DB keys of the images used, in the array key only
33  $mFileSearchOptions = array(), # DB keys of the images used mapped to sha1 and MW timestamp
34  $mExternalLinks = array(), # External link URLs, in the key only
35  $mInterwikiLinks = array(), # 2-D map of prefix/DBK (in keys only) for the inline interwiki links in the document.
36  $mNewSection = false, # Show a new section link?
37  $mHideNewSection = false, # Hide the new section link?
38  $mNoGallery = false, # No gallery on category page? (__NOGALLERY__)
39  $mHeadItems = array(), # Items to put in the <head> section
40  $mModules = array(), # Modules to be loaded by the resource loader
41  $mModuleScripts = array(), # Modules of which only the JS will be loaded by the resource loader
42  $mModuleStyles = array(), # Modules of which only the CSSS will be loaded by the resource loader
43  $mModuleMessages = array(), # Modules of which only the messages will be loaded by the resource loader
44  $mJsConfigVars = array(), # JavaScript config variable for mw.config combined with this page
45  $mOutputHooks = array(), # Hook tags as per $wgParserOutputHooks
46  $mWarnings = array(), # Warning text to be returned to the user. Wikitext formatted, in the key only
47  $mSections = array(), # Table of contents
48  $mEditSectionTokens = false, # prefix/suffix markers if edit sections were output as tokens
49  $mProperties = array(), # Name/value pairs to be cached in the DB
50  $mTOCHTML = '', # HTML of the TOC
51  $mTimestamp, # Timestamp of the revision
52  $mTOCEnabled = true; # Whether TOC should be shown, can't override __NOTOC__
53  private $mIndexPolicy = ''; # 'index' or 'noindex'? Any other value will result in no change.
54  private $mAccessedOptions = array(); # List of ParserOptions (stored in the keys)
55  private $mSecondaryDataUpdates = array(); # List of DataUpdate, used to save info from the page somewhere else.
56  private $mExtensionData = array(); # extra data used by extensions
57  private $mLimitReportData = array(); # Parser limit report data
58  private $mParseStartTime = array(); # Timestamps for getTimeSinceStart()
59 
60  const EDITSECTION_REGEX = '#<(?:mw:)?editsection page="(.*?)" section="(.*?)"(?:/>|>(.*?)(</(?:mw:)?editsection>))#';
61 
62  function __construct( $text = '', $languageLinks = array(), $categoryLinks = array(),
63  $containsOldMagic = false, $titletext = ''
64  ) {
65  $this->mText = $text;
66  $this->mLanguageLinks = $languageLinks;
67  $this->mCategories = $categoryLinks;
68  $this->mContainsOldMagic = $containsOldMagic;
69  $this->mTitleText = $titletext;
70  }
71 
72  function getText() {
73  wfProfileIn( __METHOD__ );
74  $text = $this->mText;
75  if ( $this->mEditSectionTokens ) {
76  $text = preg_replace_callback( ParserOutput::EDITSECTION_REGEX,
77  array( &$this, 'replaceEditSectionLinksCallback' ), $text );
78  } else {
79  $text = preg_replace( ParserOutput::EDITSECTION_REGEX, '', $text );
80  }
81 
82  // If you have an old cached version of this class - sorry, you can't disable the TOC
83  if ( isset( $this->mTOCEnabled ) && $this->mTOCEnabled ) {
84  $text = str_replace( array( Parser::TOC_START, Parser::TOC_END ), '', $text );
85  } else {
86  $text = preg_replace(
87  '#' . preg_quote( Parser::TOC_START ) . '.*?' . preg_quote( Parser::TOC_END ) . '#s',
88  '',
89  $text
90  );
91  }
92  wfProfileOut( __METHOD__ );
93  return $text;
94  }
95 
105  $args = array(
106  htmlspecialchars_decode( $m[1] ),
107  htmlspecialchars_decode( $m[2] ),
108  isset( $m[4] ) ? $m[3] : null,
109  );
110  $args[0] = Title::newFromText( $args[0] );
111  if ( !is_object( $args[0] ) ) {
112  throw new MWException( "Bad parser output text." );
113  }
114  $args[] = $wgLang->getCode();
115  $skin = $wgOut->getSkin();
116  return call_user_func_array( array( $skin, 'doEditSectionLink' ), $args );
117  }
118 
119  function &getLanguageLinks() { return $this->mLanguageLinks; }
120  function getInterwikiLinks() { return $this->mInterwikiLinks; }
121  function getCategoryLinks() { return array_keys( $this->mCategories ); }
122  function &getCategories() { return $this->mCategories; }
123  function getTitleText() { return $this->mTitleText; }
124  function getSections() { return $this->mSections; }
125  function getEditSectionTokens() { return $this->mEditSectionTokens; }
126  function &getLinks() { return $this->mLinks; }
127  function &getTemplates() { return $this->mTemplates; }
128  function &getTemplateIds() { return $this->mTemplateIds; }
129  function &getImages() { return $this->mImages; }
130  function &getFileSearchOptions() { return $this->mFileSearchOptions; }
131  function &getExternalLinks() { return $this->mExternalLinks; }
132  function getNoGallery() { return $this->mNoGallery; }
133  function getHeadItems() { return $this->mHeadItems; }
134  function getModules() { return $this->mModules; }
135  function getModuleScripts() { return $this->mModuleScripts; }
136  function getModuleStyles() { return $this->mModuleStyles; }
137  function getModuleMessages() { return $this->mModuleMessages; }
139  function getJsConfigVars() { return $this->mJsConfigVars; }
140  function getOutputHooks() { return (array)$this->mOutputHooks; }
141  function getWarnings() { return array_keys( $this->mWarnings ); }
142  function getIndexPolicy() { return $this->mIndexPolicy; }
143  function getTOCHTML() { return $this->mTOCHTML; }
144  function getTimestamp() { return $this->mTimestamp; }
145  function getLimitReportData() { return $this->mLimitReportData; }
146  function getTOCEnabled() { return $this->mTOCEnabled; }
147 
148  function setText( $text ) { return wfSetVar( $this->mText, $text ); }
149  function setLanguageLinks( $ll ) { return wfSetVar( $this->mLanguageLinks, $ll ); }
150  function setCategoryLinks( $cl ) { return wfSetVar( $this->mCategories, $cl ); }
151 
152  function setTitleText( $t ) { return wfSetVar( $this->mTitleText, $t ); }
153  function setSections( $toc ) { return wfSetVar( $this->mSections, $toc ); }
154  function setEditSectionTokens( $t ) { return wfSetVar( $this->mEditSectionTokens, $t ); }
155  function setIndexPolicy( $policy ) { return wfSetVar( $this->mIndexPolicy, $policy ); }
156  function setTOCHTML( $tochtml ) { return wfSetVar( $this->mTOCHTML, $tochtml ); }
157  function setTimestamp( $timestamp ) { return wfSetVar( $this->mTimestamp, $timestamp ); }
158  function setTOCEnabled( $flag ) { return wfSetVar( $this->mTOCEnabled, $flag ); }
159 
160  function addCategory( $c, $sort ) { $this->mCategories[$c] = $sort; }
161  function addLanguageLink( $t ) { $this->mLanguageLinks[] = $t; }
162  function addWarning( $s ) { $this->mWarnings[$s] = 1; }
163 
164  function addOutputHook( $hook, $data = false ) {
165  $this->mOutputHooks[] = array( $hook, $data );
166  }
167 
168  function setNewSection( $value ) {
169  $this->mNewSection = (bool)$value;
170  }
171  function hideNewSection( $value ) {
172  $this->mHideNewSection = (bool)$value;
173  }
174  function getHideNewSection() {
175  return (bool)$this->mHideNewSection;
176  }
177  function getNewSection() {
178  return (bool)$this->mNewSection;
179  }
180 
188  static function isLinkInternal( $internal, $url ) {
189  return (bool)preg_match( '/^' .
190  # If server is proto relative, check also for http/https links
191  ( substr( $internal, 0, 2 ) === '//' ? '(?:https?:)?' : '' ) .
192  preg_quote( $internal, '/' ) .
193  # check for query/path/anchor or end of link in each case
194  '(?:[\?\/\#]|$)/i',
195  $url
196  );
197  }
198 
199  function addExternalLink( $url ) {
200  # We don't register links pointing to our own server, unless... :-)
201  global $wgServer, $wgRegisterInternalExternals;
202 
203  $registerExternalLink = true;
204  if ( !$wgRegisterInternalExternals ) {
205  $registerExternalLink = !self::isLinkInternal( $wgServer, $url );
206  }
207  if ( $registerExternalLink ) {
208  $this->mExternalLinks[$url] = 1;
209  }
210  }
211 
218  function addLink( Title $title, $id = null ) {
219  if ( $title->isExternal() ) {
220  // Don't record interwikis in pagelinks
221  $this->addInterwikiLink( $title );
222  return;
223  }
224  $ns = $title->getNamespace();
225  $dbk = $title->getDBkey();
226  if ( $ns == NS_MEDIA ) {
227  // Normalize this pseudo-alias if it makes it down here...
228  $ns = NS_FILE;
229  } elseif ( $ns == NS_SPECIAL ) {
230  // We don't record Special: links currently
231  // It might actually be wise to, but we'd need to do some normalization.
232  return;
233  } elseif ( $dbk === '' ) {
234  // Don't record self links - [[#Foo]]
235  return;
236  }
237  if ( !isset( $this->mLinks[$ns] ) ) {
238  $this->mLinks[$ns] = array();
239  }
240  if ( is_null( $id ) ) {
241  $id = $title->getArticleID();
242  }
243  $this->mLinks[$ns][$dbk] = $id;
244  }
245 
253  function addImage( $name, $timestamp = null, $sha1 = null ) {
254  $this->mImages[$name] = 1;
255  if ( $timestamp !== null && $sha1 !== null ) {
256  $this->mFileSearchOptions[$name] = array( 'time' => $timestamp, 'sha1' => $sha1 );
257  }
258  }
259 
267  function addTemplate( $title, $page_id, $rev_id ) {
268  $ns = $title->getNamespace();
269  $dbk = $title->getDBkey();
270  if ( !isset( $this->mTemplates[$ns] ) ) {
271  $this->mTemplates[$ns] = array();
272  }
273  $this->mTemplates[$ns][$dbk] = $page_id;
274  if ( !isset( $this->mTemplateIds[$ns] ) ) {
275  $this->mTemplateIds[$ns] = array();
276  }
277  $this->mTemplateIds[$ns][$dbk] = $rev_id; // For versioning
278  }
279 
284  function addInterwikiLink( $title ) {
285  if ( !$title->isExternal() ) {
286  throw new MWException( 'Non-interwiki link passed, internal parser error.' );
287  }
288  $prefix = $title->getInterwiki();
289  if ( !isset( $this->mInterwikiLinks[$prefix] ) ) {
290  $this->mInterwikiLinks[$prefix] = array();
291  }
292  $this->mInterwikiLinks[$prefix][$title->getDBkey()] = 1;
293  }
294 
300  function addHeadItem( $section, $tag = false ) {
301  if ( $tag !== false ) {
302  $this->mHeadItems[$tag] = $section;
303  } else {
304  $this->mHeadItems[] = $section;
305  }
306  }
307 
308  public function addModules( $modules ) {
309  $this->mModules = array_merge( $this->mModules, (array)$modules );
310  }
311 
312  public function addModuleScripts( $modules ) {
313  $this->mModuleScripts = array_merge( $this->mModuleScripts, (array)$modules );
314  }
315 
316  public function addModuleStyles( $modules ) {
317  $this->mModuleStyles = array_merge( $this->mModuleStyles, (array)$modules );
318  }
319 
320  public function addModuleMessages( $modules ) {
321  $this->mModuleMessages = array_merge( $this->mModuleMessages, (array)$modules );
322  }
323 
331  public function addJsConfigVars( $keys, $value = null ) {
332  if ( is_array( $keys ) ) {
333  foreach ( $keys as $key => $value ) {
334  $this->mJsConfigVars[$key] = $value;
335  }
336  return;
337  }
338 
339  $this->mJsConfigVars[$keys] = $value;
340  }
341 
347  public function addOutputPageMetadata( OutputPage $out ) {
348  $this->addModules( $out->getModules() );
349  $this->addModuleScripts( $out->getModuleScripts() );
350  $this->addModuleStyles( $out->getModuleStyles() );
351  $this->addModuleMessages( $out->getModuleMessages() );
352  $this->addJsConfigVars( $out->getJsConfigVars() );
353 
354  $this->mHeadItems = array_merge( $this->mHeadItems, $out->getHeadItemsArray() );
355  }
356 
364  public function setDisplayTitle( $text ) {
365  $this->setTitleText( $text );
366  $this->setProperty( 'displaytitle', $text );
367  }
368 
374  public function getDisplayTitle() {
375  $t = $this->getTitleText();
376  if ( $t === '' ) {
377  return false;
378  }
379  return $t;
380  }
381 
385  public function setFlag( $flag ) {
386  $this->mFlags[$flag] = true;
387  }
388 
389  public function getFlag( $flag ) {
390  return isset( $this->mFlags[$flag] );
391  }
392 
450  public function setProperty( $name, $value ) {
451  $this->mProperties[$name] = $value;
452  }
453 
454  public function getProperty( $name ) {
455  return isset( $this->mProperties[$name] ) ? $this->mProperties[$name] : false;
456  }
457 
458  public function getProperties() {
459  if ( !isset( $this->mProperties ) ) {
460  $this->mProperties = array();
461  }
462  return $this->mProperties;
463  }
464 
470  public function getUsedOptions() {
471  if ( !isset( $this->mAccessedOptions ) ) {
472  return array();
473  }
474  return array_keys( $this->mAccessedOptions );
475  }
476 
486  public function recordOption( $option ) {
487  $this->mAccessedOptions[$option] = true;
488  }
489 
500  public function addSecondaryDataUpdate( DataUpdate $update ) {
501  $this->mSecondaryDataUpdates[] = $update;
502  }
503 
520  public function getSecondaryDataUpdates( Title $title = null, $recursive = true ) {
521  if ( is_null( $title ) ) {
522  $title = Title::newFromText( $this->getTitleText() );
523  }
524 
525  $linksUpdate = new LinksUpdate( $title, $this, $recursive );
526 
527  return array_merge( $this->mSecondaryDataUpdates, array( $linksUpdate ) );
528  }
529 
571  public function setExtensionData( $key, $value ) {
572  if ( $value === null ) {
573  unset( $this->mExtensionData[$key] );
574  } else {
575  $this->mExtensionData[$key] = $value;
576  }
577  }
578 
590  public function getExtensionData( $key ) {
591  if ( isset( $this->mExtensionData[$key] ) ) {
592  return $this->mExtensionData[$key];
593  }
594 
595  return null;
596  }
597 
598  private static function getTimes( $clock = null ) {
599  $ret = array();
600  if ( !$clock || $clock === 'wall' ) {
601  $ret['wall'] = microtime( true );
602  }
603  if ( ( !$clock || $clock === 'cpu' ) && function_exists( 'getrusage' ) ) {
604  $ru = getrusage();
605  $ret['cpu'] = $ru['ru_utime.tv_sec'] + $ru['ru_utime.tv_usec'] / 1e6;
606  $ret['cpu'] += $ru['ru_stime.tv_sec'] + $ru['ru_stime.tv_usec'] / 1e6;
607  }
608  return $ret;
609  }
610 
615  function resetParseStartTime() {
616  $this->mParseStartTime = self::getTimes();
617  }
618 
630  function getTimeSinceStart( $clock ) {
631  if ( !isset( $this->mParseStartTime[$clock] ) ) {
632  return null;
633  }
634 
635  $end = self::getTimes( $clock );
636  return $end[$clock] - $this->mParseStartTime[$clock];
637  }
638 
658  function setLimitReportData( $key, $value ) {
659  $this->mLimitReportData[$key] = $value;
660  }
661 
665  function __sleep() {
666  return array_diff(
667  array_keys( get_object_vars( $this ) ),
668  array( 'mSecondaryDataUpdates', 'mParseStartTime' )
669  );
670  }
671 }
ParserOutput\addOutputPageMetadata
addOutputPageMetadata(OutputPage $out)
Copy items from the OutputPage object into this one.
Definition: ParserOutput.php:347
check
in this case you re responsible for computing and outputting the entire conflict i the difference between revisions and your text headers and sections and Diff overridable Default is either copyrightwarning or copyrightwarning2 overridable Default is editpage tos summary such as anonymity and the real check
Definition: hooks.txt:1038
ID
occurs before session is loaded can be modified ID
Definition: hooks.txt:2818
Title\newFromText
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
Definition: Title.php:189
ParserOutput\$mProperties
$mProperties
Definition: ParserOutput.php:49
of
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
Definition: globals.txt:10
ParserOutput\setTitleText
setTitleText( $t)
Definition: ParserOutput.php:152
ParserOutput
Definition: ParserOutput.php:24
query
For a write query
Definition: database.txt:26
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
ParserOutput\$mInterwikiLinks
$mInterwikiLinks
Definition: ParserOutput.php:35
CacheTime
Parser cache specific expiry check.
Definition: CacheTime.php:29
ParserOutput\addModuleScripts
addModuleScripts( $modules)
Definition: ParserOutput.php:312
ParserOutput\resetParseStartTime
resetParseStartTime()
Resets the parse start timestamps for future calls to getTimeSinceStart()
Definition: ParserOutput.php:615
ParserOutput\getSecondaryDataUpdates
getSecondaryDataUpdates(Title $title=null, $recursive=true)
Returns any DataUpdate jobs to be executed in order to store secondary information extracted from the...
Definition: ParserOutput.php:520
ParserOutput\setDisplayTitle
setDisplayTitle( $text)
Override the title to be used for display – this is assumed to have been validated (check equal norma...
Definition: ParserOutput.php:364
ParserOutput\setTimestamp
setTimestamp( $timestamp)
Definition: ParserOutput.php:157
ParserOutput\getUsedOptions
getUsedOptions()
Returns the options from its ParserOptions which have been taken into account to produce this output ...
Definition: ParserOutput.php:470
is
We use the convention $dbr for read and $dbw for write to help you keep track of whether the database object is a the world will explode Or to be a subsequent write query which succeeded on the master may fail when replicated to the slave due to a unique key collision Replication on the slave will stop and it may take hours to repair the database and get it back online Setting read_only in my cnf on the slave will avoid this but given the dire we prefer to have as many checks as possible We provide a but the wrapper functions like please read the documentation for except in special pages derived from QueryPage It s a common pitfall for new developers to submit code containing SQL queries which examine huge numbers of rows Remember that COUNT * is(N), counting rows in atable is like counting beans in a bucket.------------------------------------------------------------------------ Replication------------------------------------------------------------------------The largest installation of MediaWiki, Wikimedia, uses a large set ofslave MySQL servers replicating writes made to a master MySQL server. Itis important to understand the issues associated with this setup if youwant to write code destined for Wikipedia.It 's often the case that the best algorithm to use for a given taskdepends on whether or not replication is in use. Due to our unabashedWikipedia-centrism, we often just use the replication-friendly version, but if you like, you can use wfGetLB() ->getServerCount() > 1 tocheck to see if replication is in use.===Lag===Lag primarily occurs when large write queries are sent to the master.Writes on the master are executed in parallel, but they are executed inserial when they are replicated to the slaves. The master writes thequery to the binlog when the transaction is committed. The slaves pollthe binlog and start executing the query as soon as it appears. They canservice reads while they are performing a write query, but will not readanything more from the binlog and thus will perform no more writes. Thismeans that if the write query runs for a long time, the slaves will lagbehind the master for the time it takes for the write query to complete.Lag can be exacerbated by high read load. MediaWiki 's load balancer willstop sending reads to a slave when it is lagged by more than 30 seconds.If the load ratios are set incorrectly, or if there is too much loadgenerally, this may lead to a slave permanently hovering around 30seconds lag.If all slaves are lagged by more than 30 seconds, MediaWiki will stopwriting to the database. All edits and other write operations will berefused, with an error returned to the user. This gives the slaves achance to catch up. Before we had this mechanism, the slaves wouldregularly lag by several minutes, making review of recent editsdifficult.In addition to this, MediaWiki attempts to ensure that the user seesevents occurring on the wiki in chronological order. A few seconds of lagcan be tolerated, as long as the user sees a consistent picture fromsubsequent requests. This is done by saving the master binlog positionin the session, and then at the start of each request, waiting for theslave to catch up to that position before doing any reads from it. Ifthis wait times out, reads are allowed anyway, but the request isconsidered to be in "lagged slave mode". Lagged slave mode can bechecked by calling wfGetLB() ->getLaggedSlaveMode(). The onlypractical consequence at present is a warning displayed in the pagefooter.===Lag avoidance===To avoid excessive lag, queries which write large numbers of rows shouldbe split up, generally to write one row at a time. Multi-row INSERT ...SELECT queries are the worst offenders should be avoided altogether.Instead do the select first and then the insert.===Working with lag===Despite our best efforts, it 's not practical to guarantee a low-lagenvironment. Lag will usually be less than one second, but mayoccasionally be up to 30 seconds. For scalability, it 's very importantto keep load on the master low, so simply sending all your queries tothe master is not the answer. So when you have a genuine need forup-to-date data, the following approach is advised:1) Do a quick query to the master for a sequence number or timestamp 2) Run the full query on the slave and check if it matches the data you gotfrom the master 3) If it doesn 't, run the full query on the masterTo avoid swamping the master every time the slaves lag, use of thisapproach should be kept to a minimum. In most cases you should just readfrom the slave and let the user deal with the delay.------------------------------------------------------------------------ Lock contention------------------------------------------------------------------------Due to the high write rate on Wikipedia(and some other wikis), MediaWiki developers need to be very careful to structure their writesto avoid long-lasting locks. By default, MediaWiki opens a transactionat the first query, and commits it before the output is sent. Locks willbe held from the time when the query is done until the commit. So youcan reduce lock time by doing as much processing as possible before youdo your write queries.Often this approach is not good enough, and it becomes necessary toenclose small groups of queries in their own transaction. Use thefollowing syntax:$dbw=wfGetDB(DB_MASTER
ParserOutput\setLimitReportData
setLimitReportData( $key, $value)
Sets parser limit report data for a key.
Definition: ParserOutput.php:658
wfSetVar
wfSetVar(&$dest, $source, $force=false)
Sets dest to source and returns the original value of dest If source is NULL, it just returns the val...
Definition: GlobalFunctions.php:2139
text
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text
Definition: design.txt:12
ParserOutput\$mModuleMessages
$mModuleMessages
Definition: ParserOutput.php:43
$timestamp
if( $limit) $timestamp
Definition: importImages.php:104
ParserOutput\__sleep
__sleep()
Save space for for serialization by removing useless values.
Definition: ParserOutput.php:665
ParserOutput\setNewSection
setNewSection( $value)
Definition: ParserOutput.php:168
ParserOutput\getModules
getModules()
Definition: ParserOutput.php:134
ParserOutput\getImages
& getImages()
Definition: ParserOutput.php:129
ParserOutput\addModules
addModules( $modules)
Definition: ParserOutput.php:308
ParserOutput\$mEditSectionTokens
$mEditSectionTokens
Definition: ParserOutput.php:48
contents
Some information about database access in MediaWiki By Tim January Database layout For information about the MediaWiki database such as a description of the tables and their contents
Definition: database.txt:2
ParserOutput\addTemplate
addTemplate( $title, $page_id, $rev_id)
Register a template dependency for this output.
Definition: ParserOutput.php:267
$ret
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses & $ret
Definition: hooks.txt:1530
ParserOutput\getJsConfigVars
getJsConfigVars()
Definition: ParserOutput.php:139
LinksUpdate
See docs/deferred.txt.
Definition: LinksUpdate.php:28
NS_FILE
const NS_FILE
Definition: Defines.php:85
ParserOutput\$mImages
$mImages
Definition: ParserOutput.php:32
ParserOutput\setFlag
setFlag( $flag)
Fairly generic flag setter thingy.
Definition: ParserOutput.php:385
ParserOutput\hideNewSection
hideNewSection( $value)
Definition: ParserOutput.php:171
ParserOutput\$mOutputHooks
$mOutputHooks
Definition: ParserOutput.php:45
ParserOutput\addLink
addLink(Title $title, $id=null)
Record a local or interwiki inline link for saving in future link tables.
Definition: ParserOutput.php:218
$s
$s
Definition: mergeMessageFileList.php:156
ParserOutput\$mFileSearchOptions
$mFileSearchOptions
Definition: ParserOutput.php:33
messages
namespace and then decline to actually register it RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist 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 in case the handler function wants to provide a converted Content object Note that $result getContentModel() must return $toModel. Handler functions that modify $result should generally return false to further attempts at conversion. 'ContribsPager you ll need to handle error messages
Definition: hooks.txt:896
ParserOutput\getHeadItems
getHeadItems()
Definition: ParserOutput.php:133
DataUpdate
Abstract base class for update jobs that do something with some secondary data extracted from article...
Definition: DataUpdate.php:32
ParserOutput\getProperties
getProperties()
Definition: ParserOutput.php:458
ParserOutput\getModuleStyles
getModuleStyles()
Definition: ParserOutput.php:136
key
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add in any and then calling but I prefer the flexibility This should also do the output encoding The system allocates a global one in $wgOut Title Represents the title of an and does all the work of translating among various forms such as plain database key
Definition: design.txt:25
title
to move a page</td >< td > &*You are moving the page across *A non empty talk page already exists under the new or *You uncheck the box below In those you will have to move or merge the page manually if desired</td >< td > be sure to &You are responsible for making sure that links continue to point where they are supposed to go Note that the page will &a page at the new title
Definition: All_system_messages.txt:2703
ParserOutput\$mNoGallery
$mNoGallery
Definition: ParserOutput.php:38
NS_SPECIAL
const NS_SPECIAL
Definition: Defines.php:68
ParserOutput\setTOCEnabled
setTOCEnabled( $flag)
Definition: ParserOutput.php:158
MWException
MediaWiki exception.
Definition: MWException.php:26
$out
$out
Definition: UtfNormalGenerate.php:167
ParserOutput\getCategoryLinks
getCategoryLinks()
Definition: ParserOutput.php:121
ParserOutput\getFlag
getFlag( $flag)
Definition: ParserOutput.php:389
ParserOutput\getTimestamp
getTimestamp()
Definition: ParserOutput.php:144
ParserOutput\addModuleMessages
addModuleMessages( $modules)
Definition: ParserOutput.php:320
ParserOutput\isLinkInternal
static isLinkInternal( $internal, $url)
Checks, if a url is pointing to the own server.
Definition: ParserOutput.php:188
ParserOutput\addExternalLink
addExternalLink( $url)
Definition: ParserOutput.php:199
ParserOutput\getInterwikiLinks
getInterwikiLinks()
Definition: ParserOutput.php:120
ParserOutput\getTimeSinceStart
getTimeSinceStart( $clock)
Returns the time since resetParseStartTime() was last called.
Definition: ParserOutput.php:630
wfProfileOut
wfProfileOut( $functionname='missing')
Stop profiling of a function.
Definition: Profiler.php:46
ParserOutput\addImage
addImage( $name, $timestamp=null, $sha1=null)
Register a file dependency for this output.
Definition: ParserOutput.php:253
$wgOut
$wgOut
Definition: Setup.php:562
ParserOutput\$mExternalLinks
$mExternalLinks
Definition: ParserOutput.php:34
ParserOutput\getTimes
static getTimes( $clock=null)
Definition: ParserOutput.php:598
ParserOutput\addCategory
addCategory( $c, $sort)
Definition: ParserOutput.php:160
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
ParserOutput\getTOCEnabled
getTOCEnabled()
Definition: ParserOutput.php:146
ParserOutput\addModuleStyles
addModuleStyles( $modules)
Definition: ParserOutput.php:316
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
ParserOutput\setText
setText( $text)
Definition: ParserOutput.php:148
ParserOutput\getDisplayTitle
getDisplayTitle()
Get the title to be used for display.
Definition: ParserOutput.php:374
ParserOutput\setLanguageLinks
setLanguageLinks( $ll)
Definition: ParserOutput.php:149
ParserOutput\setEditSectionTokens
setEditSectionTokens( $t)
Definition: ParserOutput.php:154
OutputPage
This class should be covered by a general architecture document which does not exist as of January 20...
Definition: OutputPage.php:38
ParserOutput\getLanguageLinks
& getLanguageLinks()
Definition: ParserOutput.php:119
ParserOutput\$mHideNewSection
$mHideNewSection
Definition: ParserOutput.php:37
$sort
$sort
Definition: profileinfo.php:301
ParserOutput\$mLanguageLinks
$mLanguageLinks
Definition: ParserOutput.php:25
ParserOutput\getModuleScripts
getModuleScripts()
Definition: ParserOutput.php:135
ParserOutput\getExternalLinks
& getExternalLinks()
Definition: ParserOutput.php:131
ParserOutput\getTemplateIds
& getTemplateIds()
Definition: ParserOutput.php:128
ParserOutput\getTOCHTML
getTOCHTML()
Definition: ParserOutput.php:143
will
</td >< td > &</td >< td > t want your writing to be edited mercilessly and redistributed at will
Definition: All_system_messages.txt:914
ParserOutput\recordOption
recordOption( $option)
Tags a parser option for use in the cache key for this parser output.
Definition: ParserOutput.php:486
ParserOutput\addOutputHook
addOutputHook( $hook, $data=false)
Definition: ParserOutput.php:164
$section
$section
Definition: Utf8Test.php:88
ParserOutput\getTitleText
getTitleText()
Definition: ParserOutput.php:123
ParserOutput\$mWarnings
$mWarnings
Definition: ParserOutput.php:46
ParserOutput\setProperty
setProperty( $name, $value)
Set a property to be stored in the page_props database table.
Definition: ParserOutput.php:450
ParserOutput\getNewSection
getNewSection()
Definition: ParserOutput.php:177
$title
presenting them properly to the user as errors is done by the caller $title
Definition: hooks.txt:1324
ParserOutput\setExtensionData
setExtensionData( $key, $value)
Attaches arbitrary data to this ParserObject.
Definition: ParserOutput.php:571
user
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 and we might be restricted by PHP settings such as safe mode or open_basedir We cannot assume that the software even has read access anywhere useful Many shared hosts run all users web applications under the same user
Definition: distributors.txt:9
$name
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:336
$value
$value
Definition: styleTest.css.php:45
NS_MEDIA
const NS_MEDIA
Definition: Defines.php:67
ParserOutput\$mSections
$mSections
Definition: ParserOutput.php:47
$linksUpdate
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses after processing after in associative array form externallinks $linksUpdate
Definition: hooks.txt:1530
variable
controlled by $wgMainCacheType controlled by $wgParserCacheType controlled by $wgMessageCacheType If you set CACHE_NONE to one of the three control variable
Definition: memcached.txt:78
ParserOutput\getOutputHooks
getOutputHooks()
Definition: ParserOutput.php:140
ParserOutput\$mLinks
$mLinks
Definition: ParserOutput.php:29
ParserOutput\getHideNewSection
getHideNewSection()
Definition: ParserOutput.php:174
ParserOutput\$mTitleText
$mTitleText
Definition: ParserOutput.php:25
ParserOutput\$mJsConfigVars
$mJsConfigVars
Definition: ParserOutput.php:44
ParserOutput\getNoGallery
getNoGallery()
Definition: ParserOutput.php:132
ParserOutput\addWarning
addWarning( $s)
Definition: ParserOutput.php:162
ParserOutput\addSecondaryDataUpdate
addSecondaryDataUpdate(DataUpdate $update)
Adds an update job to the output.
Definition: ParserOutput.php:500
tags
pre inside other HTML tags(bug 54946) !! wikitext a< div >< pre > foo</pre ></div >< pre ></pre > !! html< p >a</p >< div >< pre > foo</pre ></div >< pre ></pre > !! end !! test HTML pre followed by indent-pre !! wikitext< pre >foo</pre > bar !! html< pre >foo</pre >< pre >bar</pre > !! end !!test Block tag pre !!options parsoid !! wikitext< p >< pre >foo</pre ></p > !! html< p data-parsoid
ParserOutput\getTemplates
& getTemplates()
Definition: ParserOutput.php:127
only
published in in Madrid In the first edition of the Vocabolario for was published In in Rotterdam was the Dictionnaire Universel ! html< p > The first monolingual dictionary written in a Romance language was< i > Sebastián Covarrubias</i >< i > Tesoro de la lengua castellana o published in in Madrid In the first edition of the< i > Vocabolario dell< a href="/index.php?title=Accademia_della_Crusca&amp;action=edit&amp;redlink=1" class="new" title="Accademia della Crusca (page does not exist)"> Accademia della Crusca</a ></i > for was published In in Rotterdam was the< i > Dictionnaire Universel</i ></p > ! end ! test Italics and ! wikitext foo ! html< p >< i > foo</i ></p > !end ! test Italics and ! wikitext foo ! html< p >< i > foo</i ></p > !end ! test Italics and ! wikitext foo ! html< p >< i > foo</i ></p > !end ! test Italics and ! wikitext foo ! html php< p >< i > foo</i ></p > ! html parsoid< p >< i > foo</i >< b ></b ></p > !end ! test Italics and ! wikitext foo ! html< p >< i > foo</i ></p > !end ! test Italics and ! wikitext foo ! html< p >< b > foo</b ></p > !end ! test Italics and ! wikitext foo ! html< p >< b > foo</b ></p > !end ! test Italics and ! wikitext foo ! html php< p >< b > foo</b ></p > ! html parsoid< p >< b > foo</b >< i ></i ></p > !end ! test Italics and ! wikitext foo ! html< p >< i > foo</i ></p > !end ! test Italics and ! wikitext foo ! html< p >< b > foo</b ></p > !end ! test Italics and ! wikitext foo ! html< p >< b > foo</b ></p > !end ! test Italics and ! wikitext foo ! html php< p >< b > foo</b ></p > ! html parsoid< p >< b > foo</b >< i ></i ></p > !end ! test Italics and ! options ! wikitext foo ! html< p >< b >< i > foo</i ></b ></p > !end ! test Italics and ! wikitext foo ! html< p >< i >< b > foo</b ></i ></p > !end ! test Italics and ! wikitext foo ! html< p >< i >< b > foo</b ></i ></p > !end ! test Italics and ! wikitext foo ! html< p >< i >< b > foo</b ></i ></p > !end ! test Italics and ! wikitext foo bar ! html< p >< i > foo< b > bar</b ></i ></p > !end ! test Italics and ! wikitext foo bar ! html< p >< i > foo< b > bar</b ></i ></p > !end ! test Italics and ! wikitext foo bar ! html< p >< i > foo< b > bar</b ></i ></p > !end ! test Italics and ! wikitext foo bar ! html php< p >< b > foo</b > bar</p > ! html parsoid< p >< b > foo</b > bar< i ></i ></p > !end ! test Italics and ! wikitext foo bar ! html php< p >< b > foo</b > bar</p > ! html parsoid< p >< b > foo</b > bar< b ></b ></p > !end ! test Italics and ! wikitext this is about foo s family ! html< p >< i > this is about< b > foo s family</b ></i ></p > !end ! test Italics and ! wikitext this is about foo s family ! html< p >< i > this is about< b > foo s</b > family</i ></p > !end ! test Italics and ! wikitext this is about foo s family ! html< p >< b > this is about< i > foo</i ></b >< i > s family</i ></p > !end ! test Italics and ! options ! wikitext this is about foo s family ! html< p >< i > this is about</i > foo< b > s family</b ></p > !end ! test Italics and ! wikitext this is about foo s family ! html< p >< b > this is about< i > foo s</i > family</b ></p > !end ! test Italicized possessive ! wikitext The s talk page ! html< p > The< i >< a href="/wiki/Main_Page" title="Main Page"> Main Page</a ></i > s talk page</p > ! end ! test Parsoid only
Definition: parserTests.txt:396
ParserOutput\setSections
setSections( $toc)
Definition: ParserOutput.php:153
ParserOutput\setCategoryLinks
setCategoryLinks( $cl)
Definition: ParserOutput.php:150
$skin
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned $skin
Definition: hooks.txt:1530
ParserOutput\$mTOCEnabled
$mTOCEnabled
Definition: ParserOutput.php:52
ParserOutput\$mText
$mText
Definition: ParserOutput.php:25
broken
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped broken
Definition: hooks.txt:1530
$args
if( $line===false) $args
Definition: cdb.php:62
ParserOutput\getFileSearchOptions
& getFileSearchOptions()
Definition: ParserOutput.php:130
Title
Represents a title within MediaWiki.
Definition: Title.php:35
$wgLang
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 $wgLang
Definition: design.txt:56
ParserOutput\getProperty
getProperty( $name)
Definition: ParserOutput.php:454
ParserOutput\getModuleMessages
getModuleMessages()
Definition: ParserOutput.php:137
ParserOutput\$mModuleStyles
$mModuleStyles
Definition: ParserOutput.php:42
output
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add in any and then calling output() to send it all. It could be easily changed to send incrementally if that becomes useful
ParserOutput\$mTOCHTML
$mTOCHTML
Definition: ParserOutput.php:50
ParserOutput\$mModules
$mModules
Definition: ParserOutput.php:40
in
Prior to maintenance scripts were a hodgepodge of code that had no cohesion or formal method of action Beginning in
Definition: maintenance.txt:1
on
We ve cleaned up the code here by removing clumps of infrequently used code and moving them off somewhere else It s much easier for someone working with this code to see what s _really_ going on
Definition: hooks.txt:86
https
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at https
Definition: design.txt:12
ParserOutput\$mCategories
$mCategories
Definition: ParserOutput.php:25
used
you don t have to do a grep find to see where the $wgReverseTitle variable is used
Definition: hooks.txt:117
ParserOutput\addJsConfigVars
addJsConfigVars( $keys, $value=null)
Add one or more variables to be set in mw.config in JavaScript.
Definition: ParserOutput.php:331
ParserOutput\getCategories
& getCategories()
Definition: ParserOutput.php:122
ParserOutput\replaceEditSectionLinksCallback
replaceEditSectionLinksCallback( $m)
callback used by getText to replace editsection tokens
Definition: ParserOutput.php:103
as
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
Definition: distributors.txt:9
$keys
$keys
Definition: testCompression.php:63
ParserOutput\getLimitReportData
getLimitReportData()
Definition: ParserOutput.php:145
ParserOutput\getEditSectionTokens
getEditSectionTokens()
Definition: ParserOutput.php:125
Warning
return false to override stock group addition can be modified try getUserPermissionsErrors userCan checks are continued by internal code can override on output return false to not delete it return false to override the default password checks this Boolean value will be checked to determine if the password was valid return false to implement your own hashing method this String will be used as the hash which may be added to this hook is run right before returning the options to the caller Warning
Definition: hooks.txt:2697
ParserOutput\$mTemplates
$mTemplates
Definition: ParserOutput.php:30
ParserOutput\getExtensionData
getExtensionData( $key)
Gets extensions data previously attached to this ParserOutput using setExtensionData().
Definition: ParserOutput.php:590
ParserOutput\addLanguageLink
addLanguageLink( $t)
Definition: ParserOutput.php:161
$t
$t
Definition: testCompression.php:65
ParserOutput\$mHeadItems
$mHeadItems
Definition: ParserOutput.php:39
ParserOutput\$mTemplateIds
$mTemplateIds
Definition: ParserOutput.php:31
ParserOutput\addInterwikiLink
addInterwikiLink( $title)
Definition: ParserOutput.php:284
ParserOutput\setTOCHTML
setTOCHTML( $tochtml)
Definition: ParserOutput.php:156
ParserOutput\$mNewSection
$mNewSection
Definition: ParserOutput.php:36
order
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add in any order
Definition: design.txt:12
ParserOutput\getSections
getSections()
Definition: ParserOutput.php:124
ParserOutput\addHeadItem
addHeadItem( $section, $tag=false)
Add some text to the "<head>".
Definition: ParserOutput.php:300
server
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 and we might be restricted by PHP settings such as safe mode or open_basedir We cannot assume that the software even has read access anywhere useful Many shared hosts run all users web applications under the same so they can t rely on Unix and must forbid reads to even standard directories like tmp lest users read each others files We cannot assume that the user has the ability to install or run any programs not written as web accessible PHP scripts Since anything that works on cheap shared hosting will work if you have shell or root access MediaWiki s design is based around catering to the lowest common denominator Although we support higher end setups as the way many things work by default is tailored toward shared hosting These defaults are unconventional from the point of view of and they certainly aren t ideal for someone who s installing MediaWiki as MediaWiki does not conform to normal Unix filesystem layout Hopefully we ll offer direct support for standard layouts in the but for now *any change to the location of files is unsupported *Moving things and leaving symlinks will *probably *not break but it is *strongly *advised not to try any more intrusive changes to get MediaWiki to conform more closely to your filesystem hierarchy Any such attempt will almost certainly result in unnecessary bugs The standard recommended location to install relative to the web is it should be possible to enable the appropriate rewrite rules by if you can reconfigure the web server
Definition: distributors.txt:53
ParserOutput\$mModuleScripts
$mModuleScripts
Definition: ParserOutput.php:41
were
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those were
Definition: skin.txt:10
section
section
Definition: parserTests.txt:378
ParserOutput\$mTimestamp
$mTimestamp
Definition: ParserOutput.php:50
ParserOutput\getLinks
& getLinks()
Definition: ParserOutput.php:126
ParserOutput\setIndexPolicy
setIndexPolicy( $policy)
Definition: ParserOutput.php:155
ParserOutput\getIndexPolicy
getIndexPolicy()
Definition: ParserOutput.php:142
ParserOutput\getWarnings
getWarnings()
Definition: ParserOutput.php:141
page
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values my talk page
Definition: hooks.txt:1956