MediaWiki  master
ParserOutput.php
Go to the documentation of this file.
1 <?php
2 
25 class ParserOutput extends CacheTime {
33 
38 
42  public $mText = null;
43 
49 
53  public $mCategories;
54 
58  public $mIndicators = [];
59 
63  public $mTitleText;
64 
70  public $mLinks = [];
71 
76  public $mTemplates = [];
77 
82  public $mTemplateIds = [];
83 
87  public $mImages = [];
88 
92  public $mFileSearchOptions = [];
93 
97  public $mExternalLinks = [];
98 
103  public $mInterwikiLinks = [];
104 
108  public $mNewSection = false;
109 
113  public $mHideNewSection = false;
114 
118  public $mNoGallery = false;
119 
123  public $mHeadItems = [];
124 
128  public $mModules = [];
129 
133  public $mModuleStyles = [];
134 
138  public $mJsConfigVars = [];
139 
143  public $mOutputHooks = [];
144 
149  public $mWarnings = [];
150 
154  public $mSections = [];
155 
159  public $mProperties = [];
160 
164  public $mTOCHTML = '';
165 
169  public $mTimestamp;
170 
174  public $mEnableOOUI = false;
175 
179  private $mIndexPolicy = '';
180 
184  private $mAccessedOptions = [];
185 
189  private $mExtensionData = [];
190 
194  private $mLimitReportData = [];
195 
197  private $mLimitReportJSData = [];
198 
202  private $mParseStartTime = [];
203 
207  private $mPreventClickjacking = false;
208 
212  private $mFlags = [];
213 
215  private const SPECULATIVE_FIELDS = [
216  'speculativePageIdUsed',
217  'mSpeculativeRevId',
218  'revisionTimestampUsed'
219  ];
220 
222  private $mSpeculativeRevId;
227 
230 
234  private $mWrapperDivClasses = [];
235 
237  private $mMaxAdaptiveExpiry = INF;
238 
240  '#<(?:mw:)?editsection page="(.*?)" section="(.*?)"(?:/>|>(.*?)(</(?:mw:)?editsection>))#s';
241 
242  // finalizeAdaptiveCacheExpiry() uses TTL = MAX( m * PARSE_TIME + b, MIN_AR_TTL)
243  // Current values imply that m=3933.333333 and b=-333.333333
244  // See https://www.nngroup.com/articles/website-response-times/
245  const PARSE_FAST_SEC = 0.100; // perceived "fast" page parse
246  const PARSE_SLOW_SEC = 1.0; // perceived "slow" page parse
247  const FAST_AR_TTL = 60; // adaptive TTL for "fast" pages
248  const SLOW_AR_TTL = 3600; // adaptive TTL for "slow" pages
249  const MIN_AR_TTL = 15; // min adaptive TTL (for sanity, pool counter, and edit stashing)
250 
260  public function __construct( $text = '', $languageLinks = [], $categoryLinks = [],
261  $unused = false, $titletext = ''
262  ) {
263  $this->mText = $text;
264  $this->mLanguageLinks = $languageLinks;
265  $this->mCategories = $categoryLinks;
266  $this->mTitleText = $titletext;
267  }
268 
279  public function hasText() {
280  return ( $this->mText !== null );
281  }
282 
291  public function getRawText() {
292  if ( $this->mText === null ) {
293  throw new LogicException( 'This ParserOutput contains no text!' );
294  }
295 
296  return $this->mText;
297  }
298 
325  public function getText( $options = [] ) {
326  $options += [
327  'allowTOC' => true,
328  'enableSectionEditLinks' => true,
329  'skin' => null,
330  'unwrap' => false,
331  'deduplicateStyles' => true,
332  'wrapperDivClass' => $this->getWrapperDivClass(),
333  ];
334  $text = $this->getRawText();
335 
336  Hooks::runWithoutAbort( 'ParserOutputPostCacheTransform', [ $this, &$text, &$options ] );
337 
338  if ( $options['wrapperDivClass'] !== '' && !$options['unwrap'] ) {
339  $text = Html::rawElement( 'div', [ 'class' => $options['wrapperDivClass'] ], $text );
340  }
341 
342  if ( $options['enableSectionEditLinks'] ) {
343  // TODO: Passing the skin should be required
344  $skin = $options['skin'] ?: RequestContext::getMain()->getSkin();
345 
346  $text = preg_replace_callback(
347  self::EDITSECTION_REGEX,
348  function ( $m ) use ( $skin ) {
349  $editsectionPage = Title::newFromText( htmlspecialchars_decode( $m[1] ) );
350  $editsectionSection = htmlspecialchars_decode( $m[2] );
351  $editsectionContent = isset( $m[4] ) ? Sanitizer::decodeCharReferences( $m[3] ) : null;
352 
353  if ( !is_object( $editsectionPage ) ) {
354  throw new MWException( "Bad parser output text." );
355  }
356 
357  return $skin->doEditSectionLink(
358  $editsectionPage,
359  $editsectionSection,
360  $editsectionContent,
361  $skin->getLanguage()
362  );
363  },
364  $text
365  );
366  } else {
367  $text = preg_replace( self::EDITSECTION_REGEX, '', $text );
368  }
369 
370  if ( $options['allowTOC'] ) {
371  $text = str_replace( [ Parser::TOC_START, Parser::TOC_END ], '', $text );
372  } else {
373  $text = preg_replace(
374  '#' . preg_quote( Parser::TOC_START, '#' ) . '.*?' . preg_quote( Parser::TOC_END, '#' ) . '#s',
375  '',
376  $text
377  );
378  }
379 
380  if ( $options['deduplicateStyles'] ) {
381  $seen = [];
382  $text = preg_replace_callback(
383  '#<style\s+([^>]*data-mw-deduplicate\s*=[^>]*)>.*?</style>#s',
384  function ( $m ) use ( &$seen ) {
385  $attr = Sanitizer::decodeTagAttributes( $m[1] );
386  if ( !isset( $attr['data-mw-deduplicate'] ) ) {
387  return $m[0];
388  }
389 
390  $key = $attr['data-mw-deduplicate'];
391  if ( !isset( $seen[$key] ) ) {
392  $seen[$key] = true;
393  return $m[0];
394  }
395 
396  // We were going to use an empty <style> here, but there
397  // was concern that would be too much overhead for browsers.
398  // So let's hope a <link> with a non-standard rel and href isn't
399  // going to be misinterpreted or mangled by any subsequent processing.
400  return Html::element( 'link', [
401  'rel' => 'mw-deduplicated-inline-style',
402  'href' => "mw-data:" . wfUrlencode( $key ),
403  ] );
404  },
405  $text
406  );
407  }
408 
409  // Hydrate slot section header placeholders generated by RevisionRenderer.
410  $text = preg_replace_callback(
411  '#<mw:slotheader>(.*?)</mw:slotheader>#',
412  function ( $m ) {
413  $role = htmlspecialchars_decode( $m[1] );
414  // TODO: map to message, using the interface language. Set lang="xyz" accordingly.
415  $headerText = $role;
416  return $headerText;
417  },
418  $text
419  );
420  return $text;
421  }
422 
428  public function addWrapperDivClass( $class ) {
429  $this->mWrapperDivClasses[$class] = true;
430  }
431 
436  public function clearWrapperDivClass() {
437  $this->mWrapperDivClasses = [];
438  }
439 
447  public function getWrapperDivClass() {
448  return implode( ' ', array_keys( $this->mWrapperDivClasses ) );
449  }
450 
455  public function setSpeculativeRevIdUsed( $id ) {
456  $this->mSpeculativeRevId = $id;
457  }
458 
463  public function getSpeculativeRevIdUsed() {
465  }
466 
471  public function setSpeculativePageIdUsed( $id ) {
472  $this->speculativePageIdUsed = $id;
473  }
474 
479  public function getSpeculativePageIdUsed() {
481  }
482 
487  public function setRevisionTimestampUsed( $timestamp ) {
488  $this->revisionTimestampUsed = $timestamp;
489  }
490 
495  public function getRevisionTimestampUsed() {
497  }
498 
503  public function setRevisionUsedSha1Base36( $hash ) {
504  if ( $hash === null ) {
505  return; // e.g. RevisionRecord::getSha1() returned null
506  }
507 
508  if (
509  $this->revisionUsedSha1Base36 !== null &&
510  $this->revisionUsedSha1Base36 !== $hash
511  ) {
512  $this->revisionUsedSha1Base36 = ''; // mismatched
513  } else {
514  $this->revisionUsedSha1Base36 = $hash;
515  }
516  }
517 
522  public function getRevisionUsedSha1Base36() {
524  }
525 
526  public function &getLanguageLinks() {
527  return $this->mLanguageLinks;
528  }
529 
530  public function getInterwikiLinks() {
531  return $this->mInterwikiLinks;
532  }
533 
534  public function getCategoryLinks() {
535  return array_keys( $this->mCategories );
536  }
537 
538  public function &getCategories() {
539  return $this->mCategories;
540  }
541 
546  public function getIndicators() {
547  return $this->mIndicators;
548  }
549 
550  public function getTitleText() {
551  return $this->mTitleText;
552  }
553 
554  public function getSections() {
555  return $this->mSections;
556  }
557 
558  public function &getLinks() {
559  return $this->mLinks;
560  }
561 
562  public function &getTemplates() {
563  return $this->mTemplates;
564  }
565 
566  public function &getTemplateIds() {
567  return $this->mTemplateIds;
568  }
569 
570  public function &getImages() {
571  return $this->mImages;
572  }
573 
574  public function &getFileSearchOptions() {
576  }
577 
578  public function &getExternalLinks() {
579  return $this->mExternalLinks;
580  }
581 
582  public function setNoGallery( $value ) {
583  $this->mNoGallery = (bool)$value;
584  }
585 
586  public function getNoGallery() {
587  return $this->mNoGallery;
588  }
589 
590  public function getHeadItems() {
591  return $this->mHeadItems;
592  }
593 
594  public function getModules() {
595  return $this->mModules;
596  }
597 
598  public function getModuleStyles() {
599  return $this->mModuleStyles;
600  }
601 
606  public function getJsConfigVars() {
607  return $this->mJsConfigVars;
608  }
609 
610  public function getOutputHooks() {
611  return (array)$this->mOutputHooks;
612  }
613 
614  public function getWarnings() {
615  return array_keys( $this->mWarnings );
616  }
617 
618  public function getIndexPolicy() {
619  return $this->mIndexPolicy;
620  }
621 
622  public function getTOCHTML() {
623  return $this->mTOCHTML;
624  }
625 
629  public function getTimestamp() {
630  return $this->mTimestamp;
631  }
632 
633  public function getLimitReportData() {
635  }
636 
637  public function getLimitReportJSData() {
639  }
640 
641  public function getEnableOOUI() {
642  return $this->mEnableOOUI;
643  }
644 
645  public function setText( $text ) {
646  return wfSetVar( $this->mText, $text );
647  }
648 
649  public function setLanguageLinks( $ll ) {
650  return wfSetVar( $this->mLanguageLinks, $ll );
651  }
652 
653  public function setCategoryLinks( $cl ) {
654  return wfSetVar( $this->mCategories, $cl );
655  }
656 
657  public function setTitleText( $t ) {
658  return wfSetVar( $this->mTitleText, $t );
659  }
660 
661  public function setSections( $toc ) {
662  return wfSetVar( $this->mSections, $toc );
663  }
664 
665  public function setIndexPolicy( $policy ) {
666  return wfSetVar( $this->mIndexPolicy, $policy );
667  }
668 
669  public function setTOCHTML( $tochtml ) {
670  return wfSetVar( $this->mTOCHTML, $tochtml );
671  }
672 
673  public function setTimestamp( $timestamp ) {
674  return wfSetVar( $this->mTimestamp, $timestamp );
675  }
676 
677  public function addCategory( $c, $sort ) {
678  $this->mCategories[$c] = $sort;
679  }
680 
686  public function setIndicator( $id, $content ) {
687  $this->mIndicators[$id] = $content;
688  }
689 
697  public function setEnableOOUI( $enable = false ) {
698  $this->mEnableOOUI = $enable;
699  }
700 
701  public function addLanguageLink( $t ) {
702  $this->mLanguageLinks[] = $t;
703  }
704 
705  public function addWarning( $s ) {
706  $this->mWarnings[$s] = 1;
707  }
708 
709  public function addOutputHook( $hook, $data = false ) {
710  $this->mOutputHooks[] = [ $hook, $data ];
711  }
712 
713  public function setNewSection( $value ) {
714  $this->mNewSection = (bool)$value;
715  }
716 
717  public function hideNewSection( $value ) {
718  $this->mHideNewSection = (bool)$value;
719  }
720 
721  public function getHideNewSection() {
722  return (bool)$this->mHideNewSection;
723  }
724 
725  public function getNewSection() {
726  return (bool)$this->mNewSection;
727  }
728 
736  public static function isLinkInternal( $internal, $url ) {
737  return (bool)preg_match( '/^' .
738  # If server is proto relative, check also for http/https links
739  ( substr( $internal, 0, 2 ) === '//' ? '(?:https?:)?' : '' ) .
740  preg_quote( $internal, '/' ) .
741  # check for query/path/anchor or end of link in each case
742  '(?:[\?\/\#]|$)/i',
743  $url
744  );
745  }
746 
747  public function addExternalLink( $url ) {
748  # We don't register links pointing to our own server, unless... :-)
750 
751  # Replace unnecessary URL escape codes with the referenced character
752  # This prevents spammers from hiding links from the filters
753  $url = Parser::normalizeLinkUrl( $url );
754 
755  $registerExternalLink = true;
757  $registerExternalLink = !self::isLinkInternal( $wgServer, $url );
758  }
759  if ( $registerExternalLink ) {
760  $this->mExternalLinks[$url] = 1;
761  }
762  }
763 
770  public function addLink( Title $title, $id = null ) {
771  if ( $title->isExternal() ) {
772  // Don't record interwikis in pagelinks
773  $this->addInterwikiLink( $title );
774  return;
775  }
776  $ns = $title->getNamespace();
777  $dbk = $title->getDBkey();
778  if ( $ns == NS_MEDIA ) {
779  // Normalize this pseudo-alias if it makes it down here...
780  $ns = NS_FILE;
781  } elseif ( $ns == NS_SPECIAL ) {
782  // We don't record Special: links currently
783  // It might actually be wise to, but we'd need to do some normalization.
784  return;
785  } elseif ( $dbk === '' ) {
786  // Don't record self links - [[#Foo]]
787  return;
788  }
789  if ( !isset( $this->mLinks[$ns] ) ) {
790  $this->mLinks[$ns] = [];
791  }
792  if ( $id === null ) {
793  $id = $title->getArticleID();
794  }
795  $this->mLinks[$ns][$dbk] = $id;
796  }
797 
804  public function addImage( $name, $timestamp = null, $sha1 = null ) {
805  $this->mImages[$name] = 1;
806  if ( $timestamp !== null && $sha1 !== null ) {
807  $this->mFileSearchOptions[$name] = [ 'time' => $timestamp, 'sha1' => $sha1 ];
808  }
809  }
810 
817  public function addTemplate( $title, $page_id, $rev_id ) {
818  $ns = $title->getNamespace();
819  $dbk = $title->getDBkey();
820  if ( !isset( $this->mTemplates[$ns] ) ) {
821  $this->mTemplates[$ns] = [];
822  }
823  $this->mTemplates[$ns][$dbk] = $page_id;
824  if ( !isset( $this->mTemplateIds[$ns] ) ) {
825  $this->mTemplateIds[$ns] = [];
826  }
827  $this->mTemplateIds[$ns][$dbk] = $rev_id; // For versioning
828  }
829 
834  public function addInterwikiLink( $title ) {
835  if ( !$title->isExternal() ) {
836  throw new MWException( 'Non-interwiki link passed, internal parser error.' );
837  }
838  $prefix = $title->getInterwiki();
839  if ( !isset( $this->mInterwikiLinks[$prefix] ) ) {
840  $this->mInterwikiLinks[$prefix] = [];
841  }
842  $this->mInterwikiLinks[$prefix][$title->getDBkey()] = 1;
843  }
844 
852  public function addHeadItem( $section, $tag = false ) {
853  if ( $tag !== false ) {
854  $this->mHeadItems[$tag] = $section;
855  } else {
856  $this->mHeadItems[] = $section;
857  }
858  }
859 
864  public function addModules( $modules ) {
865  $this->mModules = array_merge( $this->mModules, (array)$modules );
866  }
867 
872  public function addModuleStyles( $modules ) {
873  $this->mModuleStyles = array_merge( $this->mModuleStyles, (array)$modules );
874  }
875 
883  public function addJsConfigVars( $keys, $value = null ) {
884  if ( is_array( $keys ) ) {
885  foreach ( $keys as $key => $value ) {
886  $this->mJsConfigVars[$key] = $value;
887  }
888  return;
889  }
890 
891  $this->mJsConfigVars[$keys] = $value;
892  }
893 
899  public function addOutputPageMetadata( OutputPage $out ) {
900  $this->addModules( $out->getModules() );
901  $this->addModuleStyles( $out->getModuleStyles() );
902  $this->addJsConfigVars( $out->getJsConfigVars() );
903 
904  $this->mHeadItems = array_merge( $this->mHeadItems, $out->getHeadItemsArray() );
905  $this->mPreventClickjacking = $this->mPreventClickjacking || $out->getPreventClickjacking();
906  }
907 
924  public function addTrackingCategory( $msg, $title ) {
925  if ( $title->isSpecialPage() ) {
926  wfDebug( __METHOD__ . ": Not adding tracking category $msg to special page!\n" );
927  return false;
928  }
929 
930  // Important to parse with correct title (T33469)
931  $cat = wfMessage( $msg )
932  ->title( $title )
933  ->inContentLanguage()
934  ->text();
935 
936  # Allow tracking categories to be disabled by setting them to "-"
937  if ( $cat === '-' ) {
938  return false;
939  }
940 
941  $containerCategory = Title::makeTitleSafe( NS_CATEGORY, $cat );
942  if ( $containerCategory ) {
943  $this->addCategory( $containerCategory->getDBkey(), $this->getProperty( 'defaultsort' ) ?: '' );
944  return true;
945  } else {
946  wfDebug( __METHOD__ . ": [[MediaWiki:$msg]] is not a valid title!\n" );
947  return false;
948  }
949  }
950 
962  public function setDisplayTitle( $text ) {
963  $this->setTitleText( $text );
964  $this->setProperty( 'displaytitle', $text );
965  }
966 
975  public function getDisplayTitle() {
976  $t = $this->getTitleText();
977  if ( $t === '' ) {
978  return false;
979  }
980  return $t;
981  }
982 
988  public function setFlag( $flag ) {
989  $this->mFlags[$flag] = true;
990  }
991 
996  public function getFlag( $flag ) {
997  return isset( $this->mFlags[$flag] );
998  }
999 
1004  public function getAllFlags() {
1005  return array_keys( $this->mFlags );
1006  }
1007 
1068  public function setProperty( $name, $value ) {
1069  $this->mProperties[$name] = $value;
1070  }
1071 
1080  public function getProperty( $name ) {
1081  return $this->mProperties[$name] ?? false;
1082  }
1083 
1084  public function unsetProperty( $name ) {
1085  unset( $this->mProperties[$name] );
1086  }
1087 
1088  public function getProperties() {
1089  if ( !isset( $this->mProperties ) ) {
1090  $this->mProperties = [];
1091  }
1092  return $this->mProperties;
1093  }
1094 
1100  public function getUsedOptions() {
1101  if ( !isset( $this->mAccessedOptions ) ) {
1102  return [];
1103  }
1104  return array_keys( $this->mAccessedOptions );
1105  }
1106 
1119  public function recordOption( $option ) {
1120  $this->mAccessedOptions[$option] = true;
1121  }
1122 
1163  public function setExtensionData( $key, $value ) {
1164  if ( $value === null ) {
1165  unset( $this->mExtensionData[$key] );
1166  } else {
1167  $this->mExtensionData[$key] = $value;
1168  }
1169  }
1170 
1182  public function getExtensionData( $key ) {
1183  return $this->mExtensionData[$key] ?? null;
1184  }
1185 
1186  private static function getTimes( $clock = null ) {
1187  $ret = [];
1188  if ( !$clock || $clock === 'wall' ) {
1189  $ret['wall'] = microtime( true );
1190  }
1191  if ( !$clock || $clock === 'cpu' ) {
1192  $ru = getrusage( 0 /* RUSAGE_SELF */ );
1193  $ret['cpu'] = $ru['ru_utime.tv_sec'] + $ru['ru_utime.tv_usec'] / 1e6;
1194  $ret['cpu'] += $ru['ru_stime.tv_sec'] + $ru['ru_stime.tv_usec'] / 1e6;
1195  }
1196  return $ret;
1197  }
1198 
1203  public function resetParseStartTime() {
1204  $this->mParseStartTime = self::getTimes();
1205  }
1206 
1218  public function getTimeSinceStart( $clock ) {
1219  if ( !isset( $this->mParseStartTime[$clock] ) ) {
1220  return null;
1221  }
1222 
1223  $end = self::getTimes( $clock );
1224  return $end[$clock] - $this->mParseStartTime[$clock];
1225  }
1226 
1246  public function setLimitReportData( $key, $value ) {
1247  $this->mLimitReportData[$key] = $value;
1248 
1249  if ( is_array( $value ) ) {
1250  if ( array_keys( $value ) === [ 0, 1 ]
1251  && is_numeric( $value[0] )
1252  && is_numeric( $value[1] )
1253  ) {
1254  $data = [ 'value' => $value[0], 'limit' => $value[1] ];
1255  } else {
1256  $data = $value;
1257  }
1258  } else {
1259  $data = $value;
1260  }
1261 
1262  if ( strpos( $key, '-' ) ) {
1263  list( $ns, $name ) = explode( '-', $key, 2 );
1264  $this->mLimitReportJSData[$ns][$name] = $data;
1265  } else {
1266  $this->mLimitReportJSData[$key] = $data;
1267  }
1268  }
1269 
1280  public function hasDynamicContent() {
1281  global $wgParserCacheExpireTime;
1282 
1283  return $this->getCacheExpiry() < $wgParserCacheExpireTime;
1284  }
1285 
1293  public function preventClickjacking( $flag = null ) {
1294  return wfSetVar( $this->mPreventClickjacking, $flag );
1295  }
1296 
1303  public function updateRuntimeAdaptiveExpiry( $ttl ) {
1304  $this->mMaxAdaptiveExpiry = min( $ttl, $this->mMaxAdaptiveExpiry );
1305  $this->updateCacheExpiry( $ttl );
1306  }
1307 
1313  public function finalizeAdaptiveCacheExpiry() {
1314  if ( is_infinite( $this->mMaxAdaptiveExpiry ) ) {
1315  return; // not set
1316  }
1317 
1318  $runtime = $this->getTimeSinceStart( 'wall' );
1319  if ( is_float( $runtime ) ) {
1320  $slope = ( self::SLOW_AR_TTL - self::FAST_AR_TTL )
1321  / ( self::PARSE_SLOW_SEC - self::PARSE_FAST_SEC );
1322  // SLOW_AR_TTL = PARSE_SLOW_SEC * $slope + $point
1323  $point = self::SLOW_AR_TTL - self::PARSE_SLOW_SEC * $slope;
1324 
1325  $adaptiveTTL = min(
1326  max( $slope * $runtime + $point, self::MIN_AR_TTL ),
1327  $this->mMaxAdaptiveExpiry
1328  );
1329  $this->updateCacheExpiry( $adaptiveTTL );
1330  }
1331  }
1332 
1333  public function __sleep() {
1334  return array_filter( array_keys( get_object_vars( $this ) ),
1335  function ( $field ) {
1336  if ( $field === 'mParseStartTime' ) {
1337  return false;
1338  } elseif ( strpos( $field, "\0" ) !== false ) {
1339  // Unserializing unknown private fields in HHVM causes
1340  // member variables with nulls in their names (T229366)
1341  return false;
1342  } else {
1343  return true;
1344  }
1345  }
1346  );
1347  }
1348 
1357  $this->mOutputHooks = self::mergeList( $this->mOutputHooks, $source->getOutputHooks() );
1358  $this->mWarnings = self::mergeMap( $this->mWarnings, $source->mWarnings ); // don't use getter
1359  $this->mTimestamp = $this->useMaxValue( $this->mTimestamp, $source->getTimestamp() );
1360 
1361  foreach ( self::SPECULATIVE_FIELDS as $field ) {
1362  if ( $this->$field && $source->$field && $this->$field !== $source->$field ) {
1363  wfLogWarning( __METHOD__ . ": inconsistent '$field' properties!" );
1364  }
1365  $this->$field = $this->useMaxValue( $this->$field, $source->$field );
1366  }
1367 
1368  $this->mParseStartTime = $this->useEachMinValue(
1369  $this->mParseStartTime,
1370  $source->mParseStartTime
1371  );
1372 
1373  $this->mFlags = self::mergeMap( $this->mFlags, $source->mFlags );
1374  $this->mAccessedOptions = self::mergeMap( $this->mAccessedOptions, $source->mAccessedOptions );
1375 
1376  // TODO: maintain per-slot limit reports!
1377  if ( empty( $this->mLimitReportData ) ) {
1378  $this->mLimitReportData = $source->mLimitReportData;
1379  }
1380  if ( empty( $this->mLimitReportJSData ) ) {
1381  $this->mLimitReportJSData = $source->mLimitReportJSData;
1382  }
1383  }
1384 
1393  // HTML and HTTP
1394  $this->mHeadItems = self::mergeMixedList( $this->mHeadItems, $source->getHeadItems() );
1395  $this->mModules = self::mergeList( $this->mModules, $source->getModules() );
1396  $this->mModuleStyles = self::mergeList( $this->mModuleStyles, $source->getModuleStyles() );
1397  $this->mJsConfigVars = self::mergeMap( $this->mJsConfigVars, $source->getJsConfigVars() );
1398  $this->mMaxAdaptiveExpiry = min( $this->mMaxAdaptiveExpiry, $source->mMaxAdaptiveExpiry );
1399 
1400  // "noindex" always wins!
1401  if ( $this->mIndexPolicy === 'noindex' || $source->mIndexPolicy === 'noindex' ) {
1402  $this->mIndexPolicy = 'noindex';
1403  } elseif ( $this->mIndexPolicy !== 'index' ) {
1404  $this->mIndexPolicy = $source->mIndexPolicy;
1405  }
1406 
1407  // Skin control
1408  $this->mNewSection = $this->mNewSection || $source->getNewSection();
1409  $this->mHideNewSection = $this->mHideNewSection || $source->getHideNewSection();
1410  $this->mNoGallery = $this->mNoGallery || $source->getNoGallery();
1411  $this->mEnableOOUI = $this->mEnableOOUI || $source->getEnableOOUI();
1412  $this->mPreventClickjacking = $this->mPreventClickjacking || $source->preventClickjacking();
1413 
1414  // TODO: we'll have to be smarter about this!
1415  $this->mSections = array_merge( $this->mSections, $source->getSections() );
1416  $this->mTOCHTML .= $source->mTOCHTML;
1417 
1418  // XXX: we don't want to concatenate title text, so first write wins.
1419  // We should use the first *modified* title text, but we don't have the original to check.
1420  if ( $this->mTitleText === null || $this->mTitleText === '' ) {
1421  $this->mTitleText = $source->mTitleText;
1422  }
1423 
1424  // class names are stored in array keys
1425  $this->mWrapperDivClasses = self::mergeMap(
1426  $this->mWrapperDivClasses,
1427  $source->mWrapperDivClasses
1428  );
1429 
1430  // NOTE: last write wins, same as within one ParserOutput
1431  $this->mIndicators = self::mergeMap( $this->mIndicators, $source->getIndicators() );
1432 
1433  // NOTE: include extension data in "tracking meta data" as well as "html meta data"!
1434  // TODO: add a $mergeStrategy parameter to setExtensionData to allow different
1435  // kinds of extension data to be merged in different ways.
1436  $this->mExtensionData = self::mergeMap(
1437  $this->mExtensionData,
1438  $source->mExtensionData
1439  );
1440  }
1441 
1450  $this->mLanguageLinks = self::mergeList( $this->mLanguageLinks, $source->getLanguageLinks() );
1451  $this->mCategories = self::mergeMap( $this->mCategories, $source->getCategories() );
1452  $this->mLinks = self::merge2D( $this->mLinks, $source->getLinks() );
1453  $this->mTemplates = self::merge2D( $this->mTemplates, $source->getTemplates() );
1454  $this->mTemplateIds = self::merge2D( $this->mTemplateIds, $source->getTemplateIds() );
1455  $this->mImages = self::mergeMap( $this->mImages, $source->getImages() );
1456  $this->mFileSearchOptions = self::mergeMap(
1457  $this->mFileSearchOptions,
1458  $source->getFileSearchOptions()
1459  );
1460  $this->mExternalLinks = self::mergeMap( $this->mExternalLinks, $source->getExternalLinks() );
1461  $this->mInterwikiLinks = self::merge2D(
1462  $this->mInterwikiLinks,
1463  $source->getInterwikiLinks()
1464  );
1465 
1466  // TODO: add a $mergeStrategy parameter to setProperty to allow different
1467  // kinds of properties to be merged in different ways.
1468  $this->mProperties = self::mergeMap( $this->mProperties, $source->getProperties() );
1469 
1470  // NOTE: include extension data in "tracking meta data" as well as "html meta data"!
1471  // TODO: add a $mergeStrategy parameter to setExtensionData to allow different
1472  // kinds of extension data to be merged in different ways.
1473  $this->mExtensionData = self::mergeMap(
1474  $this->mExtensionData,
1475  $source->mExtensionData
1476  );
1477  }
1478 
1479  private static function mergeMixedList( array $a, array $b ) {
1480  return array_unique( array_merge( $a, $b ), SORT_REGULAR );
1481  }
1482 
1483  private static function mergeList( array $a, array $b ) {
1484  return array_values( array_unique( array_merge( $a, $b ), SORT_REGULAR ) );
1485  }
1486 
1487  private static function mergeMap( array $a, array $b ) {
1488  return array_replace( $a, $b );
1489  }
1490 
1491  private static function merge2D( array $a, array $b ) {
1492  $values = [];
1493  $keys = array_merge( array_keys( $a ), array_keys( $b ) );
1494 
1495  foreach ( $keys as $k ) {
1496  if ( empty( $a[$k] ) ) {
1497  $values[$k] = $b[$k];
1498  } elseif ( empty( $b[$k] ) ) {
1499  $values[$k] = $a[$k];
1500  } elseif ( is_array( $a[$k] ) && is_array( $b[$k] ) ) {
1501  $values[$k] = array_replace( $a[$k], $b[$k] );
1502  } else {
1503  $values[$k] = $b[$k];
1504  }
1505  }
1506 
1507  return $values;
1508  }
1509 
1510  private static function useEachMinValue( array $a, array $b ) {
1511  $values = [];
1512  $keys = array_merge( array_keys( $a ), array_keys( $b ) );
1513 
1514  foreach ( $keys as $k ) {
1515  if ( is_array( $a[$k] ?? null ) && is_array( $b[$k] ?? null ) ) {
1516  $values[$k] = self::useEachMinValue( $a[$k], $b[$k] );
1517  } else {
1518  $values[$k] = self::useMinValue( $a[$k] ?? null, $b[$k] ?? null );
1519  }
1520  }
1521 
1522  return $values;
1523  }
1524 
1525  private static function useMinValue( $a, $b ) {
1526  if ( $a === null ) {
1527  return $b;
1528  }
1529 
1530  if ( $b === null ) {
1531  return $a;
1532  }
1533 
1534  return min( $a, $b );
1535  }
1536 
1537  private static function useMaxValue( $a, $b ) {
1538  if ( $a === null ) {
1539  return $b;
1540  }
1541 
1542  if ( $b === null ) {
1543  return $a;
1544  }
1545 
1546  return max( $a, $b );
1547  }
1548 
1549 }
ParserOutput\$mWrapperDivClasses
$mWrapperDivClasses
string CSS classes to use for the wrapping div, stored in the array keys.
Definition: ParserOutput.php:234
ParserOutput\addOutputPageMetadata
addOutputPageMetadata(OutputPage $out)
Copy items from the OutputPage object into this one.
Definition: ParserOutput.php:899
ParserOutput\getEnableOOUI
getEnableOOUI()
Definition: ParserOutput.php:641
ParserOutput\mergeMap
static mergeMap(array $a, array $b)
Definition: ParserOutput.php:1487
CacheTime\getCacheExpiry
getCacheExpiry()
Returns the number of seconds after which this object should expire.
Definition: CacheTime.php:129
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:335
ParserOutput\$mProperties
$mProperties
Definition: ParserOutput.php:159
ParserOutput\setTitleText
setTitleText( $t)
Definition: ParserOutput.php:657
ParserOutput
Definition: ParserOutput.php:25
ParserOutput\setSpeculativeRevIdUsed
setSpeculativeRevIdUsed( $id)
Definition: ParserOutput.php:455
ParserOutput\$mInterwikiLinks
$mInterwikiLinks
Definition: ParserOutput.php:103
ParserOutput\SUPPORTS_UNWRAP_TRANSFORM
const SUPPORTS_UNWRAP_TRANSFORM
Definition: ParserOutput.php:37
CacheTime
Parser cache specific expiry check.
Definition: CacheTime.php:29
ParserOutput\resetParseStartTime
resetParseStartTime()
Resets the parse start timestamps for future calls to getTimeSinceStart()
Definition: ParserOutput.php:1203
ParserOutput\setDisplayTitle
setDisplayTitle( $text)
Override the title to be used for display.
Definition: ParserOutput.php:962
ParserOutput\setTimestamp
setTimestamp( $timestamp)
Definition: ParserOutput.php:673
ParserOutput\getUsedOptions
getUsedOptions()
Returns the options from its ParserOptions which have been taken into account to produce this output.
Definition: ParserOutput.php:1100
ParserOutput\mergeMixedList
static mergeMixedList(array $a, array $b)
Definition: ParserOutput.php:1479
ParserOutput\$mIndexPolicy
$mIndexPolicy
Definition: ParserOutput.php:179
ParserOutput\setLimitReportData
setLimitReportData( $key, $value)
Sets parser limit report data for a key.
Definition: ParserOutput.php:1246
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:1608
ParserOutput\merge2D
static merge2D(array $a, array $b)
Definition: ParserOutput.php:1491
ParserOutput\addWrapperDivClass
addWrapperDivClass( $class)
Add a CSS class to use for the wrapping div.
Definition: ParserOutput.php:428
ParserOutput\$mLimitReportJSData
array $mLimitReportJSData
Parser limit report data for JSON.
Definition: ParserOutput.php:197
ParserOutput\__sleep
__sleep()
Definition: ParserOutput.php:1333
ParserOutput\setNewSection
setNewSection( $value)
Definition: ParserOutput.php:713
ParserOutput\getModules
getModules()
Definition: ParserOutput.php:594
ParserOutput\getImages
& getImages()
Definition: ParserOutput.php:570
ParserOutput\addModules
addModules( $modules)
Definition: ParserOutput.php:864
ParserOutput\MIN_AR_TTL
const MIN_AR_TTL
Definition: ParserOutput.php:249
ParserOutput\setIndicator
setIndicator( $id, $content)
Definition: ParserOutput.php:686
ParserOutput\addTemplate
addTemplate( $title, $page_id, $rev_id)
Register a template dependency for this output.
Definition: ParserOutput.php:817
ParserOutput\getJsConfigVars
getJsConfigVars()
Definition: ParserOutput.php:606
wfUrlencode
wfUrlencode( $s)
We want some things to be included as literal characters in our title URLs for prettiness,...
Definition: GlobalFunctions.php:309
ParserOutput\mergeTrackingMetaDataFrom
mergeTrackingMetaDataFrom(ParserOutput $source)
Merges dependency tracking metadata such as backlinks, images used, and extension data from $source i...
Definition: ParserOutput.php:1449
NS_FILE
const NS_FILE
Definition: Defines.php:75
ParserOutput\unsetProperty
unsetProperty( $name)
Definition: ParserOutput.php:1084
ParserOutput\$mImages
$mImages
Definition: ParserOutput.php:87
ParserOutput\setFlag
setFlag( $flag)
Attach a flag to the output so that it can be checked later to handle special cases.
Definition: ParserOutput.php:988
ParserOutput\hideNewSection
hideNewSection( $value)
Definition: ParserOutput.php:717
ParserOutput\$mOutputHooks
$mOutputHooks
Definition: ParserOutput.php:143
ParserOutput\addLink
addLink(Title $title, $id=null)
Record a local or interwiki inline link for saving in future link tables.
Definition: ParserOutput.php:770
wfMessage
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
Definition: GlobalFunctions.php:1265
ParserOutput\$mMaxAdaptiveExpiry
int $mMaxAdaptiveExpiry
Upper bound of expiry based on parse duration.
Definition: ParserOutput.php:237
$s
$s
Definition: mergeMessageFileList.php:185
ParserOutput\__construct
__construct( $text='', $languageLinks=[], $categoryLinks=[], $unused=false, $titletext='')
Definition: ParserOutput.php:260
wfLogWarning
wfLogWarning( $msg, $callerOffset=1, $level=E_USER_WARNING)
Send a warning as a PHP error and the debug log.
Definition: GlobalFunctions.php:1079
ParserOutput\EDITSECTION_REGEX
const EDITSECTION_REGEX
Definition: ParserOutput.php:239
ParserOutput\$mFileSearchOptions
$mFileSearchOptions
Definition: ParserOutput.php:92
ParserOutput\PARSE_SLOW_SEC
const PARSE_SLOW_SEC
Definition: ParserOutput.php:246
ParserOutput\getHeadItems
getHeadItems()
Definition: ParserOutput.php:590
ParserOutput\PARSE_FAST_SEC
const PARSE_FAST_SEC
Definition: ParserOutput.php:245
ParserOutput\setSpeculativePageIdUsed
setSpeculativePageIdUsed( $id)
Definition: ParserOutput.php:471
ParserOutput\getProperties
getProperties()
Definition: ParserOutput.php:1088
ParserOutput\mergeList
static mergeList(array $a, array $b)
Definition: ParserOutput.php:1483
ParserOutput\getModuleStyles
getModuleStyles()
Definition: ParserOutput.php:598
ParserOutput\$mNoGallery
$mNoGallery
Definition: ParserOutput.php:118
NS_SPECIAL
const NS_SPECIAL
Definition: Defines.php:58
ParserOutput\getLimitReportJSData
getLimitReportJSData()
Definition: ParserOutput.php:637
MWException
MediaWiki exception.
Definition: MWException.php:26
ParserOutput\getCategoryLinks
getCategoryLinks()
Definition: ParserOutput.php:534
ParserOutput\$mLimitReportData
$mLimitReportData
Definition: ParserOutput.php:194
ParserOutput\setRevisionUsedSha1Base36
setRevisionUsedSha1Base36( $hash)
Definition: ParserOutput.php:503
ParserOutput\getFlag
getFlag( $flag)
Definition: ParserOutput.php:996
ParserOutput\getTimestamp
getTimestamp()
Definition: ParserOutput.php:629
ParserOutput\isLinkInternal
static isLinkInternal( $internal, $url)
Checks, if a url is pointing to the own server.
Definition: ParserOutput.php:736
ParserOutput\addExternalLink
addExternalLink( $url)
Definition: ParserOutput.php:747
ParserOutput\getInterwikiLinks
getInterwikiLinks()
Definition: ParserOutput.php:530
ParserOutput\mergeHtmlMetaDataFrom
mergeHtmlMetaDataFrom(ParserOutput $source)
Merges HTML metadata such as head items, JS config vars, and HTTP cache control info from $source int...
Definition: ParserOutput.php:1392
ParserOutput\updateRuntimeAdaptiveExpiry
updateRuntimeAdaptiveExpiry( $ttl)
Lower the runtime adaptive TTL to at most this value.
Definition: ParserOutput.php:1303
$modules
$modules
Definition: HTMLFormElement.php:13
ParserOutput\addImage
addImage( $name, $timestamp=null, $sha1=null)
Register a file dependency for this output.
Definition: ParserOutput.php:804
ParserOutput\$mExternalLinks
$mExternalLinks
Definition: ParserOutput.php:97
$wgParserCacheExpireTime
$wgParserCacheExpireTime
The expiry time for the parser cache, in seconds.
Definition: DefaultSettings.php:2548
ParserOutput\getTimes
static getTimes( $clock=null)
Definition: ParserOutput.php:1186
ParserOutput\addCategory
addCategory( $c, $sort)
Definition: ParserOutput.php:677
ParserOutput\useMaxValue
static useMaxValue( $a, $b)
Definition: ParserOutput.php:1537
$title
$title
Definition: testCompression.php:36
ParserOutput\SUPPORTS_STATELESS_TRANSFORMS
const SUPPORTS_STATELESS_TRANSFORMS
Feature flags to indicate to extensions that MediaWiki core supports and uses getText() stateless tra...
Definition: ParserOutput.php:32
ParserOutput\$mPreventClickjacking
$mPreventClickjacking
Definition: ParserOutput.php:207
ParserOutput\addModuleStyles
addModuleStyles( $modules)
Definition: ParserOutput.php:872
ParserOutput\$mAccessedOptions
$mAccessedOptions
Definition: ParserOutput.php:184
ParserOutput\mergeInternalMetaDataFrom
mergeInternalMetaDataFrom(ParserOutput $source)
Merges internal metadata such as flags, accessed options, and profiling info from $source into this P...
Definition: ParserOutput.php:1356
ParserOutput\setText
setText( $text)
Definition: ParserOutput.php:645
NS_CATEGORY
const NS_CATEGORY
Definition: Defines.php:83
ParserOutput\getDisplayTitle
getDisplayTitle()
Get the title to be used for display.
Definition: ParserOutput.php:975
ParserOutput\getIndicators
getIndicators()
Definition: ParserOutput.php:546
ParserOutput\setLanguageLinks
setLanguageLinks( $ll)
Definition: ParserOutput.php:649
ParserOutput\getSpeculativePageIdUsed
getSpeculativePageIdUsed()
Definition: ParserOutput.php:479
ParserOutput\$mExtensionData
$mExtensionData
Definition: ParserOutput.php:189
wfDebug
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
Definition: GlobalFunctions.php:913
ParserOutput\getLanguageLinks
& getLanguageLinks()
Definition: ParserOutput.php:526
ParserOutput\$mHideNewSection
$mHideNewSection
Definition: ParserOutput.php:113
ParserOutput\$mLanguageLinks
$mLanguageLinks
Definition: ParserOutput.php:48
ParserOutput\getExternalLinks
& getExternalLinks()
Definition: ParserOutput.php:578
ParserOutput\getTemplateIds
& getTemplateIds()
Definition: ParserOutput.php:566
ParserOutput\getTOCHTML
getTOCHTML()
Definition: ParserOutput.php:622
ParserOutput\recordOption
recordOption( $option)
Tags a parser option for use in the cache key for this parser output.
Definition: ParserOutput.php:1119
ParserOutput\addOutputHook
addOutputHook( $hook, $data=false)
Definition: ParserOutput.php:709
ParserOutput\SLOW_AR_TTL
const SLOW_AR_TTL
Definition: ParserOutput.php:248
ParserOutput\getTitleText
getTitleText()
Definition: ParserOutput.php:550
ParserOutput\$mWarnings
$mWarnings
Definition: ParserOutput.php:149
ParserOutput\clearWrapperDivClass
clearWrapperDivClass()
Clears the CSS class to use for the wrapping div, effectively disabling the wrapper div until addWrap...
Definition: ParserOutput.php:436
Title\makeTitleSafe
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:628
ParserOutput\setProperty
setProperty( $name, $value)
Set a property to be stored in the page_props database table.
Definition: ParserOutput.php:1068
ParserOutput\getNewSection
getNewSection()
Definition: ParserOutput.php:725
Hooks\runWithoutAbort
static runWithoutAbort( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
Definition: Hooks.php:231
$content
$content
Definition: router.php:78
ParserOutput\setExtensionData
setExtensionData( $key, $value)
Attaches arbitrary data to this ParserObject.
Definition: ParserOutput.php:1163
NS_MEDIA
const NS_MEDIA
Definition: Defines.php:57
ParserOutput\$mSections
$mSections
Definition: ParserOutput.php:154
ParserOutput\getOutputHooks
getOutputHooks()
Definition: ParserOutput.php:610
ParserOutput\$mLinks
$mLinks
Definition: ParserOutput.php:70
ParserOutput\$speculativePageIdUsed
int null $speculativePageIdUsed
Assumed page ID for {{PAGEID}} if no revision is set.
Definition: ParserOutput.php:224
ParserOutput\getHideNewSection
getHideNewSection()
Definition: ParserOutput.php:721
$wgServer
$wgServer
URL of the server.
Definition: DefaultSettings.php:106
ParserOutput\$mFlags
$mFlags
Definition: ParserOutput.php:212
ParserOutput\$mParseStartTime
$mParseStartTime
Definition: ParserOutput.php:202
ParserOutput\$mTitleText
$mTitleText
Definition: ParserOutput.php:63
ParserOutput\$revisionUsedSha1Base36
string null $revisionUsedSha1Base36
SHA-1 base 36 hash of any self-transclusion.
Definition: ParserOutput.php:229
ParserOutput\$mEnableOOUI
$mEnableOOUI
Definition: ParserOutput.php:174
ParserOutput\getRevisionUsedSha1Base36
getRevisionUsedSha1Base36()
Definition: ParserOutput.php:522
ParserOutput\$mJsConfigVars
$mJsConfigVars
Definition: ParserOutput.php:138
ParserOutput\getNoGallery
getNoGallery()
Definition: ParserOutput.php:586
ParserOutput\addWarning
addWarning( $s)
Definition: ParserOutput.php:705
RequestContext\getMain
static getMain()
Get the RequestContext object associated with the main request.
Definition: RequestContext.php:451
ParserOutput\getTemplates
& getTemplates()
Definition: ParserOutput.php:562
ParserOutput\setSections
setSections( $toc)
Definition: ParserOutput.php:661
ParserOutput\setCategoryLinks
setCategoryLinks( $cl)
Definition: ParserOutput.php:653
ParserOutput\$mText
$mText
Definition: ParserOutput.php:42
ParserOutput\getRevisionTimestampUsed
getRevisionTimestampUsed()
Definition: ParserOutput.php:495
ParserOutput\getFileSearchOptions
& getFileSearchOptions()
Definition: ParserOutput.php:574
Title
Represents a title within MediaWiki.
Definition: Title.php:42
ParserOutput\getProperty
getProperty( $name)
Definition: ParserOutput.php:1080
ParserOutput\$mModuleStyles
$mModuleStyles
Definition: ParserOutput.php:133
ParserOutput\$mTOCHTML
$mTOCHTML
Definition: ParserOutput.php:164
ParserOutput\$mModules
$mModules
Definition: ParserOutput.php:128
ParserOutput\FAST_AR_TTL
const FAST_AR_TTL
Definition: ParserOutput.php:247
ParserOutput\$mCategories
$mCategories
Definition: ParserOutput.php:53
ParserOutput\addJsConfigVars
addJsConfigVars( $keys, $value=null)
Add one or more variables to be set in mw.config in JavaScript.
Definition: ParserOutput.php:883
ParserOutput\getCategories
& getCategories()
Definition: ParserOutput.php:538
ParserOutput\hasText
hasText()
Returns true if text was passed to the constructor, or set using setText().
Definition: ParserOutput.php:279
ParserOutput\getRawText
getRawText()
Get the cacheable text with <mw:editsection> markers still in it.
Definition: ParserOutput.php:291
ParserOutput\useMinValue
static useMinValue( $a, $b)
Definition: ParserOutput.php:1525
$keys
$keys
Definition: testCompression.php:69
ParserOutput\getLimitReportData
getLimitReportData()
Definition: ParserOutput.php:633
CacheTime\updateCacheExpiry
updateCacheExpiry( $seconds)
Sets the number of seconds after which this object should expire.
Definition: CacheTime.php:112
ParserOutput\addTrackingCategory
addTrackingCategory( $msg, $title)
Add a tracking category, getting the title from a system message, or print a debug message if the tit...
Definition: ParserOutput.php:924
$source
$source
Definition: mwdoc-filter.php:34
ParserOutput\useEachMinValue
static useEachMinValue(array $a, array $b)
Definition: ParserOutput.php:1510
ParserOutput\$mTemplates
$mTemplates
Definition: ParserOutput.php:76
ParserOutput\getExtensionData
getExtensionData( $key)
Gets extensions data previously attached to this ParserOutput using setExtensionData().
Definition: ParserOutput.php:1182
ParserOutput\addLanguageLink
addLanguageLink( $t)
Definition: ParserOutput.php:701
ParserOutput\getText
getText( $options=[])
Get the output HTML.
Definition: ParserOutput.php:325
ParserOutput\setRevisionTimestampUsed
setRevisionTimestampUsed( $timestamp)
Definition: ParserOutput.php:487
$t
$t
Definition: testCompression.php:71
ParserOutput\$mHeadItems
$mHeadItems
Definition: ParserOutput.php:123
ParserOutput\$mTemplateIds
$mTemplateIds
Definition: ParserOutput.php:82
ParserOutput\$revisionTimestampUsed
int null $revisionTimestampUsed
Assumed rev timestamp for {{REVISIONTIMESTAMP}} if no revision is set.
Definition: ParserOutput.php:226
ParserOutput\addInterwikiLink
addInterwikiLink( $title)
Definition: ParserOutput.php:834
ParserOutput\setTOCHTML
setTOCHTML( $tochtml)
Definition: ParserOutput.php:669
ParserOutput\$mNewSection
$mNewSection
Definition: ParserOutput.php:108
$wgRegisterInternalExternals
$wgRegisterInternalExternals
By default MediaWiki does not register links pointing to same server in externallinks dataset,...
Definition: DefaultSettings.php:8512
ParserOutput\getSections
getSections()
Definition: ParserOutput.php:554
ParserOutput\$mSpeculativeRevId
int null $mSpeculativeRevId
Assumed rev ID for {{REVISIONID}} if no revision is set.
Definition: ParserOutput.php:214
ParserOutput\hasDynamicContent
hasDynamicContent()
Check whether the cache TTL was lowered due to dynamic content.
Definition: ParserOutput.php:1280
ParserOutput\addHeadItem
addHeadItem( $section, $tag=false)
Add some text to the "<head>".
Definition: ParserOutput.php:852
ParserOutput\setEnableOOUI
setEnableOOUI( $enable=false)
Enables OOUI, if true, in any OutputPage instance this ParserOutput object is added to.
Definition: ParserOutput.php:697
ParserOutput\$mIndicators
$mIndicators
Definition: ParserOutput.php:58
ParserOutput\finalizeAdaptiveCacheExpiry
finalizeAdaptiveCacheExpiry()
Call this when parsing is done to lower the TTL based on low parse times.
Definition: ParserOutput.php:1313
ParserOutput\getSpeculativeRevIdUsed
getSpeculativeRevIdUsed()
Definition: ParserOutput.php:463
ParserOutput\$mTimestamp
$mTimestamp
Definition: ParserOutput.php:169
ParserOutput\getLinks
& getLinks()
Definition: ParserOutput.php:558
ParserOutput\setIndexPolicy
setIndexPolicy( $policy)
Definition: ParserOutput.php:665
ParserOutput\setNoGallery
setNoGallery( $value)
Definition: ParserOutput.php:582
ParserOutput\getAllFlags
getAllFlags()
Definition: ParserOutput.php:1004
ParserOutput\getIndexPolicy
getIndexPolicy()
Definition: ParserOutput.php:618
ParserOutput\getTimeSinceStart
getTimeSinceStart( $clock)
Returns the time since resetParseStartTime() was last called.
Definition: ParserOutput.php:1218
ParserOutput\getWrapperDivClass
getWrapperDivClass()
Returns the class (or classes) to be used with the wrapper div for this otuput.
Definition: ParserOutput.php:447
ParserOutput\preventClickjacking
preventClickjacking( $flag=null)
Get or set the prevent-clickjacking flag.
Definition: ParserOutput.php:1293
ParserOutput\getWarnings
getWarnings()
Definition: ParserOutput.php:614