MediaWiki  master
ParserOutput.php
Go to the documentation of this file.
1 <?php
2 
24 class ParserOutput extends CacheTime {
28  public $mText;
29 
35 
39  public $mCategories;
40 
44  public $mIndicators = [];
45 
49  public $mTitleText;
50 
55  public $mLinks = [];
56 
61  public $mTemplates = [];
62 
67  public $mTemplateIds = [];
68 
72  public $mImages = [];
73 
77  public $mFileSearchOptions = [];
78 
82  public $mExternalLinks = [];
83 
88  public $mInterwikiLinks = [];
89 
93  public $mNewSection = false;
94 
98  public $mHideNewSection = false;
99 
103  public $mNoGallery = false;
104 
108  public $mHeadItems = [];
109 
113  public $mModules = [];
114 
118  public $mModuleScripts = [];
119 
123  public $mModuleStyles = [];
124 
128  public $mJsConfigVars = [];
129 
133  public $mOutputHooks = [];
134 
139  public $mWarnings = [];
140 
144  public $mSections = [];
145 
149  public $mEditSectionTokens = false;
150 
154  public $mProperties = [];
155 
159  public $mTOCHTML = '';
160 
164  public $mTimestamp;
165 
169  public $mTOCEnabled = true;
170 
174  public $mEnableOOUI = false;
175 
179  private $mIndexPolicy = '';
180 
184  private $mAccessedOptions = [];
185 
189  private $mExtensionData = [];
190 
192  private $mLimitReportData = [];
193 
197  private $mParseStartTime = [];
198 
202  private $mPreventClickjacking = false;
203 
207  private $mFlags = [];
208 
211 
213  '#<(?:mw:)?editsection page="(.*?)" section="(.*?)"(?:/>|>(.*?)(</(?:mw:)?editsection>))#';
214 
215  public function __construct( $text = '', $languageLinks = [], $categoryLinks = [],
216  $unused = false, $titletext = ''
217  ) {
218  $this->mText = $text;
219  $this->mLanguageLinks = $languageLinks;
220  $this->mCategories = $categoryLinks;
221  $this->mTitleText = $titletext;
222  }
223 
231  public function getRawText() {
232  return $this->mText;
233  }
234 
235  public function getText() {
236  $text = $this->mText;
237  if ( $this->mEditSectionTokens ) {
238  $text = preg_replace_callback(
240  function ( $m ) {
242  $editsectionPage = Title::newFromText( htmlspecialchars_decode( $m[1] ) );
243  $editsectionSection = htmlspecialchars_decode( $m[2] );
244  $editsectionContent = isset( $m[4] ) ? $m[3] : null;
245 
246  if ( !is_object( $editsectionPage ) ) {
247  throw new MWException( "Bad parser output text." );
248  }
249 
250  $skin = $wgOut->getSkin();
251  return call_user_func_array(
252  [ $skin, 'doEditSectionLink' ],
253  [ $editsectionPage, $editsectionSection,
254  $editsectionContent, $wgLang->getCode() ]
255  );
256  },
257  $text
258  );
259  } else {
260  $text = preg_replace( ParserOutput::EDITSECTION_REGEX, '', $text );
261  }
262 
263  // If you have an old cached version of this class - sorry, you can't disable the TOC
264  if ( isset( $this->mTOCEnabled ) && $this->mTOCEnabled ) {
265  $text = str_replace( [ Parser::TOC_START, Parser::TOC_END ], '', $text );
266  } else {
267  $text = preg_replace(
268  '#' . preg_quote( Parser::TOC_START, '#' ) . '.*?' . preg_quote( Parser::TOC_END, '#' ) . '#s',
269  '',
270  $text
271  );
272  }
273  return $text;
274  }
275 
280  public function setSpeculativeRevIdUsed( $id ) {
281  $this->mSpeculativeRevId = $id;
282  }
283 
285  public function getSpeculativeRevIdUsed() {
287  }
288 
289  public function &getLanguageLinks() {
290  return $this->mLanguageLinks;
291  }
292 
293  public function getInterwikiLinks() {
294  return $this->mInterwikiLinks;
295  }
296 
297  public function getCategoryLinks() {
298  return array_keys( $this->mCategories );
299  }
300 
301  public function &getCategories() {
302  return $this->mCategories;
303  }
304 
308  public function getIndicators() {
309  return $this->mIndicators;
310  }
311 
312  public function getTitleText() {
313  return $this->mTitleText;
314  }
315 
316  public function getSections() {
317  return $this->mSections;
318  }
319 
320  public function getEditSectionTokens() {
322  }
323 
324  public function &getLinks() {
325  return $this->mLinks;
326  }
327 
328  public function &getTemplates() {
329  return $this->mTemplates;
330  }
331 
332  public function &getTemplateIds() {
333  return $this->mTemplateIds;
334  }
335 
336  public function &getImages() {
337  return $this->mImages;
338  }
339 
340  public function &getFileSearchOptions() {
342  }
343 
344  public function &getExternalLinks() {
345  return $this->mExternalLinks;
346  }
347 
348  public function getNoGallery() {
349  return $this->mNoGallery;
350  }
351 
352  public function getHeadItems() {
353  return $this->mHeadItems;
354  }
355 
356  public function getModules() {
357  return $this->mModules;
358  }
359 
360  public function getModuleScripts() {
361  return $this->mModuleScripts;
362  }
363 
364  public function getModuleStyles() {
365  return $this->mModuleStyles;
366  }
367 
369  public function getJsConfigVars() {
370  return $this->mJsConfigVars;
371  }
372 
373  public function getOutputHooks() {
374  return (array)$this->mOutputHooks;
375  }
376 
377  public function getWarnings() {
378  return array_keys( $this->mWarnings );
379  }
380 
381  public function getIndexPolicy() {
382  return $this->mIndexPolicy;
383  }
384 
385  public function getTOCHTML() {
386  return $this->mTOCHTML;
387  }
388 
392  public function getTimestamp() {
393  return $this->mTimestamp;
394  }
395 
396  public function getLimitReportData() {
398  }
399 
400  public function getTOCEnabled() {
401  return $this->mTOCEnabled;
402  }
403 
404  public function getEnableOOUI() {
405  return $this->mEnableOOUI;
406  }
407 
408  public function setText( $text ) {
409  return wfSetVar( $this->mText, $text );
410  }
411 
412  public function setLanguageLinks( $ll ) {
413  return wfSetVar( $this->mLanguageLinks, $ll );
414  }
415 
416  public function setCategoryLinks( $cl ) {
417  return wfSetVar( $this->mCategories, $cl );
418  }
419 
420  public function setTitleText( $t ) {
421  return wfSetVar( $this->mTitleText, $t );
422  }
423 
424  public function setSections( $toc ) {
425  return wfSetVar( $this->mSections, $toc );
426  }
427 
428  public function setEditSectionTokens( $t ) {
429  return wfSetVar( $this->mEditSectionTokens, $t );
430  }
431 
432  public function setIndexPolicy( $policy ) {
433  return wfSetVar( $this->mIndexPolicy, $policy );
434  }
435 
436  public function setTOCHTML( $tochtml ) {
437  return wfSetVar( $this->mTOCHTML, $tochtml );
438  }
439 
440  public function setTimestamp( $timestamp ) {
441  return wfSetVar( $this->mTimestamp, $timestamp );
442  }
443 
444  public function setTOCEnabled( $flag ) {
445  return wfSetVar( $this->mTOCEnabled, $flag );
446  }
447 
448  public function addCategory( $c, $sort ) {
449  $this->mCategories[$c] = $sort;
450  }
451 
455  public function setIndicator( $id, $content ) {
456  $this->mIndicators[$id] = $content;
457  }
458 
466  public function setEnableOOUI( $enable = false ) {
467  $this->mEnableOOUI = $enable;
468  }
469 
470  public function addLanguageLink( $t ) {
471  $this->mLanguageLinks[] = $t;
472  }
473 
474  public function addWarning( $s ) {
475  $this->mWarnings[$s] = 1;
476  }
477 
478  public function addOutputHook( $hook, $data = false ) {
479  $this->mOutputHooks[] = [ $hook, $data ];
480  }
481 
482  public function setNewSection( $value ) {
483  $this->mNewSection = (bool)$value;
484  }
485  public function hideNewSection( $value ) {
486  $this->mHideNewSection = (bool)$value;
487  }
488  public function getHideNewSection() {
489  return (bool)$this->mHideNewSection;
490  }
491  public function getNewSection() {
492  return (bool)$this->mNewSection;
493  }
494 
502  public static function isLinkInternal( $internal, $url ) {
503  return (bool)preg_match( '/^' .
504  # If server is proto relative, check also for http/https links
505  ( substr( $internal, 0, 2 ) === '//' ? '(?:https?:)?' : '' ) .
506  preg_quote( $internal, '/' ) .
507  # check for query/path/anchor or end of link in each case
508  '(?:[\?\/\#]|$)/i',
509  $url
510  );
511  }
512 
513  public function addExternalLink( $url ) {
514  # We don't register links pointing to our own server, unless... :-)
516 
517  $registerExternalLink = true;
518  if ( !$wgRegisterInternalExternals ) {
519  $registerExternalLink = !self::isLinkInternal( $wgServer, $url );
520  }
521  if ( $registerExternalLink ) {
522  $this->mExternalLinks[$url] = 1;
523  }
524  }
525 
532  public function addLink( Title $title, $id = null ) {
533  if ( $title->isExternal() ) {
534  // Don't record interwikis in pagelinks
535  $this->addInterwikiLink( $title );
536  return;
537  }
538  $ns = $title->getNamespace();
539  $dbk = $title->getDBkey();
540  if ( $ns == NS_MEDIA ) {
541  // Normalize this pseudo-alias if it makes it down here...
542  $ns = NS_FILE;
543  } elseif ( $ns == NS_SPECIAL ) {
544  // We don't record Special: links currently
545  // It might actually be wise to, but we'd need to do some normalization.
546  return;
547  } elseif ( $dbk === '' ) {
548  // Don't record self links - [[#Foo]]
549  return;
550  }
551  if ( !isset( $this->mLinks[$ns] ) ) {
552  $this->mLinks[$ns] = [];
553  }
554  if ( is_null( $id ) ) {
555  $id = $title->getArticleID();
556  }
557  $this->mLinks[$ns][$dbk] = $id;
558  }
559 
567  public function addImage( $name, $timestamp = null, $sha1 = null ) {
568  $this->mImages[$name] = 1;
569  if ( $timestamp !== null && $sha1 !== null ) {
570  $this->mFileSearchOptions[$name] = [ 'time' => $timestamp, 'sha1' => $sha1 ];
571  }
572  }
573 
581  public function addTemplate( $title, $page_id, $rev_id ) {
582  $ns = $title->getNamespace();
583  $dbk = $title->getDBkey();
584  if ( !isset( $this->mTemplates[$ns] ) ) {
585  $this->mTemplates[$ns] = [];
586  }
587  $this->mTemplates[$ns][$dbk] = $page_id;
588  if ( !isset( $this->mTemplateIds[$ns] ) ) {
589  $this->mTemplateIds[$ns] = [];
590  }
591  $this->mTemplateIds[$ns][$dbk] = $rev_id; // For versioning
592  }
593 
598  public function addInterwikiLink( $title ) {
599  if ( !$title->isExternal() ) {
600  throw new MWException( 'Non-interwiki link passed, internal parser error.' );
601  }
602  $prefix = $title->getInterwiki();
603  if ( !isset( $this->mInterwikiLinks[$prefix] ) ) {
604  $this->mInterwikiLinks[$prefix] = [];
605  }
606  $this->mInterwikiLinks[$prefix][$title->getDBkey()] = 1;
607  }
608 
616  public function addHeadItem( $section, $tag = false ) {
617  if ( $tag !== false ) {
618  $this->mHeadItems[$tag] = $section;
619  } else {
620  $this->mHeadItems[] = $section;
621  }
622  }
623 
624  public function addModules( $modules ) {
625  $this->mModules = array_merge( $this->mModules, (array)$modules );
626  }
627 
628  public function addModuleScripts( $modules ) {
629  $this->mModuleScripts = array_merge( $this->mModuleScripts, (array)$modules );
630  }
631 
632  public function addModuleStyles( $modules ) {
633  $this->mModuleStyles = array_merge( $this->mModuleStyles, (array)$modules );
634  }
635 
643  public function addJsConfigVars( $keys, $value = null ) {
644  if ( is_array( $keys ) ) {
645  foreach ( $keys as $key => $value ) {
646  $this->mJsConfigVars[$key] = $value;
647  }
648  return;
649  }
650 
651  $this->mJsConfigVars[$keys] = $value;
652  }
653 
659  public function addOutputPageMetadata( OutputPage $out ) {
660  $this->addModules( $out->getModules() );
661  $this->addModuleScripts( $out->getModuleScripts() );
662  $this->addModuleStyles( $out->getModuleStyles() );
663  $this->addJsConfigVars( $out->getJsConfigVars() );
664 
665  $this->mHeadItems = array_merge( $this->mHeadItems, $out->getHeadItemsArray() );
666  $this->mPreventClickjacking = $this->mPreventClickjacking || $out->getPreventClickjacking();
667  }
668 
683  public function addTrackingCategory( $msg, $title ) {
684  if ( $title->getNamespace() === NS_SPECIAL ) {
685  wfDebug( __METHOD__ . ": Not adding tracking category $msg to special page!\n" );
686  return false;
687  }
688 
689  // Important to parse with correct title (bug 31469)
690  $cat = wfMessage( $msg )
691  ->title( $title )
692  ->inContentLanguage()
693  ->text();
694 
695  # Allow tracking categories to be disabled by setting them to "-"
696  if ( $cat === '-' ) {
697  return false;
698  }
699 
700  $containerCategory = Title::makeTitleSafe( NS_CATEGORY, $cat );
701  if ( $containerCategory ) {
702  $this->addCategory( $containerCategory->getDBkey(), $this->getProperty( 'defaultsort' ) ?: '' );
703  return true;
704  } else {
705  wfDebug( __METHOD__ . ": [[MediaWiki:$msg]] is not a valid title!\n" );
706  return false;
707  }
708  }
709 
721  public function setDisplayTitle( $text ) {
722  $this->setTitleText( $text );
723  $this->setProperty( 'displaytitle', $text );
724  }
725 
734  public function getDisplayTitle() {
735  $t = $this->getTitleText();
736  if ( $t === '' ) {
737  return false;
738  }
739  return $t;
740  }
741 
746  public function setFlag( $flag ) {
747  $this->mFlags[$flag] = true;
748  }
749 
750  public function getFlag( $flag ) {
751  return isset( $this->mFlags[$flag] );
752  }
753 
814  public function setProperty( $name, $value ) {
815  $this->mProperties[$name] = $value;
816  }
817 
826  public function getProperty( $name ) {
827  return isset( $this->mProperties[$name] ) ? $this->mProperties[$name] : false;
828  }
829 
830  public function unsetProperty( $name ) {
831  unset( $this->mProperties[$name] );
832  }
833 
834  public function getProperties() {
835  if ( !isset( $this->mProperties ) ) {
836  $this->mProperties = [];
837  }
838  return $this->mProperties;
839  }
840 
846  public function getUsedOptions() {
847  if ( !isset( $this->mAccessedOptions ) ) {
848  return [];
849  }
850  return array_keys( $this->mAccessedOptions );
851  }
852 
865  public function recordOption( $option ) {
866  $this->mAccessedOptions[$option] = true;
867  }
868 
909  public function setExtensionData( $key, $value ) {
910  if ( $value === null ) {
911  unset( $this->mExtensionData[$key] );
912  } else {
913  $this->mExtensionData[$key] = $value;
914  }
915  }
916 
928  public function getExtensionData( $key ) {
929  if ( isset( $this->mExtensionData[$key] ) ) {
930  return $this->mExtensionData[$key];
931  }
932 
933  return null;
934  }
935 
936  private static function getTimes( $clock = null ) {
937  $ret = [];
938  if ( !$clock || $clock === 'wall' ) {
939  $ret['wall'] = microtime( true );
940  }
941  if ( !$clock || $clock === 'cpu' ) {
942  $ru = wfGetRusage();
943  if ( $ru ) {
944  $ret['cpu'] = $ru['ru_utime.tv_sec'] + $ru['ru_utime.tv_usec'] / 1e6;
945  $ret['cpu'] += $ru['ru_stime.tv_sec'] + $ru['ru_stime.tv_usec'] / 1e6;
946  }
947  }
948  return $ret;
949  }
950 
955  public function resetParseStartTime() {
956  $this->mParseStartTime = self::getTimes();
957  }
958 
970  public function getTimeSinceStart( $clock ) {
971  if ( !isset( $this->mParseStartTime[$clock] ) ) {
972  return null;
973  }
974 
975  $end = self::getTimes( $clock );
976  return $end[$clock] - $this->mParseStartTime[$clock];
977  }
978 
990  public function setLimitReportData( $key, $value ) {
991  if ( is_array( $value ) ) {
992  if ( array_keys( $value ) === [ 0, 1 ]
993  && is_numeric( $value[0] )
994  && is_numeric( $value[1] )
995  ) {
996  $data = [ 'value' => $value[0], 'limit' => $value[1] ];
997  } else {
998  $data = $value;
999  }
1000  } else {
1001  $data = $value;
1002  }
1003 
1004  if ( strpos( $key, '-' ) ) {
1005  list( $ns, $name ) = explode( '-', $key, 2 );
1006  $this->mLimitReportData[$ns][$name] = $data;
1007  } else {
1008  $this->mLimitReportData[$key] = $data;
1009  }
1010  }
1011 
1022  public function hasDynamicContent() {
1024 
1025  return $this->getCacheExpiry() < $wgParserCacheExpireTime;
1026  }
1027 
1035  public function preventClickjacking( $flag = null ) {
1036  return wfSetVar( $this->mPreventClickjacking, $flag );
1037  }
1038 
1043  public function __sleep() {
1044  return array_diff(
1045  array_keys( get_object_vars( $this ) ),
1046  [ 'mParseStartTime' ]
1047  );
1048  }
1049 }
getExtensionData($key)
Gets extensions data previously attached to this ParserOutput using setExtensionData().
getPreventClickjacking()
Get the prevent-clickjacking flag.
setLanguageLinks($ll)
addExternalLink($url)
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
Definition: deferred.txt:11
getHeadItemsArray()
Get an array of head items.
Definition: OutputPage.php:631
setNewSection($value)
$wgParserCacheExpireTime
The expiry time for the parser cache, in seconds.
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 $out
Definition: hooks.txt:776
the array() calling protocol came about after MediaWiki 1.4rc1.
getProperty($name)
setIndexPolicy($policy)
getArticleID($flags=0)
Get the article ID for this Title from the link cache, adding it if necessary.
Definition: Title.php:3141
preventClickjacking($flag=null)
Get or set the prevent-clickjacking flag.
const EDITSECTION_REGEX
setEditSectionTokens($t)
setProperty($name, $value)
Set a property to be stored in the page_props database table.
setTOCEnabled($flag)
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
Definition: globals.txt:10
$wgRegisterInternalExternals
By default MediaWiki does not register links pointing to same server in externallinks dataset...
const TOC_START
Definition: Parser.php:136
setExtensionData($key, $value)
Attaches arbitrary data to this ParserObject.
wfGetRusage()
Get system resource usage of current request context.
& getFileSearchOptions()
$sort
null for the local wiki Added in
Definition: hooks.txt:1435
static isLinkInternal($internal, $url)
Checks, if a url is pointing to the own server.
$value
const NS_SPECIAL
Definition: Defines.php:58
setEnableOOUI($enable=false)
Enables OOUI, if true, in any OutputPage instance this ParserOutput object is added to...
addModuleStyles($modules)
Parser cache specific expiry check.
Definition: CacheTime.php:29
addOutputHook($hook, $data=false)
static newFromText($text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
Definition: Title.php:256
Represents a title within MediaWiki.
Definition: Title.php:36
when a variable name is used in a it is silently declared as a new local masking the global
Definition: design.txt:93
setSpeculativeRevIdUsed($id)
addCategory($c, $sort)
wfDebug($text, $dest= 'all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
Apache License January http
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
setFlag($flag)
Fairly generic flag setter thingy.
getJsConfigVars()
Get the javascript config vars to include on this page.
This document describes the XML format used to represent information about external sites known to a MediaWiki installation This information about external sites is used to allow inter wiki links
in the order they appear.
Definition: sitelist.txt:3
addInterwikiLink($title)
getDisplayTitle()
Get the title to be used for display.
__construct($text= '', $languageLinks=[], $categoryLinks=[], $unused=false, $titletext= '')
setDisplayTitle($text)
Override the title to be used for display.
setLimitReportData($key, $value)
Sets parser limit report data for a key.
getCacheExpiry()
Returns the number of seconds after which this object should expire.
Definition: CacheTime.php:110
Some quick notes on the file repository architecture Functionality is
Definition: README:3
isExternal()
Is this Title interwiki?
Definition: Title.php:789
getDBkey()
Get the main part with underscores.
Definition: Title.php:890
integer null $mSpeculativeRevId
Assumed rev ID for {{REVISIONID}} if no revision is set.
hideNewSection($value)
getModuleScripts($filter=false, $position=null)
Get the list of module JS to include on this page.
Definition: OutputPage.php:570
if($limit) $timestamp
addModuleScripts($modules)
const NS_MEDIA
Definition: Defines.php:57
getTimeSinceStart($clock)
Returns the time since resetParseStartTime() was last called.
MediaWiki exception.
Definition: MWException.php:26
addTrackingCategory($msg, $title)
Add a tracking category, getting the title from a system message, or print a debug message if the tit...
const NS_CATEGORY
Definition: Defines.php:83
addOutputPageMetadata(OutputPage $out)
Copy items from the OutputPage object into this one.
static makeTitleSafe($ns, $title, $fragment= '', $interwiki= '')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:527
setIndicator($id, $content)
getModuleStyles($filter=false, $position=null)
Get the list of module CSS to include on this page.
Definition: OutputPage.php:593
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 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 after processing after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock()-offset Set to overwrite offset parameter in $wgRequest set to ''to unsetoffset-wrap String Wrap the message in html(usually something like"&lt
Allows to change the fields on the form that will be generated are created Can be used to omit specific feeds from being outputted You must not use this hook to add use OutputPage::addFeedLink() instead.&$feedLinks conditions will AND in the final query as a Content object as a Content object $title
Definition: hooks.txt:312
addImage($name, $timestamp=null, $sha1=null)
Register a file dependency for this output.
getNamespace()
Get the namespace index, i.e.
Definition: Title.php:913
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 $tag
Definition: hooks.txt:981
const NS_FILE
Definition: Defines.php:75
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:1816
__sleep()
Save space for serialization by removing useless values.
addModules($modules)
setCategoryLinks($cl)
setTOCHTML($tochtml)
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:1816
getRawText()
Get the cacheable text with <mw:editsection> markers still in it.
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
resetParseStartTime()
Resets the parse start timestamps for future calls to getTimeSinceStart()
This class should be covered by a general architecture document which does not exist as of January 20...
Definition: OutputPage.php:43
usually copyright or history_copyright This message must be in HTML not wikitext if the section is included from a template $section
Definition: hooks.txt:2755
addHeadItem($section, $tag=false)
Add some text to the "<head>".
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
Definition: injection.txt:35
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...
hasDynamicContent()
Check whether the cache TTL was lowered due to dynamic content.
const TOC_END
Definition: Parser.php:137
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
Definition: hooks.txt:1020
usually copyright or history_copyright This message must be in HTML not wikitext if the section is included from a template to be included in the link
Definition: hooks.txt:2755
addLink(Title $title, $id=null)
Record a local or interwiki inline link for saving in future link tables.
unsetProperty($name)
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
$wgServer
URL of the server.
addJsConfigVars($keys, $value=null)
Add one or more variables to be set in mw.config in JavaScript.
$wgOut
Definition: Setup.php:811
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
setTimestamp($timestamp)
static getTimes($clock=null)
getModules($filter=false, $position=null, $param= 'mModules')
Get the list of modules to include on this page.
Definition: OutputPage.php:544
For a write query
Definition: database.txt:26
getUsedOptions()
Returns the options from its ParserOptions which have been taken into account to produce this output ...
addTemplate($title, $page_id, $rev_id)
Register a template dependency for this output.
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:1256
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:310
recordOption($option)
Tags a parser option for use in the cache key for this parser output.