28use MediaWiki\HookContainer\ProtectedHookAccessorTrait;
60use Wikimedia\NonSerializable\NonSerializableTrait;
73 use ProtectedHookAccessorTrait;
74 use NonSerializableTrait;
102 private $fetchResult =
null;
116 protected $viewIsRenderAction =
false;
137 private $mRevisionRecord =
null;
144 $this->mOldId = $oldId;
145 $this->mPage = $this->
newPage( $title );
147 $services = MediaWikiServices::getInstance();
148 $this->linkRenderer = $services->getLinkRenderer();
149 $this->revisionStore = $services->getRevisionStore();
150 $this->userNameUtils = $services->getUserNameUtils();
151 $this->userOptionsLookup = $services->getUserOptionsLookup();
152 $this->commentFormatter = $services->getCommentFormatter();
153 $this->wikiPageFactory = $services->getWikiPageFactory();
154 $this->jobQueueGroup = $services->getJobQueueGroup();
155 $this->archivedRevisionLookup = $services->getArchivedRevisionLookup();
156 $this->dbProvider = $services->getConnectionProvider();
157 $this->blockStore = $services->getDatabaseBlockStore();
158 $this->restrictionStore = $services->getRestrictionStore();
175 $t = Title::newFromID( $id );
176 return $t ===
null ? null :
new static( $t );
189 $title = Title::makeTitle(
NS_FILE, $title->getDBkey() );
193 (
new HookRunner( MediaWikiServices::getInstance()->getHookContainer() ) )
195 ->onArticleFromTitle( $title, $page, $context );
197 switch ( $title->getNamespace() ) {
208 $page->setContext( $context );
221 $article = self::newFromTitle( $page->
getTitle(), $context );
222 $article->mPage = $page;
232 return $this->mRedirectedFrom;
241 $this->mRedirectedFrom = $from;
250 return $this->mPage->getTitle();
264 $this->mRedirectedFrom =
null; #
Title object if set
265 $this->mRedirectUrl =
false;
266 $this->mRevisionRecord =
null;
267 $this->fetchResult =
null;
271 $this->mPage->clear();
282 if ( $this->mOldId ===
null ) {
283 $this->mOldId = $this->getOldIDFromRequest();
286 return $this->mOldId;
295 $this->mRedirectUrl =
false;
297 $request = $this->getContext()->getRequest();
298 $oldid = $request->getIntOrNull(
'oldid' );
300 if ( $oldid ===
null ) {
304 if ( $oldid !== 0 ) {
305 # Load the given revision and check whether the page is another one.
306 # In that case, update this instance to reflect the change.
307 if ( $oldid === $this->mPage->getLatest() ) {
308 $this->mRevisionRecord = $this->mPage->getRevisionRecord();
310 $this->mRevisionRecord = $this->revisionStore->getRevisionById( $oldid );
311 if ( $this->mRevisionRecord !==
null ) {
312 $revPageId = $this->mRevisionRecord->getPageId();
314 if ( $this->mPage->getId() !== $revPageId ) {
315 $this->mPage = $this->wikiPageFactory->newFromID( $revPageId );
321 $oldRev = $this->mRevisionRecord;
322 if ( $request->getRawVal(
'direction' ) ===
'next' ) {
325 $nextRev = $this->revisionStore->getNextRevision( $oldRev );
327 $nextid = $nextRev->getId();
332 $this->mRevisionRecord =
null;
334 $this->mRedirectUrl = $this->
getTitle()->getFullURL(
'redirect=no' );
336 } elseif ( $request->getRawVal(
'direction' ) ===
'prev' ) {
339 $prevRev = $this->revisionStore->getPreviousRevision( $oldRev );
341 $previd = $prevRev->getId();
346 $this->mRevisionRecord =
null;
363 if ( $this->fetchResult ) {
364 return $this->mRevisionRecord;
367 $oldid = $this->getOldID();
370 if ( !$this->mRevisionRecord ) {
372 $this->mRevisionRecord = $this->mPage->getRevisionRecord();
374 if ( !$this->mRevisionRecord ) {
375 wfDebug( __METHOD__ .
" failed to find page data for title " .
376 $this->
getTitle()->getPrefixedText() );
379 $this->fetchResult = Status::newFatal(
'noarticletext' );
383 $this->mRevisionRecord = $this->revisionStore->getRevisionById( $oldid );
385 if ( !$this->mRevisionRecord ) {
386 wfDebug( __METHOD__ .
" failed to load revision, rev_id $oldid" );
388 $this->fetchResult = Status::newFatal( $this->getMissingRevisionMsg( $oldid ) );
394 if ( !$this->mRevisionRecord->userCan( RevisionRecord::DELETED_TEXT, $this->getContext()->getAuthority() ) ) {
395 wfDebug( __METHOD__ .
" failed to retrieve content of revision " . $this->mRevisionRecord->getId() );
399 $this->fetchResult =
new Status;
400 $title = $this->
getTitle()->getPrefixedDBkey();
402 if ( $this->mRevisionRecord->isDeleted( RevisionRecord::DELETED_RESTRICTED ) ) {
403 $this->fetchResult->
fatal(
'rev-suppressed-text' );
405 $this->fetchResult->fatal(
'rev-deleted-text-permission', $title );
411 $this->fetchResult = Status::newGood( $this->mRevisionRecord );
412 return $this->mRevisionRecord;
421 # If no oldid, this is the current version.
422 if ( $this->getOldID() == 0 ) {
426 return $this->mPage->exists() &&
427 $this->mRevisionRecord &&
428 $this->mRevisionRecord->isCurrent();
440 if ( $this->fetchResult && $this->fetchResult->isOK() ) {
442 $rev = $this->fetchResult->getValue();
443 return $rev->
getId();
445 return $this->mPage->getLatest();
454 $context = $this->getContext();
455 $useFileCache = $context->getConfig()->get( MainConfigNames::UseFileCache );
457 # Get variables from query string
458 # As side effect this will load the revision and update the title
459 # in a revision ID is passed in the request, so this should remain
460 # the first call of this method even if $oldid is used way below.
461 $oldid = $this->getOldID();
463 $authority = $context->getAuthority();
464 # Another check in case getOldID() is altering the title
465 $permissionStatus = PermissionStatus::newEmpty();
467 ->authorizeRead(
'read', $this->
getTitle(), $permissionStatus )
469 wfDebug( __METHOD__ .
": denied on secondary read check" );
474 # getOldID() may as well want us to redirect somewhere else
475 if ( $this->mRedirectUrl ) {
476 $outputPage->
redirect( $this->mRedirectUrl );
477 wfDebug( __METHOD__ .
": redirecting due to oldid" );
482 # If we got diff in the query, we want to see a diff page instead of the article.
483 if ( $context->getRequest()->getCheck(
'diff' ) ) {
484 wfDebug( __METHOD__ .
": showing diff page" );
485 $this->showDiffPage();
490 $this->showProtectionIndicator();
492 # Set page title (may be overridden from ParserOutput if title conversion is enabled or DISPLAYTITLE is used)
494 str_replace(
'_',
' ', $this->
getTitle()->getNsText() ),
500 # Allow frames by default
501 $outputPage->
getMetadata()->setPreventClickjacking(
false );
503 $parserOptions = $this->getParserOptions();
506 # Allow extensions to vary parser options used for article rendering
507 (
new HookRunner( MediaWikiServices::getInstance()->getHookContainer() ) )
508 ->onArticleParserOptions( $this, $parserOptions );
509 # Render printable version, use printable version cache
512 $poOptions[
'enableSectionEditLinks'] =
false;
515 $outputPage->
msg(
'printableversion-deprecated-warning' )->escaped()
518 } elseif ( $this->viewIsRenderAction || !$this->isCurrent() ||
519 !$authority->probablyCan(
'edit', $this->getTitle() )
521 $poOptions[
'enableSectionEditLinks'] =
false;
524 # Try client and file cache
525 if ( $oldid === 0 && $this->mPage->checkTouched() ) {
526 # Try to stream the output from file cache
527 if ( $useFileCache && $this->tryFileCache() ) {
528 wfDebug( __METHOD__ .
": done file cache" );
529 # tell wgOut that output is taken care of
531 $this->mPage->doViewUpdates( $authority, $oldid );
537 $this->showRedirectedFromHeader();
538 $this->showNamespaceHeader();
540 if ( $this->viewIsRenderAction ) {
541 $poOptions += [
'absoluteURLs' => true ];
543 $poOptions += [
'includeDebugInfo' => true ];
547 $this->generateContentOutput( $authority, $parserOptions, $oldid, $outputPage, $poOptions );
550 $this->showViewError(
wfMessage(
'badrevision' )->text() );
557 # For the main page, overwrite the <title> element with the con-
558 # tents of 'pagetitle-view-mainpage' instead of the default (if
560 # This message always exists because it is in the i18n files
561 if ( $this->
getTitle()->isMainPage() ) {
562 $msg = $context->msg(
'pagetitle-view-mainpage' )->inContentLanguage();
563 if ( !$msg->isDisabled() ) {
568 # Use adaptive TTLs for CDN so delayed/failed purges are noticed less often.
569 # This could use getTouched(), but that could be scary for major template edits.
570 $outputPage->
adaptCdnTTL( $this->mPage->getTimestamp(), ExpirationAwareness::TTL_DAY );
572 $this->showViewFooter();
573 $this->mPage->doViewUpdates( $authority, $oldid, $this->fetchRevisionRecord() );
575 # Load the postEdit module if the user just saved this revision
576 # See also EditPage::setPostEditCookie
577 $request = $context->getRequest();
578 $cookieKey = EditPage::POST_EDIT_COOKIE_KEY_PREFIX . $this->getRevIdFetched();
579 $postEdit = $request->getCookie( $cookieKey );
581 # Clear the cookie. This also prevents caching of the response.
582 $request->response()->clearCookie( $cookieKey );
584 $outputPage->
addModules(
'mediawiki.action.view.postEdit' );
585 if ( $this->getContext()->getConfig()->
get( MainConfigNames::EnableEditRecovery )
586 && $this->userOptionsLookup->getOption( $this->getContext()->getUser(),
'editrecovery' )
588 $outputPage->
addModules(
'mediawiki.editRecovery.postEdit' );
598 $context = $this->getContext();
601 $protectionIndicatorsAreEnabled = $context->getConfig()
602 ->get( MainConfigNames::EnableProtectionIndicators );
604 if ( !$protectionIndicatorsAreEnabled || $title->isMainPage() ) {
608 $protection = $this->restrictionStore->getRestrictions( $title,
'edit' );
610 $cascadeProtection = $this->restrictionStore->getCascadeProtectionSources( $title )[1];
612 $isCascadeProtected = array_key_exists(
'edit', $cascadeProtection );
614 if ( !$protection && !$isCascadeProtected ) {
618 if ( $isCascadeProtected ) {
622 $protectionLevel = $cascadeProtection[
'edit'][0];
624 $protectionLevel = $protection[0];
631 $protectionLevel = htmlspecialchars( $protectionLevel );
633 $protectionExpiry = $this->restrictionStore->getRestrictionExpiry( $title,
'edit' );
634 $formattedProtectionExpiry = $context->getLanguage()
635 ->formatExpiry( $protectionExpiry ??
'' );
637 $protectionMsg =
'protection-indicator-title';
638 if ( $protectionExpiry ===
'infinity' || !$protectionExpiry ) {
639 $protectionMsg .=
'-infinity';
647 $protectionIndicatorId =
'protection-' . $protectionLevel;
648 $protectionIndicatorId .= ( $isCascadeProtected ?
'-cascade' :
'' );
651 $protectionMsg = $outputPage->
msg( $protectionMsg, $protectionLevel, $formattedProtectionExpiry )->text();
655 $protectionHelpLink = $outputPage->
msg( $protectionIndicatorId .
'-helppage' );
656 if ( $protectionHelpLink->isDisabled() ) {
657 $protectionHelpLink =
'https://mediawiki.org/wiki/Special:MyLanguage/Help:Protection';
659 $protectionHelpLink = $protectionHelpLink->text();
663 $protectionIndicatorId => Html::rawElement(
'a', [
664 'class' =>
'mw-protection-indicator-icon--lock',
665 'title' => $protectionMsg,
666 'href' => $protectionHelpLink
670 Html::element(
'span', [], $protectionMsg ) )
673 $outputPage->
addModuleStyles(
'mediawiki.protectionIndicators.styles' );
688 private function generateContentOutput(
695 # Should the parser cache be used?
696 $useParserCache = true;
698 $parserOutputAccess = MediaWikiServices::getInstance()->getParserOutputAccess();
701 $this->getHookRunner()->onArticleViewHeader( $this, $outputDone, $useParserCache );
704 $pOutput = $outputDone;
708 $this->doOutputMetaData( $pOutput, $outputPage );
714 if ( !$this->mPage->exists() ) {
715 wfDebug( __METHOD__ .
": showing missing article" );
716 $this->showMissingArticle();
717 $this->mPage->doViewUpdates( $performer );
723 if ( $useParserCache && !$oldid ) {
724 $pOutput = $parserOutputAccess->getCachedParserOutput(
728 ParserOutputAccess::OPT_NO_AUDIENCE_CHECK
732 $this->doOutputFromParserCache( $pOutput, $outputPage, $textOptions );
733 $this->doOutputMetaData( $pOutput, $outputPage );
738 $rev = $this->fetchRevisionRecord();
739 if ( !$this->fetchResult->isOK() ) {
740 $this->showViewError( $this->fetchResult->getWikiText(
741 false,
false, $this->getContext()->getLanguage()
746 # Are we looking at an old revision
748 $this->setOldSubtitle( $oldid );
750 if ( !$this->showDeletedRevisionHeader() ) {
751 wfDebug( __METHOD__ .
": cannot view deleted revision" );
758 if ( $useParserCache ) {
759 $pOutput = $parserOutputAccess->getCachedParserOutput(
763 ParserOutputAccess::OPT_NO_AUDIENCE_CHECK
767 $this->doOutputFromParserCache( $pOutput, $outputPage, $textOptions );
768 $this->doOutputMetaData( $pOutput, $outputPage );
774 # Ensure that UI elements requiring revision ID have
775 # the correct version information. (This may be overwritten after creation of ParserOutput)
778 # Preload timestamp to avoid a DB hit
781 # Pages containing custom CSS or JavaScript get special treatment
782 if ( $this->
getTitle()->isSiteConfigPage() || $this->
getTitle()->isUserConfigPage() ) {
783 $dir = $this->
getContext()->getLanguage()->getDir();
784 $lang = $this->
getContext()->getLanguage()->getHtmlCode();
787 "<div id='mw-clearyourcache' lang='$lang' dir='$dir' class='mw-content-$dir'>\n$1\n</div>",
791 } elseif ( !$this->getHookRunner()->onArticleRevisionViewCustom(
799 $this->doOutputMetaData( $pOutput, $outputPage );
803 # Run the parse, protected by a pool counter
804 wfDebug( __METHOD__ .
": doing uncached parse" );
809 $opt |= ParserOutputAccess::OPT_NO_CHECK_CACHE;
812 $opt |= ParserOutputAccess::OPT_NO_AUDIENCE_CHECK;
815 $opt |= ParserOutputAccess::OPT_FOR_ARTICLE_VIEW;
820 $opt |= ParserOutputAccess::OPT_LINKS_UPDATE;
822 if ( !$rev->
getId() || !$useParserCache ) {
824 $opt |= ParserOutputAccess::OPT_NO_CACHE;
827 $renderStatus = $parserOutputAccess->getParserOutput(
849 if ( $oldid === 0 || $oldid === $this->getPage()->getLatest() ) {
850 $parsoidCacheWarmingEnabled = $this->
getContext()->getConfig()
851 ->get( MainConfigNames::ParsoidCacheConfig )[
'WarmParsoidParserCache'];
853 if ( $parsoidCacheWarmingEnabled ) {
856 $this->getPage()->toPageRecord(),
857 [
'causeAction' =>
'view' ]
859 $this->jobQueueGroup->lazyPush( $parsoidJobSpec );
863 $this->doOutputFromRenderStatus(
870 if ( !$renderStatus->
isOK() ) {
874 $pOutput = $renderStatus->
getValue();
875 $this->doOutputMetaData( $pOutput, $outputPage );
884 # Adjust title for main page & pages with displaytitle
886 $this->adjustDisplayTitle( $pOutput );
898 # Check for any __NOINDEX__ tags on the page using $pOutput
899 $policy = $this->getRobotPolicy(
'view', $pOutput ?: null );
900 $outputPage->
getMetadata()->setIndexPolicy( $policy[
'index'] );
903 $this->mParserOutput = $pOutput;
911 private function doOutputFromParserCache(
916 # Ensure that UI elements requiring revision ID have
917 # the correct version information.
922 # Preload timestamp to avoid a DB hit
924 if ( $cachedTimestamp !==
null ) {
926 $this->mPage->setTimestamp( $cachedTimestamp );
936 private function doOutputFromRenderStatus(
943 if ( !$renderStatus->
isOK() ) {
945 false,
'view-pool-error', $context->getLanguage()
950 $pOutput = $renderStatus->
getValue();
953 if ( $renderStatus->
hasMessage(
'view-pool-dirty-output' ) ) {
954 $outputPage->
lowerCdnMaxage( $context->getConfig()->get( MainConfigNames::CdnMaxageStale ) );
956 $staleReason = $renderStatus->
hasMessage(
'view-pool-contention' )
957 ? $context->msg(
'view-pool-contention' )->escaped()
958 : $context->msg(
'view-pool-timeout' )->escaped();
959 $outputPage->
addHTML(
"<!-- parser cache is expired, " .
960 "sending anyway due to $staleReason-->\n" );
964 if ( $cachedId !==
null ) {
972 if ( $this->getRevisionRedirectTarget( $rev ) ) {
973 $outputPage->
addSubtitle(
"<span id=\"redirectsub\">" .
974 $context->msg(
'redirectpagesub' )->parse() .
"</span>" );
982 private function getRevisionRedirectTarget(
RevisionRecord $revision ) {
986 $content = $revision->
getContent( SlotRecord::MAIN );
987 return $content ? $content->getRedirectTarget() :
null;
995 $out = $this->getContext()->getOutput();
997 # Adjust the title if it was set by displaytitle, -{T|}- or language conversion
999 if ( strval( $titleText ) !==
'' ) {
1000 $out->setPageTitle( $titleText );
1001 $out->setDisplayTitle( $titleText );
1010 $context = $this->getContext();
1013 $request = $context->getRequest();
1014 $diff = $request->getVal(
'diff' );
1015 $rcid = $request->getInt(
'rcid' );
1016 $purge = $request->getRawVal(
'action' ) ===
'purge';
1017 $unhide = $request->getInt(
'unhide' ) === 1;
1018 $oldid = $this->getOldID();
1020 $rev = $this->fetchRevisionRecord();
1025 $rev = $this->revisionStore->getRevisionById( $oldid );
1032 $msg = $context->msg(
'difference-missing-revision' )
1041 $services = MediaWikiServices::getInstance();
1043 $contentHandler = $services
1044 ->getContentHandlerFactory()
1045 ->getContentHandler(
1046 $rev->
getSlot( SlotRecord::MAIN, RevisionRecord::RAW )->getModel()
1048 $de = $contentHandler->createDifferenceEngine(
1057 $diffType = $request->getVal(
'diff-type' );
1059 if ( $diffType ===
null ) {
1060 $diffType = $this->userOptionsLookup
1061 ->getOption( $context->getUser(),
'diff-type' );
1063 $de->setExtraQueryParams( [
'diff-type' => $diffType ] );
1066 $de->setSlotDiffOptions( [
1067 'diff-type' => $diffType,
1068 'expand-url' => $this->viewIsRenderAction,
1069 'inline-toggle' =>
true,
1071 $de->showDiffPage( $this->isDiffOnlyView() );
1075 [ , $new ] = $de->mapDiffPrevNext( $oldid, $diff );
1077 $this->mPage->doViewUpdates( $context->getAuthority(), (
int)$new );
1080 $context->getOutput()->addHelpLink(
'Help:Diff' );
1084 return $this->getContext()->getRequest()->getBool(
1086 $this->userOptionsLookup->getBoolOption( $this->getContext()->getUser(),
'diffonly' )
1098 $context = $this->getContext();
1099 $mainConfig = $context->getConfig();
1100 $articleRobotPolicies = $mainConfig->get( MainConfigNames::ArticleRobotPolicies );
1101 $namespaceRobotPolicies = $mainConfig->get( MainConfigNames::NamespaceRobotPolicies );
1102 $defaultRobotPolicy = $mainConfig->get( MainConfigNames::DefaultRobotPolicy );
1104 $ns = $title->getNamespace();
1106 # Don't index user and user talk pages for blocked users (T13443)
1108 $specificTarget =
null;
1109 $vagueTarget =
null;
1110 $titleText = $title->getText();
1111 if ( IPUtils::isValid( $titleText ) ) {
1112 $vagueTarget = $titleText;
1114 $specificTarget = $title->getRootText();
1116 if ( $this->blockStore->newFromTarget( $specificTarget, $vagueTarget ) instanceof
DatabaseBlock ) {
1118 'index' =>
'noindex',
1119 'follow' =>
'nofollow'
1124 if ( $this->mPage->getId() === 0 || $this->getOldID() ) {
1125 # Non-articles (special pages etc), and old revisions
1127 'index' =>
'noindex',
1128 'follow' =>
'nofollow'
1130 } elseif ( $context->getOutput()->isPrintable() ) {
1131 # Discourage indexing of printable versions, but encourage following
1133 'index' =>
'noindex',
1134 'follow' =>
'follow'
1136 } elseif ( $context->getRequest()->getInt(
'curid' ) ) {
1137 # For ?curid=x urls, disallow indexing
1139 'index' =>
'noindex',
1140 'follow' =>
'follow'
1144 # Otherwise, construct the policy based on the various config variables.
1145 $policy = self::formatRobotPolicy( $defaultRobotPolicy );
1147 if ( isset( $namespaceRobotPolicies[$ns] ) ) {
1148 # Honour customised robot policies for this namespace
1149 $policy = array_merge(
1151 self::formatRobotPolicy( $namespaceRobotPolicies[$ns] )
1154 if ( $title->canUseNoindex() && $pOutput && $pOutput->
getIndexPolicy() ) {
1155 # __INDEX__ and __NOINDEX__ magic words, if allowed. Incorporates
1156 # a final check that we have really got the parser output.
1157 $policy = array_merge(
1163 if ( isset( $articleRobotPolicies[$title->getPrefixedText()] ) ) {
1164 # (T16900) site config can override user-defined __INDEX__ or __NOINDEX__
1165 $policy = array_merge(
1167 self::formatRobotPolicy( $articleRobotPolicies[$title->getPrefixedText()] )
1182 if ( is_array( $policy ) ) {
1184 } elseif ( !$policy ) {
1189 foreach ( explode(
',', $policy ) as $var ) {
1190 $var = trim( $var );
1191 if ( $var ===
'index' || $var ===
'noindex' ) {
1192 $arr[
'index'] = $var;
1193 } elseif ( $var ===
'follow' || $var ===
'nofollow' ) {
1194 $arr[
'follow'] = $var;
1209 $context = $this->getContext();
1210 $redirectSources = $context->getConfig()->get( MainConfigNames::RedirectSources );
1212 $request = $context->getRequest();
1213 $rdfrom = $request->getVal(
'rdfrom' );
1216 $query = $request->getQueryValues();
1217 unset( $query[
'rdfrom'] );
1218 unset( $query[
'title'] );
1219 if ( $this->
getTitle()->isRedirect() ) {
1221 $query[
'redirect'] =
'no';
1223 $redirectTargetUrl = $this->
getTitle()->getLinkURL( $query );
1225 if ( isset( $this->mRedirectedFrom ) ) {
1228 if ( $this->getHookRunner()->onArticleViewRedirect( $this ) ) {
1229 $redir = $this->linkRenderer->makeKnownLink(
1230 $this->mRedirectedFrom,
1233 [
'redirect' =>
'no' ]
1236 $outputPage->
addSubtitle(
"<span class=\"mw-redirectedfrom\">" .
1237 $context->msg(
'redirectedfrom' )->rawParams( $redir )->parse()
1243 'wgInternalRedirectTargetUrl' => $redirectTargetUrl,
1245 $outputPage->
addModules(
'mediawiki.action.view.redirect' );
1255 } elseif ( $rdfrom ) {
1258 if ( $redirectSources && preg_match( $redirectSources, $rdfrom ) ) {
1259 $redir = $this->linkRenderer->makeExternalLink( $rdfrom, $rdfrom, $this->
getTitle() );
1260 $outputPage->
addSubtitle(
"<span class=\"mw-redirectedfrom\">" .
1261 $context->msg(
'redirectedfrom' )->rawParams( $redir )->parse()
1266 'wgInternalRedirectTargetUrl' => $redirectTargetUrl,
1268 $outputPage->
addModules(
'mediawiki.action.view.redirect' );
1282 if ( $this->
getTitle()->isTalkPage() && !$this->getContext()->msg(
'talkpageheader' )->isDisabled() ) {
1283 $this->getContext()->getOutput()->wrapWikiMsg(
1284 "<div class=\"mw-talkpageheader\">\n$1\n</div>",
1285 [
'talkpageheader' ]
1294 # check if we're displaying a [[User talk:x.x.x.x]] anonymous talk page
1296 && IPUtils::isValid( $this->
getTitle()->getText() )
1298 $this->getContext()->getOutput()->addWikiMsg(
'anontalkpagetext' );
1302 $patrolFooterShown = $this->showPatrolFooter();
1304 $this->getHookRunner()->onArticleViewFooter( $this, $patrolFooterShown );
1318 $context = $this->getContext();
1319 $mainConfig = $context->getConfig();
1320 $useNPPatrol = $mainConfig->get( MainConfigNames::UseNPPatrol );
1321 $useRCPatrol = $mainConfig->get( MainConfigNames::UseRCPatrol );
1322 $useFilePatrol = $mainConfig->get( MainConfigNames::UseFilePatrol );
1324 if ( !$this->getHookRunner()->onArticleShowPatrolFooter( $this ) ) {
1329 $user = $context->getUser();
1333 if ( !$context->getAuthority()->probablyCan(
'patrol', $title )
1334 || !( $useRCPatrol || $useNPPatrol
1335 || ( $useFilePatrol && $title->inNamespace(
NS_FILE ) ) )
1341 if ( $this->mRevisionRecord
1342 && !RecentChange::isInRCLifespan( $this->mRevisionRecord->getTimestamp(), 21600 )
1350 $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
1351 $key = $cache->makeKey(
'unpatrollable-page', $title->getArticleID() );
1352 if ( $cache->get( $key ) ) {
1356 $dbr = $this->dbProvider->getReplicaDatabase();
1357 $oldestRevisionRow = $dbr->newSelectQueryBuilder()
1358 ->select( [
'rev_id',
'rev_timestamp' ] )
1359 ->from(
'revision' )
1360 ->where( [
'rev_page' => $title->getArticleID() ] )
1361 ->orderBy( [
'rev_timestamp',
'rev_id' ] )
1362 ->caller( __METHOD__ )->fetchRow();
1363 $oldestRevisionTimestamp = $oldestRevisionRow ? $oldestRevisionRow->rev_timestamp :
false;
1369 $recentPageCreation =
false;
1370 if ( $oldestRevisionTimestamp
1371 && RecentChange::isInRCLifespan( $oldestRevisionTimestamp, 21600 )
1374 $recentPageCreation =
true;
1375 $rc = RecentChange::newFromConds(
1377 'rc_this_oldid' => intval( $oldestRevisionRow->rev_id ),
1385 $markPatrolledMsg = $context->msg(
'markaspatrolledtext' );
1393 $recentFileUpload =
false;
1394 if ( ( !$rc || $rc->getAttribute(
'rc_patrolled' ) ) && $useFilePatrol
1395 && $title->getNamespace() ===
NS_FILE ) {
1397 $newestUploadTimestamp = $dbr->newSelectQueryBuilder()
1398 ->select(
'img_timestamp' )
1400 ->where( [
'img_name' => $title->getDBkey() ] )
1401 ->caller( __METHOD__ )->fetchField();
1402 if ( $newestUploadTimestamp
1403 && RecentChange::isInRCLifespan( $newestUploadTimestamp, 21600 )
1406 $recentFileUpload =
true;
1407 $rc = RecentChange::newFromConds(
1410 'rc_log_type' =>
'upload',
1411 'rc_timestamp' => $newestUploadTimestamp,
1413 'rc_cur_id' => $title->getArticleID()
1419 $markPatrolledMsg = $context->msg(
'markaspatrolledtext-file' );
1424 if ( !$recentPageCreation && !$recentFileUpload ) {
1429 $cache->set( $key,
'1' );
1441 if ( $rc->getAttribute(
'rc_patrolled' ) ) {
1446 $cache->set( $key,
'1' );
1451 if ( $rc->getPerformerIdentity()->equals( $user ) ) {
1457 $outputPage->
getMetadata()->setPreventClickjacking(
true );
1458 $outputPage->
addModules(
'mediawiki.misc-authed-curate' );
1460 $link = $this->linkRenderer->makeKnownLink(
1462 new HtmlArmor(
'<button class="cdx-button cdx-button--action-progressive">'
1464 . $markPatrolledMsg->escaped() .
'</button>' ),
1467 'action' =>
'markpatrolled',
1468 'rcid' => $rc->getAttribute(
'rc_id' ),
1473 $outputPage->
addHTML(
"<div class='patrollink' data-mw='interface'>$link</div>" );
1485 $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
1486 $cache->delete( $cache->makeKey(
'unpatrollable-page', $articleID ) );
1494 $context = $this->getContext();
1495 $send404Code = $context->getConfig()->get( MainConfigNames::Send404Code );
1499 $validUserPage =
false;
1503 $services = MediaWikiServices::getInstance();
1505 $contextUser = $context->getUser();
1507 # Show info in user (talk) namespace. Does the user exist? Is he blocked?
1508 if ( $title->getNamespace() ===
NS_USER
1511 $rootPart = $title->getRootText();
1512 $user = User::newFromName( $rootPart,
false );
1513 $ip = $this->userNameUtils->isIP( $rootPart );
1514 $block = $this->blockStore->newFromTarget( $user, $user );
1516 if ( $user && $user->isRegistered() && $user->isHidden() &&
1517 !$context->getAuthority()->isAllowed(
'hideuser' )
1524 if ( !( $user && $user->isRegistered() ) && !$ip ) {
1526 $outputPage->
addHTML( Html::warningBox(
1527 $context->msg(
'userpage-userdoesnotexist-view',
wfEscapeWikiText( $rootPart ) )->parse(),
1528 'mw-userpage-userdoesnotexist'
1532 LogEventsList::showLogExtract(
1535 Title::makeTitleSafe(
NS_USER, $rootPart ),
1539 'showIfEmpty' =>
false,
1540 'msgKey' => [
'renameuser-renamed-notice', $title->getBaseText() ]
1545 $block->getType() != DatabaseBlock::TYPE_AUTO &&
1547 $block->isSitewide() ||
1548 $services->getPermissionManager()->isBlockedFrom( $user, $title,
true )
1553 LogEventsList::showLogExtract(
1556 $services->getNamespaceInfo()->getCanonicalName(
NS_USER ) .
':' .
1557 $block->getTargetName(),
1561 'showIfEmpty' =>
false,
1563 'blocked-notice-logextract',
1564 $user->getName() # Support GENDER in notice
1568 $validUserPage = !$title->isSubpage();
1570 $validUserPage = !$title->isSubpage();
1574 $this->getHookRunner()->onShowMissingArticle( $this );
1576 # Show delete and move logs if there were any such events.
1577 # The logging query can DOS the site when bots/crawlers cause 404 floods,
1578 # so be careful showing this. 404 pages must be cheap as they are hard to cache.
1579 $dbCache = MediaWikiServices::getInstance()->getMainObjectStash();
1580 $key = $dbCache->makeKey(
'page-recent-delete', md5( $title->getPrefixedText() ) );
1581 $isRegistered = $contextUser->isRegistered();
1582 $sessionExists = $context->getRequest()->getSession()->isPersistent();
1584 if ( $isRegistered || $dbCache->get( $key ) || $sessionExists ) {
1585 $logTypes = [
'delete',
'move',
'protect',
'merge' ];
1587 $dbr = $this->dbProvider->getReplicaDatabase();
1589 $conds = [ $dbr->expr(
'log_action',
'!=',
'revision' ) ];
1591 $this->getHookRunner()->onArticle__MissingArticleConditions( $conds, $logTypes );
1592 LogEventsList::showLogExtract(
1600 'showIfEmpty' =>
false,
1601 'msgKey' => [ $isRegistered || $sessionExists
1602 ?
'moveddeleted-notice'
1603 :
'moveddeleted-notice-recent'
1609 if ( !$this->mPage->hasViewableContent() && $send404Code && !$validUserPage ) {
1612 $context->getRequest()->response()->statusHeader( 404 );
1616 $policy = $this->getRobotPolicy(
'view' );
1617 $outputPage->
getMetadata()->setIndexPolicy( $policy[
'index'] );
1620 $hookResult = $this->getHookRunner()->onBeforeDisplayNoArticleText( $this );
1622 if ( !$hookResult ) {
1626 # Show error message
1627 $oldid = $this->getOldID();
1628 if ( !$oldid && $title->getNamespace() ===
NS_MEDIAWIKI && $title->hasSourceText() ) {
1629 $text = $this->
getTitle()->getDefaultMessageText() ??
'';
1633 $text = $this->getMissingRevisionMsg( $oldid )->plain();
1634 } elseif ( $context->getAuthority()->probablyCan(
'edit', $title ) ) {
1635 $message = $isRegistered ?
'noarticletext' :
'noarticletextanon';
1636 $text = $context->msg( $message )->plain();
1638 $text = $context->msg(
'noarticletext-nopermission' )->plain();
1641 $dir = $context->getLanguage()->getDir();
1642 $lang = $context->getLanguage()->getHtmlCode();
1644 'class' =>
"noarticletext mw-content-$dir",
1647 ] ) .
"\n$text\n</div>" );
1655 private function showViewError(
string $errortext ) {
1656 $outputPage = $this->getContext()->getOutput();
1657 $outputPage->
setPageTitleMsg( $this->getContext()->msg(
'errorpagetitle' ) );
1671 if ( !$this->mRevisionRecord->isDeleted( RevisionRecord::DELETED_TEXT ) ) {
1675 $outputPage = $this->getContext()->getOutput();
1677 $titleText = $this->
getTitle()->getPrefixedDBkey();
1679 if ( !$this->mRevisionRecord->userCan(
1680 RevisionRecord::DELETED_TEXT,
1681 $this->getContext()->getAuthority()
1685 $outputPage->
msg(
'rev-deleted-text-permission', $titleText )->parse(),
1692 } elseif ( $this->getContext()->getRequest()->getInt(
'unhide' ) !== 1 ) {
1693 # Give explanation and add a link to view the revision...
1694 $oldid = intval( $this->getOldID() );
1695 $link = $this->
getTitle()->getFullURL(
"oldid={$oldid}&unhide=1" );
1696 $msg = $this->mRevisionRecord->isDeleted( RevisionRecord::DELETED_RESTRICTED ) ?
1697 'rev-suppressed-text-unhide' :
'rev-deleted-text-unhide';
1700 $outputPage->
msg( $msg, $link )->parse(),
1708 $msg = $this->mRevisionRecord->isDeleted( RevisionRecord::DELETED_RESTRICTED )
1709 ? [
'rev-suppressed-text-view', $titleText ]
1710 : [
'rev-deleted-text-view', $titleText ];
1713 $outputPage->
msg( $msg[0], $msg[1] )->parse(),
1731 if ( !$this->getHookRunner()->onDisplayOldSubtitle( $this, $oldid ) ) {
1735 $context = $this->getContext();
1736 $unhide = $context->getRequest()->getInt(
'unhide' ) === 1;
1738 # Cascade unhide param in links for easy deletion browsing
1741 $extraParams[
'unhide'] = 1;
1744 if ( $this->mRevisionRecord && $this->mRevisionRecord->getId() === $oldid ) {
1745 $revisionRecord = $this->mRevisionRecord;
1747 $revisionRecord = $this->revisionStore->getRevisionById( $oldid );
1749 if ( !$revisionRecord ) {
1750 throw new LogicException(
'There should be a revision record at this point.' );
1753 $timestamp = $revisionRecord->getTimestamp();
1755 $current = ( $oldid == $this->mPage->getLatest() );
1756 $language = $context->getLanguage();
1757 $user = $context->getUser();
1759 $td = $language->userTimeAndDate( $timestamp, $user );
1760 $tddate = $language->userDate( $timestamp, $user );
1761 $tdtime = $language->userTime( $timestamp, $user );
1763 # Show user links if allowed to see them. If hidden, then show them only if requested...
1764 $userlinks = Linker::revUserTools( $revisionRecord, !$unhide );
1766 $infomsg = $current && !$context->msg(
'revision-info-current' )->isDisabled()
1767 ?
'revision-info-current'
1772 'mediawiki.codex.messagebox.styles',
1773 'mediawiki.action.styles',
1774 'mediawiki.interface.helpers.styles'
1777 $revisionUser = $revisionRecord->getUser();
1778 $revisionInfo =
"<div id=\"mw-{$infomsg}\">" .
1779 $context->msg( $infomsg, $td )
1780 ->rawParams( $userlinks )
1782 $revisionRecord->getId(),
1785 $revisionUser ? $revisionUser->getName() :
''
1787 ->rawParams( $this->commentFormatter->formatRevision(
1797 ? $context->msg(
'currentrevisionlink' )->escaped()
1798 : $this->linkRenderer->makeKnownLink(
1800 $context->msg(
'currentrevisionlink' )->text(),
1805 ? $context->msg(
'diff' )->escaped()
1806 : $this->linkRenderer->makeKnownLink(
1808 $context->msg(
'diff' )->text(),
1815 $prevExist = (bool)$this->revisionStore->getPreviousRevision( $revisionRecord );
1816 $prevlink = $prevExist
1817 ? $this->linkRenderer->makeKnownLink(
1819 $context->msg(
'previousrevision' )->text(),
1822 'direction' =>
'prev',
1826 : $context->msg(
'previousrevision' )->escaped();
1827 $prevdiff = $prevExist
1828 ? $this->linkRenderer->makeKnownLink(
1830 $context->msg(
'diff' )->text(),
1837 : $context->msg(
'diff' )->escaped();
1838 $nextlink = $current
1839 ? $context->msg(
'nextrevision' )->escaped()
1840 : $this->linkRenderer->makeKnownLink(
1842 $context->msg(
'nextrevision' )->text(),
1845 'direction' =>
'next',
1849 $nextdiff = $current
1850 ? $context->msg(
'diff' )->escaped()
1851 : $this->linkRenderer->makeKnownLink(
1853 $context->msg(
'diff' )->text(),
1861 $cdel = Linker::getRevDeleteLink(
1862 $context->getAuthority(),
1866 if ( $cdel !==
'' ) {
1874 "<div id=\"mw-revision-nav\">" . $cdel .
1875 $context->msg(
'revision-nav' )->rawParams(
1876 $prevdiff, $prevlink, $lnk, $curdiff, $nextlink, $nextdiff
1877 )->escaped() .
"</div>",
1898 $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
1911 $out = $this->getContext()->getOutput();
1912 $msg = $out->msg(
'namespace-' . $this->
getTitle()->getNamespace() .
'-helppage' );
1914 if ( !$msg->isDisabled() ) {
1915 $title = Title::newFromText( $msg->plain() );
1916 if ( $title instanceof
Title ) {
1917 $out->addHelpLink( $title->getLocalURL(),
true );
1920 $out->addHelpLink( $to, $overrideBaseUrl );
1928 $this->getContext()->getRequest()->response()->header(
'X-Robots-Tag: noindex' );
1929 $this->getContext()->getOutput()->setArticleBodyOnly(
true );
1931 $this->viewIsRenderAction =
true;
1960 static $called =
false;
1963 wfDebug(
"Article::tryFileCache(): called twice!?" );
1968 if ( $this->isFileCacheable() ) {
1970 if ( $cache->isCacheGood( $this->mPage->getTouched() ) ) {
1971 wfDebug(
"Article::tryFileCache(): about to load file" );
1972 $cache->loadFromFileCache( $this->getContext() );
1975 wfDebug(
"Article::tryFileCache(): starting buffer" );
1976 ob_start( [ &$cache,
'saveToFileCache' ] );
1979 wfDebug(
"Article::tryFileCache(): not cacheable" );
1993 if ( HTMLFileCache::useFileCache( $this->getContext(), $mode ) ) {
1994 $cacheable = $this->mPage->getId()
1995 && !$this->mRedirectedFrom && !$this->
getTitle()->isRedirect();
1998 $cacheable = $this->getHookRunner()->onIsFileCacheable( $this ) ??
false;
2017 if ( $user ===
null ) {
2018 $parserOptions = $this->getParserOptions();
2020 $parserOptions = $this->mPage->makeParserOptions( $user );
2024 return $this->mPage->getParserOutput( $parserOptions, $oldid );
2032 $parserOptions = $this->mPage->makeParserOptions( $this->getContext() );
2034 return $parserOptions;
2044 $this->mContext = $context;
2055 return $this->mContext;
2057 wfDebug( __METHOD__ .
" called and \$mContext is null. " .
2058 "Return RequestContext::getMain()" );
2059 return RequestContext::getMain();
2069 return $this->mPage->getActionOverrides();
2072 private function getMissingRevisionMsg(
int $oldid ):
Message {
2076 $context = $this->getContext();
2077 $revRecord = $this->archivedRevisionLookup->getArchivedRevisionRecord(
null, $oldid );
2080 $revRecord->userCan(
2081 RevisionRecord::DELETED_TEXT,
2082 $context->getAuthority()
2084 $context->getAuthority()->isAllowedAny(
'deletedtext',
'undelete' )
2086 return $context->msg(
2087 'missing-revision-permission',
2089 $revRecord->getTimestamp(),
2090 Title::newFromPageIdentity( $revRecord->getPage() )->getPrefixedDBkey()
2093 return $context->msg(
'missing-revision', $oldid );
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
wfEscapeWikiText( $input)
Escapes the given text so that it may be output using addWikiText() without any linking,...
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Logs a warning that a deprecated feature was used.
if(!defined('MW_SETUP_CALLBACK'))
Legacy class representing an editable page and handling UI for some page actions.
static newFromWikiPage(WikiPage $page, IContextSource $context)
Create an Article object of the appropriate class for the given page.
getContext()
Gets the context this Article is executed in.
getOldIDFromRequest()
Sets $this->mRedirectUrl to a correct URL if the query parameters are incorrect.
getRedirectedFrom()
Get the page this view was redirected from.
Title null $mRedirectedFrom
Title from which we were redirected here, if any.
bool $viewIsRenderAction
Whether render() was called.
view()
This is the default action of the index.php entry point: just view the page of the given title.
showProtectionIndicator()
Show a lock icon above the article body if the page is protected.
__construct(Title $title, $oldId=null)
static purgePatrolFooterCache( $articleID)
Purge the cache used to check if it is worth showing the patrol footer For example,...
ParserOutput null false $mParserOutput
The ParserOutput generated for viewing the page, initialized by view().
LinkRenderer $linkRenderer
getTitle()
Get the title object of the article.
getActionOverrides()
Call to WikiPage function for backwards compatibility.
adjustDisplayTitle(ParserOutput $pOutput)
Adjust title for pages with displaytitle, -{T|}- or language conversion.
DatabaseBlockStore $blockStore
showDeletedRevisionHeader()
If the revision requested for view is deleted, check permissions.
getParserOptions()
Get parser options suitable for rendering the primary article wikitext.
IContextSource null $mContext
The context this Article is executed in.
static getRedirectHeaderHtml(Language $lang, Title $target, $forceKnown=false)
Return the HTML for the top of a redirect page.
protect()
action=protect handler
string false $mRedirectUrl
URL to redirect to or false if none.
isCurrent()
Returns true if the currently-referenced revision is the current edit to this page (and it exists).
showMissingArticle()
Show the error text for a missing article.
IConnectionProvider $dbProvider
unprotect()
action=unprotect handler (alias)
getPage()
Get the WikiPage object of this instance.
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
static newFromID( $id)
Constructor from a page id.
int null $mOldId
The oldid of the article that was requested to be shown, 0 for the current revision.
static formatRobotPolicy( $policy)
Converts a String robot policy into an associative array, to allow merging of several policies using ...
fetchRevisionRecord()
Fetches the revision to work on.
getRobotPolicy( $action, ?ParserOutput $pOutput=null)
Get the robot policy to be used for the current view.
showPatrolFooter()
If patrol is possible, output a patrol UI box.
setOldSubtitle( $oldid=0)
Generate the navigation links when browsing through an article revisions It shows the information as:...
showViewFooter()
Show the footer section of an ordinary page view.
WikiPage $mPage
The WikiPage object of this instance.
setRedirectedFrom(Title $from)
Tell the page view functions that this view was redirected from another page on the wiki.
isFileCacheable( $mode=HTMLFileCache::MODE_NORMAL)
Check if the page can be cached.
tryFileCache()
checkLastModified returns true if it has taken care of all output to the client that is necessary for...
getRevIdFetched()
Use this to fetch the rev ID used on page views.
showNamespaceHeader()
Show a header specific to the namespace currently being viewed, like [[MediaWiki:Talkpagetext]].
static newFromTitle( $title, IContextSource $context)
Create an Article object of the appropriate class for the given page.
showDiffPage()
Show a diff page according to current request variables.
RestrictionStore $restrictionStore
render()
Handle action=render.
showRedirectedFromHeader()
If this request is a redirect view, send "redirected from" subtitle to the output.
getParserOutput( $oldid=null, ?UserIdentity $user=null)
Lightweight method to get the parser output for a page, checking the parser cache and so on.
setContext( $context)
Sets the context this Article is executed in.
Special handling for category description pages.
Page view caching in the file system.
Marks HTML that shouldn't be escaped.
Rendering of file description pages.
Handle enqueueing of background jobs.
msg( $key,... $params)
Get a Message object with context set Parameters are the same as wfMessage()
Group all the pieces relevant to the context of a request into one instance.
The HTML user interface for page editing.
A class containing constants representing the names of configuration variables.
This is one of the Core classes and should be read at least once by any new developers.
parseAsContent( $text, $linestart=true)
Parse wikitext in the page content language and return the HTML.
disableClientCache()
Force the page to send nocache headers.
addJsConfigVars( $keys, $value=null)
Add one or more variables to be set in mw.config in JavaScript.
wrapWikiMsg( $wrap,... $msgSpecs)
This function takes a number of message/argument specifications, wraps them in some overall structure...
disable()
Disable output completely, i.e.
setRedirectedFrom(PageReference $t)
Set $mRedirectedFrom, the page which redirected us to the current page.
setRevisionTimestamp( $timestamp)
Set the timestamp of the revision which will be displayed.
adaptCdnTTL( $mtime, $minTTL=0, $maxTTL=0)
Get TTL in [$minTTL,$maxTTL] and pass it to lowerCdnMaxage()
addBodyClasses( $classes)
Add a class to the <body> element.
lowerCdnMaxage( $maxage)
Set the value of the "s-maxage" part of the "Cache-control" HTTP header to $maxage if that is lower t...
setContentLangForJS(Bcp47Code $lang)
setIndicators(array $indicators)
Add an array of indicators, with their identifiers as array keys and HTML contents as values.
setLastModified( $timestamp)
Override the last modified timestamp.
setRevisionIsCurrent(bool $isCurrent)
Set whether the revision displayed (as set in ::setRevisionId()) is the latest revision of the page.
addWikiTextAsContent( $text, $linestart=true, ?PageReference $title=null)
Convert wikitext in the page content language to HTML and add it to the buffer.
setFollowPolicy( $policy)
Set the follow policy for the page, but leave the index policy un- touched.
clearHTML()
Clear the body HTML.
setPageTitle( $name)
"Page title" means the contents of <h1>.
setPageTitleMsg(Message $msg)
"Page title" means the contents of <h1>.
addModules( $modules)
Load one or more ResourceLoader modules on this page.
redirect( $url, $responsecode='302')
Redirect to $url rather than displaying the normal page.
setHTMLTitle( $name)
"HTML title" means the contents of "<title>".
prependHTML( $text)
Prepend $text to the body HTML.
setRobotPolicy( $policy)
Set the robot policy for the page: http://www.robotstxt.org/meta.html
setCanonicalUrl( $url)
Set the URL to be used for the <link rel=canonical>>.
addHTML( $text)
Append $text to the body HTML.
addWikiTextAsInterface( $text, $linestart=true, ?PageReference $title=null)
Convert wikitext in the user interface language to HTML and add it to the buffer.
setRevisionId( $revid)
Set the revision ID which will be seen by the wiki text parser for things such as embedded {{REVISION...
addSubtitle( $str)
Add $str to the subtitle.
addModuleStyles( $modules)
Load the styles of one or more style-only ResourceLoader modules on this page.
addParserOutput(ParserOutput $parserOutput, $poOptions=[])
Add everything from a ParserOutput object.
getMetadata()
Return a ParserOutput that can be used to set metadata properties for the current page.
isPrintable()
Return whether the page is "printable".
setArticleFlag( $newVal)
Set whether the displayed content is related to the source of the corresponding article on the wiki S...
Service for getting rendered output of a given page.
Handles the page protection UI and backend.
Service for creating WikiPage objects.
static newSpec(int $revisionId, PageRecord $page, array $params=[])
Show an error when a user tries to do something they do not have the necessary permissions for.
hasMessage( $message)
Returns true if the specified message is present as a warning or error.
isOK()
Returns whether the operation completed.
fatal( $message,... $parameters)
Add an error and set OK to false, indicating that the operation as a whole was fatal.
Base representation for an editable wiki page.
getTitle()
Get the title object of the article.
Interface for objects which can provide a MediaWiki context on request.
Interface for type hinting (accepts WikiPage, Article, ImagePage, CategoryPage)