28use MediaWiki\HookContainer\ProtectedHookAccessorTrait;
58use Wikimedia\NonSerializable\NonSerializableTrait;
71 use ProtectedHookAccessorTrait;
72 use NonSerializableTrait;
100 private $fetchResult =
null;
114 protected $viewIsRenderAction =
false;
135 private $mRevisionRecord =
null;
142 $this->mOldId = $oldId;
143 $this->mPage = $this->
newPage( $title );
145 $services = MediaWikiServices::getInstance();
146 $this->linkRenderer = $services->getLinkRenderer();
147 $this->revisionStore = $services->getRevisionStore();
148 $this->userNameUtils = $services->getUserNameUtils();
149 $this->userOptionsLookup = $services->getUserOptionsLookup();
150 $this->commentFormatter = $services->getCommentFormatter();
151 $this->wikiPageFactory = $services->getWikiPageFactory();
152 $this->jobQueueGroup = $services->getJobQueueGroup();
153 $this->archivedRevisionLookup = $services->getArchivedRevisionLookup();
154 $this->dbProvider = $services->getConnectionProvider();
155 $this->blockStore = $services->getDatabaseBlockStore();
156 $this->restrictionStore = $services->getRestrictionStore();
173 $t = Title::newFromID( $id );
174 return $t ===
null ? null :
new static( $t );
187 $title = Title::makeTitle(
NS_FILE, $title->getDBkey() );
191 (
new HookRunner( MediaWikiServices::getInstance()->getHookContainer() ) )
193 ->onArticleFromTitle( $title, $page, $context );
195 switch ( $title->getNamespace() ) {
206 $page->setContext( $context );
219 $article = self::newFromTitle( $page->
getTitle(), $context );
220 $article->mPage = $page;
230 return $this->mRedirectedFrom;
239 $this->mRedirectedFrom = $from;
248 return $this->mPage->getTitle();
262 $this->mRedirectedFrom =
null; #
Title object if set
263 $this->mRedirectUrl =
false;
264 $this->mRevisionRecord =
null;
265 $this->fetchResult =
null;
269 $this->mPage->clear();
280 if ( $this->mOldId ===
null ) {
281 $this->mOldId = $this->getOldIDFromRequest();
284 return $this->mOldId;
293 $this->mRedirectUrl =
false;
296 $oldid = $request->getIntOrNull(
'oldid' );
298 if ( $oldid ===
null ) {
302 if ( $oldid !== 0 ) {
303 # Load the given revision and check whether the page is another one.
304 # In that case, update this instance to reflect the change.
305 if ( $oldid === $this->mPage->getLatest() ) {
306 $this->mRevisionRecord = $this->mPage->getRevisionRecord();
308 $this->mRevisionRecord = $this->revisionStore->getRevisionById( $oldid );
309 if ( $this->mRevisionRecord !==
null ) {
310 $revPageId = $this->mRevisionRecord->getPageId();
312 if ( $this->mPage->getId() !== $revPageId ) {
313 $this->mPage = $this->wikiPageFactory->newFromID( $revPageId );
319 $oldRev = $this->mRevisionRecord;
320 if ( $request->getRawVal(
'direction' ) ===
'next' ) {
323 $nextRev = $this->revisionStore->getNextRevision( $oldRev );
325 $nextid = $nextRev->getId();
330 $this->mRevisionRecord =
null;
332 $this->mRedirectUrl = $this->
getTitle()->getFullURL(
'redirect=no' );
334 } elseif ( $request->getRawVal(
'direction' ) ===
'prev' ) {
337 $prevRev = $this->revisionStore->getPreviousRevision( $oldRev );
339 $previd = $prevRev->getId();
344 $this->mRevisionRecord =
null;
361 if ( $this->fetchResult ) {
362 return $this->mRevisionRecord;
365 $oldid = $this->getOldID();
368 if ( !$this->mRevisionRecord ) {
370 $this->mRevisionRecord = $this->mPage->getRevisionRecord();
372 if ( !$this->mRevisionRecord ) {
373 wfDebug( __METHOD__ .
" failed to find page data for title " .
374 $this->
getTitle()->getPrefixedText() );
377 $this->fetchResult = Status::newFatal(
'noarticletext' );
381 $this->mRevisionRecord = $this->revisionStore->getRevisionById( $oldid );
383 if ( !$this->mRevisionRecord ) {
384 wfDebug( __METHOD__ .
" failed to load revision, rev_id $oldid" );
386 $this->fetchResult = Status::newFatal( $this->getMissingRevisionMsg( $oldid ) );
392 if ( !$this->mRevisionRecord->userCan( RevisionRecord::DELETED_TEXT, $this->getContext()->getAuthority() ) ) {
393 wfDebug( __METHOD__ .
" failed to retrieve content of revision " . $this->mRevisionRecord->getId() );
397 $this->fetchResult =
new Status;
398 $title = $this->
getTitle()->getPrefixedDBkey();
400 if ( $this->mRevisionRecord->isDeleted( RevisionRecord::DELETED_RESTRICTED ) ) {
401 $this->fetchResult->
fatal(
'rev-suppressed-text' );
403 $this->fetchResult->fatal(
'rev-deleted-text-permission', $title );
409 $this->fetchResult = Status::newGood( $this->mRevisionRecord );
410 return $this->mRevisionRecord;
419 # If no oldid, this is the current version.
420 if ( $this->getOldID() == 0 ) {
424 return $this->mPage->exists() &&
425 $this->mRevisionRecord &&
426 $this->mRevisionRecord->isCurrent();
438 if ( $this->fetchResult && $this->fetchResult->isOK() ) {
440 $rev = $this->fetchResult->getValue();
441 return $rev->
getId();
443 return $this->mPage->getLatest();
453 $useFileCache = $context->getConfig()->get( MainConfigNames::UseFileCache );
455 # Get variables from query string
456 # As side effect this will load the revision and update the title
457 # in a revision ID is passed in the request, so this should remain
458 # the first call of this method even if $oldid is used way below.
459 $oldid = $this->getOldID();
461 $authority = $context->getAuthority();
462 # Another check in case getOldID() is altering the title
463 $permissionStatus = PermissionStatus::newEmpty();
465 ->authorizeRead(
'read', $this->
getTitle(), $permissionStatus )
467 wfDebug( __METHOD__ .
": denied on secondary read check" );
472 # getOldID() may as well want us to redirect somewhere else
473 if ( $this->mRedirectUrl ) {
474 $outputPage->
redirect( $this->mRedirectUrl );
475 wfDebug( __METHOD__ .
": redirecting due to oldid" );
480 # If we got diff in the query, we want to see a diff page instead of the article.
481 if ( $context->getRequest()->getCheck(
'diff' ) ) {
482 wfDebug( __METHOD__ .
": showing diff page" );
483 $this->showDiffPage();
488 $this->showProtectionIndicator();
490 # Set page title (may be overridden from ParserOutput if title conversion is enabled or DISPLAYTITLE is used)
492 str_replace(
'_',
' ', $this->
getTitle()->getNsText() ),
498 # Allow frames by default
501 $parserOptions = $this->getParserOptions();
504 # Allow extensions to vary parser options used for article rendering
505 (
new HookRunner( MediaWikiServices::getInstance()->getHookContainer() ) )
506 ->onArticleParserOptions( $this, $parserOptions );
507 # Render printable version, use printable version cache
510 $poOptions[
'enableSectionEditLinks'] =
false;
513 $outputPage->
msg(
'printableversion-deprecated-warning' )->escaped()
516 } elseif ( $this->viewIsRenderAction || !$this->isCurrent() ||
517 !$authority->probablyCan(
'edit', $this->getTitle() )
519 $poOptions[
'enableSectionEditLinks'] =
false;
522 # Try client and file cache
523 if ( $oldid === 0 && $this->mPage->checkTouched() ) {
524 # Try to stream the output from file cache
525 if ( $useFileCache && $this->tryFileCache() ) {
526 wfDebug( __METHOD__ .
": done file cache" );
527 # tell wgOut that output is taken care of
529 $this->mPage->doViewUpdates( $authority, $oldid );
535 $this->showRedirectedFromHeader();
536 $this->showNamespaceHeader();
538 if ( $this->viewIsRenderAction ) {
539 $poOptions += [
'absoluteURLs' => true ];
541 $poOptions += [
'includeDebugInfo' => true ];
545 $this->generateContentOutput( $authority, $parserOptions, $oldid, $outputPage, $poOptions );
548 $this->showViewError(
wfMessage(
'badrevision' )->text() );
555 # For the main page, overwrite the <title> element with the con-
556 # tents of 'pagetitle-view-mainpage' instead of the default (if
558 # This message always exists because it is in the i18n files
559 if ( $this->
getTitle()->isMainPage() ) {
560 $msg = $context->msg(
'pagetitle-view-mainpage' )->inContentLanguage();
561 if ( !$msg->isDisabled() ) {
566 # Use adaptive TTLs for CDN so delayed/failed purges are noticed less often.
567 # This could use getTouched(), but that could be scary for major template edits.
568 $outputPage->
adaptCdnTTL( $this->mPage->getTimestamp(), ExpirationAwareness::TTL_DAY );
570 $this->showViewFooter();
571 $this->mPage->doViewUpdates( $authority, $oldid, $this->fetchRevisionRecord() );
573 # Load the postEdit module if the user just saved this revision
574 # See also EditPage::setPostEditCookie
575 $request = $context->getRequest();
576 $cookieKey = EditPage::POST_EDIT_COOKIE_KEY_PREFIX . $this->getRevIdFetched();
577 $postEdit = $request->getCookie( $cookieKey );
579 # Clear the cookie. This also prevents caching of the response.
580 $request->response()->clearCookie( $cookieKey );
582 $outputPage->
addModules(
'mediawiki.action.view.postEdit' );
583 if ( $this->
getContext()->getConfig()->
get( MainConfigNames::EnableEditRecovery )
584 && $this->userOptionsLookup->getOption( $this->getContext()->getUser(),
'editrecovery' )
586 $outputPage->
addModules(
'mediawiki.editRecovery.postEdit' );
599 $protectionIndicatorsAreEnabled = $context->getConfig()
600 ->get( MainConfigNames::EnableProtectionIndicators );
602 if ( !$protectionIndicatorsAreEnabled || $title->isMainPage() ) {
606 $protection = $this->restrictionStore->getRestrictions( $title,
'edit' );
608 $cascadeProtection = $this->restrictionStore->getCascadeProtectionSources( $title )[1];
610 $isCascadeProtected = array_key_exists(
'edit', $cascadeProtection );
612 if ( !$protection && !$isCascadeProtected ) {
616 if ( $isCascadeProtected ) {
620 $protectionLevel = $cascadeProtection[
'edit'][0];
622 $protectionLevel = $protection[0];
629 $protectionLevel = htmlspecialchars( $protectionLevel );
631 $protectionExpiry = $this->restrictionStore->getRestrictionExpiry( $title,
'edit' );
632 $formattedProtectionExpiry = $context->getLanguage()
633 ->formatExpiry( $protectionExpiry ??
'' );
635 $protectionMsg =
'protection-indicator-title';
636 if ( $protectionExpiry ===
'infinity' || !$protectionExpiry ) {
637 $protectionMsg .=
'-infinity';
645 $protectionIndicatorId =
'protection-' . $protectionLevel;
646 $protectionIndicatorId .= ( $isCascadeProtected ?
'-cascade' :
'' );
649 $protectionMsg = $outputPage->
msg( $protectionMsg, $protectionLevel, $formattedProtectionExpiry )->text();
653 $protectionHelpLink = $outputPage->
msg( $protectionIndicatorId .
'-helppage' );
654 if ( $protectionHelpLink->isDisabled() ) {
655 $protectionHelpLink =
'https://mediawiki.org/wiki/Special:MyLanguage/Help:Protection';
657 $protectionHelpLink = $protectionHelpLink->text();
661 $protectionIndicatorId => Html::rawElement(
'a', [
662 'class' =>
'mw-protection-indicator-icon--lock',
663 'title' => $protectionMsg,
664 'href' => $protectionHelpLink
668 Html::element(
'span', [], $protectionMsg ) )
671 $outputPage->
addModuleStyles(
'mediawiki.protectionIndicators.styles' );
686 private function generateContentOutput(
693 # Should the parser cache be used?
694 $useParserCache = true;
696 $parserOutputAccess = MediaWikiServices::getInstance()->getParserOutputAccess();
699 $this->getHookRunner()->onArticleViewHeader( $this, $outputDone, $useParserCache );
702 $pOutput = $outputDone;
706 $this->doOutputMetaData( $pOutput, $outputPage );
712 if ( !$this->mPage->exists() ) {
713 wfDebug( __METHOD__ .
": showing missing article" );
714 $this->showMissingArticle();
715 $this->mPage->doViewUpdates( $performer );
721 if ( $useParserCache && !$oldid ) {
722 $pOutput = $parserOutputAccess->getCachedParserOutput(
726 ParserOutputAccess::OPT_NO_AUDIENCE_CHECK
730 $this->doOutputFromParserCache( $pOutput, $outputPage, $textOptions );
731 $this->doOutputMetaData( $pOutput, $outputPage );
736 $rev = $this->fetchRevisionRecord();
737 if ( !$this->fetchResult->isOK() ) {
738 $this->showViewError( $this->fetchResult->getWikiText(
739 false,
false, $this->getContext()->getLanguage()
744 # Are we looking at an old revision
746 $this->setOldSubtitle( $oldid );
748 if ( !$this->showDeletedRevisionHeader() ) {
749 wfDebug( __METHOD__ .
": cannot view deleted revision" );
756 if ( $useParserCache ) {
757 $pOutput = $parserOutputAccess->getCachedParserOutput(
761 ParserOutputAccess::OPT_NO_AUDIENCE_CHECK
765 $this->doOutputFromParserCache( $pOutput, $outputPage, $textOptions );
766 $this->doOutputMetaData( $pOutput, $outputPage );
772 # Ensure that UI elements requiring revision ID have
773 # the correct version information. (This may be overwritten after creation of ParserOutput)
776 # Preload timestamp to avoid a DB hit
779 # Pages containing custom CSS or JavaScript get special treatment
780 if ( $this->
getTitle()->isSiteConfigPage() || $this->
getTitle()->isUserConfigPage() ) {
781 $dir = $this->
getContext()->getLanguage()->getDir();
782 $lang = $this->
getContext()->getLanguage()->getHtmlCode();
785 "<div id='mw-clearyourcache' lang='$lang' dir='$dir' class='mw-content-$dir'>\n$1\n</div>",
789 } elseif ( !$this->getHookRunner()->onArticleRevisionViewCustom(
797 $this->doOutputMetaData( $pOutput, $outputPage );
801 # Run the parse, protected by a pool counter
802 wfDebug( __METHOD__ .
": doing uncached parse" );
807 $opt |= ParserOutputAccess::OPT_NO_CHECK_CACHE;
810 $opt |= ParserOutputAccess::OPT_NO_AUDIENCE_CHECK;
813 $opt |= ParserOutputAccess::OPT_FOR_ARTICLE_VIEW;
818 $opt |= ParserOutputAccess::OPT_LINKS_UPDATE;
820 if ( !$rev->
getId() || !$useParserCache ) {
822 $opt |= ParserOutputAccess::OPT_NO_CACHE;
825 $renderStatus = $parserOutputAccess->getParserOutput(
847 if ( $oldid === 0 || $oldid === $this->getPage()->getLatest() ) {
848 $parsoidCacheWarmingEnabled = $this->
getContext()->getConfig()
849 ->get( MainConfigNames::ParsoidCacheConfig )[
'WarmParsoidParserCache'];
851 if ( $parsoidCacheWarmingEnabled ) {
854 $this->getPage()->toPageRecord(),
855 [
'causeAction' =>
'view' ]
857 $this->jobQueueGroup->lazyPush( $parsoidJobSpec );
861 $this->doOutputFromRenderStatus(
868 if ( !$renderStatus->
isOK() ) {
872 $pOutput = $renderStatus->
getValue();
873 $this->doOutputMetaData( $pOutput, $outputPage );
882 # Adjust title for main page & pages with displaytitle
884 $this->adjustDisplayTitle( $pOutput );
896 # Check for any __NOINDEX__ tags on the page using $pOutput
897 $policy = $this->getRobotPolicy(
'view', $pOutput ?: null );
901 $this->mParserOutput = $pOutput;
909 private function doOutputFromParserCache(
914 # Ensure that UI elements requiring revision ID have
915 # the correct version information.
920 # Preload timestamp to avoid a DB hit
922 if ( $cachedTimestamp !==
null ) {
924 $this->mPage->setTimestamp( $cachedTimestamp );
934 private function doOutputFromRenderStatus(
941 if ( !$renderStatus->
isOK() ) {
943 false,
'view-pool-error', $context->getLanguage()
948 $pOutput = $renderStatus->
getValue();
951 if ( $renderStatus->
hasMessage(
'view-pool-dirty-output' ) ) {
952 $outputPage->
lowerCdnMaxage( $context->getConfig()->get( MainConfigNames::CdnMaxageStale ) );
954 $staleReason = $renderStatus->
hasMessage(
'view-pool-contention' )
955 ? $context->msg(
'view-pool-contention' )->escaped()
956 : $context->msg(
'view-pool-timeout' )->escaped();
957 $outputPage->
addHTML(
"<!-- parser cache is expired, " .
958 "sending anyway due to $staleReason-->\n" );
962 if ( $cachedId !==
null ) {
970 if ( $this->getRevisionRedirectTarget( $rev ) ) {
971 $outputPage->
addSubtitle(
"<span id=\"redirectsub\">" .
972 $context->msg(
'redirectpagesub' )->parse() .
"</span>" );
980 private function getRevisionRedirectTarget(
RevisionRecord $revision ) {
984 $content = $revision->
getContent( SlotRecord::MAIN );
985 return $content ? $content->getRedirectTarget() :
null;
995 # Adjust the title if it was set by displaytitle, -{T|}- or language conversion
997 if ( strval( $titleText ) !==
'' ) {
998 $out->setPageTitle( $titleText );
999 $out->setDisplayTitle( $titleText );
1011 $request = $context->getRequest();
1012 $diff = $request->getVal(
'diff' );
1013 $rcid = $request->getInt(
'rcid' );
1014 $purge = $request->getRawVal(
'action' ) ===
'purge';
1015 $unhide = $request->getInt(
'unhide' ) === 1;
1016 $oldid = $this->getOldID();
1018 $rev = $this->fetchRevisionRecord();
1023 $rev = $this->revisionStore->getRevisionById( $oldid );
1030 $msg = $context->msg(
'difference-missing-revision' )
1039 $services = MediaWikiServices::getInstance();
1041 $contentHandler = $services
1042 ->getContentHandlerFactory()
1043 ->getContentHandler(
1044 $rev->
getSlot( SlotRecord::MAIN, RevisionRecord::RAW )->getModel()
1046 $de = $contentHandler->createDifferenceEngine(
1055 $diffType = $request->getVal(
'diff-type' );
1057 if ( $diffType ===
null ) {
1058 $diffType = $this->userOptionsLookup
1059 ->getOption( $context->getUser(),
'diff-type' );
1061 $de->setExtraQueryParams( [
'diff-type' => $diffType ] );
1064 $de->setSlotDiffOptions( [
1065 'diff-type' => $diffType,
1066 'expand-url' => $this->viewIsRenderAction,
1067 'inline-toggle' =>
true,
1069 $de->showDiffPage( $this->isDiffOnlyView() );
1073 [ , $new ] = $de->mapDiffPrevNext( $oldid, $diff );
1075 $this->mPage->doViewUpdates( $context->getAuthority(), (
int)$new );
1078 $context->getOutput()->addHelpLink(
'Help:Diff' );
1082 return $this->
getContext()->getRequest()->getBool(
1084 $this->userOptionsLookup->getBoolOption( $this->getContext()->getUser(),
'diffonly' )
1097 $mainConfig = $context->getConfig();
1098 $articleRobotPolicies = $mainConfig->get( MainConfigNames::ArticleRobotPolicies );
1099 $namespaceRobotPolicies = $mainConfig->get( MainConfigNames::NamespaceRobotPolicies );
1100 $defaultRobotPolicy = $mainConfig->get( MainConfigNames::DefaultRobotPolicy );
1102 $ns = $title->getNamespace();
1104 # Don't index user and user talk pages for blocked users (T13443)
1106 $specificTarget =
null;
1107 $vagueTarget =
null;
1108 $titleText = $title->getText();
1109 if ( IPUtils::isValid( $titleText ) ) {
1110 $vagueTarget = $titleText;
1112 $specificTarget = $title->getRootText();
1114 if ( $this->blockStore->newFromTarget( $specificTarget, $vagueTarget ) instanceof
DatabaseBlock ) {
1116 'index' =>
'noindex',
1117 'follow' =>
'nofollow'
1122 if ( $this->mPage->getId() === 0 || $this->getOldID() ) {
1123 # Non-articles (special pages etc), and old revisions
1125 'index' =>
'noindex',
1126 'follow' =>
'nofollow'
1128 } elseif ( $context->getOutput()->isPrintable() ) {
1129 # Discourage indexing of printable versions, but encourage following
1131 'index' =>
'noindex',
1132 'follow' =>
'follow'
1134 } elseif ( $context->getRequest()->getInt(
'curid' ) ) {
1135 # For ?curid=x urls, disallow indexing
1137 'index' =>
'noindex',
1138 'follow' =>
'follow'
1142 # Otherwise, construct the policy based on the various config variables.
1143 $policy = self::formatRobotPolicy( $defaultRobotPolicy );
1145 if ( isset( $namespaceRobotPolicies[$ns] ) ) {
1146 # Honour customised robot policies for this namespace
1147 $policy = array_merge(
1149 self::formatRobotPolicy( $namespaceRobotPolicies[$ns] )
1152 if ( $title->canUseNoindex() && $pOutput && $pOutput->
getIndexPolicy() ) {
1153 # __INDEX__ and __NOINDEX__ magic words, if allowed. Incorporates
1154 # a final check that we have really got the parser output.
1155 $policy = array_merge(
1161 if ( isset( $articleRobotPolicies[$title->getPrefixedText()] ) ) {
1162 # (T16900) site config can override user-defined __INDEX__ or __NOINDEX__
1163 $policy = array_merge(
1165 self::formatRobotPolicy( $articleRobotPolicies[$title->getPrefixedText()] )
1180 if ( is_array( $policy ) ) {
1182 } elseif ( !$policy ) {
1187 foreach ( explode(
',', $policy ) as $var ) {
1188 $var = trim( $var );
1189 if ( $var ===
'index' || $var ===
'noindex' ) {
1190 $arr[
'index'] = $var;
1191 } elseif ( $var ===
'follow' || $var ===
'nofollow' ) {
1192 $arr[
'follow'] = $var;
1208 $redirectSources = $context->getConfig()->get( MainConfigNames::RedirectSources );
1210 $request = $context->getRequest();
1211 $rdfrom = $request->getVal(
'rdfrom' );
1214 $query = $request->getValues();
1215 unset( $query[
'rdfrom'] );
1216 unset( $query[
'title'] );
1217 if ( $this->
getTitle()->isRedirect() ) {
1219 $query[
'redirect'] =
'no';
1221 $redirectTargetUrl = $this->
getTitle()->getLinkURL( $query );
1223 if ( isset( $this->mRedirectedFrom ) ) {
1226 if ( $this->getHookRunner()->onArticleViewRedirect( $this ) ) {
1227 $redir = $this->linkRenderer->makeKnownLink(
1228 $this->mRedirectedFrom,
1231 [
'redirect' =>
'no' ]
1234 $outputPage->
addSubtitle(
"<span class=\"mw-redirectedfrom\">" .
1235 $context->msg(
'redirectedfrom' )->rawParams( $redir )->parse()
1241 'wgInternalRedirectTargetUrl' => $redirectTargetUrl,
1243 $outputPage->
addModules(
'mediawiki.action.view.redirect' );
1253 } elseif ( $rdfrom ) {
1256 if ( $redirectSources && preg_match( $redirectSources, $rdfrom ) ) {
1257 $redir = $this->linkRenderer->makeExternalLink( $rdfrom, $rdfrom, $this->
getTitle() );
1258 $outputPage->
addSubtitle(
"<span class=\"mw-redirectedfrom\">" .
1259 $context->msg(
'redirectedfrom' )->rawParams( $redir )->parse()
1264 'wgInternalRedirectTargetUrl' => $redirectTargetUrl,
1266 $outputPage->
addModules(
'mediawiki.action.view.redirect' );
1280 if ( $this->
getTitle()->isTalkPage() && !$this->
getContext()->msg(
'talkpageheader' )->isDisabled() ) {
1281 $this->
getContext()->getOutput()->wrapWikiMsg(
1282 "<div class=\"mw-talkpageheader\">\n$1\n</div>",
1283 [
'talkpageheader' ]
1292 # check if we're displaying a [[User talk:x.x.x.x]] anonymous talk page
1294 && IPUtils::isValid( $this->
getTitle()->getText() )
1296 $this->
getContext()->getOutput()->addWikiMsg(
'anontalkpagetext' );
1300 $patrolFooterShown = $this->showPatrolFooter();
1302 $this->getHookRunner()->onArticleViewFooter( $this, $patrolFooterShown );
1317 $mainConfig = $context->getConfig();
1318 $useNPPatrol = $mainConfig->get( MainConfigNames::UseNPPatrol );
1319 $useRCPatrol = $mainConfig->get( MainConfigNames::UseRCPatrol );
1320 $useFilePatrol = $mainConfig->get( MainConfigNames::UseFilePatrol );
1322 if ( !$this->getHookRunner()->onArticleShowPatrolFooter( $this ) ) {
1327 $user = $context->getUser();
1331 if ( !$context->getAuthority()->probablyCan(
'patrol', $title )
1332 || !( $useRCPatrol || $useNPPatrol
1333 || ( $useFilePatrol && $title->inNamespace(
NS_FILE ) ) )
1339 if ( $this->mRevisionRecord
1340 && !RecentChange::isInRCLifespan( $this->mRevisionRecord->getTimestamp(), 21600 )
1348 $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
1349 $key = $cache->makeKey(
'unpatrollable-page', $title->getArticleID() );
1350 if ( $cache->get( $key ) ) {
1354 $dbr = $this->dbProvider->getReplicaDatabase();
1355 $oldestRevisionRow = $dbr->newSelectQueryBuilder()
1356 ->select( [
'rev_id',
'rev_timestamp' ] )
1357 ->from(
'revision' )
1358 ->where( [
'rev_page' => $title->getArticleID() ] )
1359 ->orderBy( [
'rev_timestamp',
'rev_id' ] )
1360 ->caller( __METHOD__ )->fetchRow();
1361 $oldestRevisionTimestamp = $oldestRevisionRow ? $oldestRevisionRow->rev_timestamp :
false;
1367 $recentPageCreation =
false;
1368 if ( $oldestRevisionTimestamp
1369 && RecentChange::isInRCLifespan( $oldestRevisionTimestamp, 21600 )
1372 $recentPageCreation =
true;
1373 $rc = RecentChange::newFromConds(
1375 'rc_this_oldid' => intval( $oldestRevisionRow->rev_id ),
1383 $markPatrolledMsg = $context->msg(
'markaspatrolledtext' );
1391 $recentFileUpload =
false;
1392 if ( ( !$rc || $rc->getAttribute(
'rc_patrolled' ) ) && $useFilePatrol
1393 && $title->getNamespace() ===
NS_FILE ) {
1395 $newestUploadTimestamp = $dbr->newSelectQueryBuilder()
1396 ->select(
'img_timestamp' )
1398 ->where( [
'img_name' => $title->getDBkey() ] )
1399 ->caller( __METHOD__ )->fetchField();
1400 if ( $newestUploadTimestamp
1401 && RecentChange::isInRCLifespan( $newestUploadTimestamp, 21600 )
1404 $recentFileUpload =
true;
1405 $rc = RecentChange::newFromConds(
1408 'rc_log_type' =>
'upload',
1409 'rc_timestamp' => $newestUploadTimestamp,
1411 'rc_cur_id' => $title->getArticleID()
1417 $markPatrolledMsg = $context->msg(
'markaspatrolledtext-file' );
1422 if ( !$recentPageCreation && !$recentFileUpload ) {
1427 $cache->set( $key,
'1' );
1439 if ( $rc->getAttribute(
'rc_patrolled' ) ) {
1444 $cache->set( $key,
'1' );
1449 if ( $rc->getPerformerIdentity()->equals( $user ) ) {
1456 $outputPage->
addModules(
'mediawiki.misc-authed-curate' );
1458 $link = $this->linkRenderer->makeKnownLink(
1460 new HtmlArmor(
'<button class="cdx-button cdx-button--action-progressive">'
1462 . $markPatrolledMsg->escaped() .
'</button>' ),
1465 'action' =>
'markpatrolled',
1466 'rcid' => $rc->getAttribute(
'rc_id' ),
1471 $outputPage->
addHTML(
"<div class='patrollink' data-mw='interface'>$link</div>" );
1483 $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
1484 $cache->delete( $cache->makeKey(
'unpatrollable-page', $articleID ) );
1493 $send404Code = $context->getConfig()->get( MainConfigNames::Send404Code );
1497 $validUserPage =
false;
1501 $services = MediaWikiServices::getInstance();
1503 $contextUser = $context->getUser();
1505 # Show info in user (talk) namespace. Does the user exist? Is he blocked?
1506 if ( $title->getNamespace() ===
NS_USER
1509 $rootPart = $title->getRootText();
1510 $user = User::newFromName( $rootPart,
false );
1511 $ip = $this->userNameUtils->isIP( $rootPart );
1512 $block = $this->blockStore->newFromTarget( $user, $user );
1514 if ( $user && $user->isRegistered() && $user->isHidden() &&
1515 !$context->getAuthority()->isAllowed(
'hideuser' )
1522 if ( !( $user && $user->isRegistered() ) && !$ip ) {
1524 $outputPage->
addHTML( Html::warningBox(
1525 $context->msg(
'userpage-userdoesnotexist-view',
wfEscapeWikiText( $rootPart ) )->parse(),
1526 'mw-userpage-userdoesnotexist'
1530 LogEventsList::showLogExtract(
1533 Title::makeTitleSafe(
NS_USER, $rootPart ),
1537 'showIfEmpty' =>
false,
1538 'msgKey' => [
'renameuser-renamed-notice', $title->getBaseText() ]
1543 $block->getType() != DatabaseBlock::TYPE_AUTO &&
1545 $block->isSitewide() ||
1546 $services->getPermissionManager()->isBlockedFrom( $user, $title,
true )
1551 LogEventsList::showLogExtract(
1554 $services->getNamespaceInfo()->getCanonicalName(
NS_USER ) .
':' .
1555 $block->getTargetName(),
1559 'showIfEmpty' =>
false,
1561 'blocked-notice-logextract',
1562 $user->getName() # Support GENDER in notice
1566 $validUserPage = !$title->isSubpage();
1568 $validUserPage = !$title->isSubpage();
1572 $this->getHookRunner()->onShowMissingArticle( $this );
1574 # Show delete and move logs if there were any such events.
1575 # The logging query can DOS the site when bots/crawlers cause 404 floods,
1576 # so be careful showing this. 404 pages must be cheap as they are hard to cache.
1577 $dbCache = MediaWikiServices::getInstance()->getMainObjectStash();
1578 $key = $dbCache->makeKey(
'page-recent-delete', md5( $title->getPrefixedText() ) );
1579 $isRegistered = $contextUser->isRegistered();
1580 $sessionExists = $context->getRequest()->getSession()->isPersistent();
1582 if ( $isRegistered || $dbCache->get( $key ) || $sessionExists ) {
1583 $logTypes = [
'delete',
'move',
'protect' ];
1585 $dbr = $this->dbProvider->getReplicaDatabase();
1587 $conds = [ $dbr->expr(
'log_action',
'!=',
'revision' ) ];
1589 $this->getHookRunner()->onArticle__MissingArticleConditions( $conds, $logTypes );
1590 LogEventsList::showLogExtract(
1598 'showIfEmpty' =>
false,
1599 'msgKey' => [ $isRegistered || $sessionExists
1600 ?
'moveddeleted-notice'
1601 :
'moveddeleted-notice-recent'
1607 if ( !$this->mPage->hasViewableContent() && $send404Code && !$validUserPage ) {
1610 $context->getRequest()->response()->statusHeader( 404 );
1614 $policy = $this->getRobotPolicy(
'view' );
1618 $hookResult = $this->getHookRunner()->onBeforeDisplayNoArticleText( $this );
1620 if ( !$hookResult ) {
1624 # Show error message
1625 $oldid = $this->getOldID();
1626 if ( !$oldid && $title->getNamespace() ===
NS_MEDIAWIKI && $title->hasSourceText() ) {
1627 $text = $this->
getTitle()->getDefaultMessageText() ??
'';
1631 $text = $this->getMissingRevisionMsg( $oldid )->plain();
1632 } elseif ( $context->getAuthority()->probablyCan(
'edit', $title ) ) {
1633 $message = $isRegistered ?
'noarticletext' :
'noarticletextanon';
1634 $text = $context->msg( $message )->plain();
1636 $text = $context->msg(
'noarticletext-nopermission' )->plain();
1639 $dir = $context->getLanguage()->getDir();
1640 $lang = $context->getLanguage()->getHtmlCode();
1642 'class' =>
"noarticletext mw-content-$dir",
1645 ] ) .
"\n$text\n</div>" );
1653 private function showViewError(
string $errortext ) {
1669 if ( !$this->mRevisionRecord->isDeleted( RevisionRecord::DELETED_TEXT ) ) {
1675 $titleText = $this->
getTitle()->getPrefixedDBkey();
1677 if ( !$this->mRevisionRecord->userCan(
1678 RevisionRecord::DELETED_TEXT,
1679 $this->getContext()->getAuthority()
1683 $outputPage->
msg(
'rev-deleted-text-permission', $titleText )->parse(),
1691 # Give explanation and add a link to view the revision...
1692 $oldid = intval( $this->getOldID() );
1693 $link = $this->
getTitle()->getFullURL(
"oldid={$oldid}&unhide=1" );
1694 $msg = $this->mRevisionRecord->isDeleted( RevisionRecord::DELETED_RESTRICTED ) ?
1695 'rev-suppressed-text-unhide' :
'rev-deleted-text-unhide';
1698 $outputPage->
msg( $msg, $link )->parse(),
1706 $msg = $this->mRevisionRecord->isDeleted( RevisionRecord::DELETED_RESTRICTED )
1707 ? [
'rev-suppressed-text-view', $titleText ]
1708 : [
'rev-deleted-text-view', $titleText ];
1711 $outputPage->
msg( $msg[0], $msg[1] )->parse(),
1729 if ( !$this->getHookRunner()->onDisplayOldSubtitle( $this, $oldid ) ) {
1734 $unhide = $context->getRequest()->getInt(
'unhide' ) === 1;
1736 # Cascade unhide param in links for easy deletion browsing
1739 $extraParams[
'unhide'] = 1;
1742 if ( $this->mRevisionRecord && $this->mRevisionRecord->getId() === $oldid ) {
1743 $revisionRecord = $this->mRevisionRecord;
1745 $revisionRecord = $this->revisionStore->getRevisionById( $oldid );
1747 if ( !$revisionRecord ) {
1748 throw new LogicException(
'There should be a revision record at this point.' );
1751 $timestamp = $revisionRecord->getTimestamp();
1753 $current = ( $oldid == $this->mPage->getLatest() );
1754 $language = $context->getLanguage();
1755 $user = $context->getUser();
1757 $td = $language->userTimeAndDate( $timestamp, $user );
1758 $tddate = $language->userDate( $timestamp, $user );
1759 $tdtime = $language->userTime( $timestamp, $user );
1761 # Show user links if allowed to see them. If hidden, then show them only if requested...
1762 $userlinks = Linker::revUserTools( $revisionRecord, !$unhide );
1764 $infomsg = $current && !$context->msg(
'revision-info-current' )->isDisabled()
1765 ?
'revision-info-current'
1770 'mediawiki.action.styles',
1771 'mediawiki.interface.helpers.styles'
1774 $revisionUser = $revisionRecord->getUser();
1775 $revisionInfo =
"<div id=\"mw-{$infomsg}\">" .
1776 $context->msg( $infomsg, $td )
1777 ->rawParams( $userlinks )
1779 $revisionRecord->getId(),
1782 $revisionUser ? $revisionUser->getName() :
''
1784 ->rawParams( $this->commentFormatter->formatRevision(
1794 ? $context->msg(
'currentrevisionlink' )->escaped()
1795 : $this->linkRenderer->makeKnownLink(
1797 $context->msg(
'currentrevisionlink' )->text(),
1802 ? $context->msg(
'diff' )->escaped()
1803 : $this->linkRenderer->makeKnownLink(
1805 $context->msg(
'diff' )->text(),
1812 $prevExist = (bool)$this->revisionStore->getPreviousRevision( $revisionRecord );
1813 $prevlink = $prevExist
1814 ? $this->linkRenderer->makeKnownLink(
1816 $context->msg(
'previousrevision' )->text(),
1819 'direction' =>
'prev',
1823 : $context->msg(
'previousrevision' )->escaped();
1824 $prevdiff = $prevExist
1825 ? $this->linkRenderer->makeKnownLink(
1827 $context->msg(
'diff' )->text(),
1834 : $context->msg(
'diff' )->escaped();
1835 $nextlink = $current
1836 ? $context->msg(
'nextrevision' )->escaped()
1837 : $this->linkRenderer->makeKnownLink(
1839 $context->msg(
'nextrevision' )->text(),
1842 'direction' =>
'next',
1846 $nextdiff = $current
1847 ? $context->msg(
'diff' )->escaped()
1848 : $this->linkRenderer->makeKnownLink(
1850 $context->msg(
'diff' )->text(),
1858 $cdel = Linker::getRevDeleteLink(
1859 $context->getAuthority(),
1863 if ( $cdel !==
'' ) {
1871 "<div id=\"mw-revision-nav\">" . $cdel .
1872 $context->msg(
'revision-nav' )->rawParams(
1873 $prevdiff, $prevlink, $lnk, $curdiff, $nextlink, $nextdiff
1874 )->escaped() .
"</div>",
1895 $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
1909 $msg = $out->msg(
'namespace-' . $this->
getTitle()->getNamespace() .
'-helppage' );
1911 if ( !$msg->isDisabled() ) {
1912 $title = Title::newFromText( $msg->plain() );
1913 if ( $title instanceof
Title ) {
1914 $out->addHelpLink( $title->getLocalURL(),
true );
1917 $out->addHelpLink( $to, $overrideBaseUrl );
1925 $this->
getContext()->getRequest()->response()->header(
'X-Robots-Tag: noindex' );
1926 $this->
getContext()->getOutput()->setArticleBodyOnly(
true );
1928 $this->viewIsRenderAction =
true;
1957 static $called =
false;
1960 wfDebug(
"Article::tryFileCache(): called twice!?" );
1965 if ( $this->isFileCacheable() ) {
1967 if ( $cache->isCacheGood( $this->mPage->getTouched() ) ) {
1968 wfDebug(
"Article::tryFileCache(): about to load file" );
1969 $cache->loadFromFileCache( $this->
getContext() );
1972 wfDebug(
"Article::tryFileCache(): starting buffer" );
1973 ob_start( [ &$cache,
'saveToFileCache' ] );
1976 wfDebug(
"Article::tryFileCache(): not cacheable" );
1990 if ( HTMLFileCache::useFileCache( $this->
getContext(), $mode ) ) {
1991 $cacheable = $this->mPage->getId()
1992 && !$this->mRedirectedFrom && !$this->
getTitle()->isRedirect();
1995 $cacheable = $this->getHookRunner()->onIsFileCacheable( $this ) ??
false;
2014 if ( $user ===
null ) {
2015 $parserOptions = $this->getParserOptions();
2017 $parserOptions = $this->mPage->makeParserOptions( $user );
2021 return $this->mPage->getParserOutput( $parserOptions, $oldid );
2029 $parserOptions = $this->mPage->makeParserOptions( $this->
getContext() );
2031 return $parserOptions;
2041 $this->mContext = $context;
2052 return $this->mContext;
2054 wfDebug( __METHOD__ .
" called and \$mContext is null. " .
2055 "Return RequestContext::getMain()" );
2056 return RequestContext::getMain();
2066 return $this->mPage->getActionOverrides();
2069 private function getMissingRevisionMsg(
int $oldid ):
Message {
2074 $revRecord = $this->archivedRevisionLookup->getArchivedRevisionRecord(
null, $oldid );
2077 $revRecord->userCan(
2078 RevisionRecord::DELETED_TEXT,
2079 $context->getAuthority()
2081 $context->getAuthority()->isAllowedAny(
'deletedtext',
'undelete' )
2083 return $context->msg(
2084 'missing-revision-permission',
2086 $revRecord->getTimestamp(),
2087 Title::newFromPageIdentity( $revRecord->getPage() )->getPrefixedDBkey()
2090 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)
getRobotPolicy( $action, ParserOutput $pOutput=null)
Get the robot policy to be used for the current view.
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.
getParserOutput( $oldid=null, UserIdentity $user=null)
Lightweight method to get the parser output for a page, checking the parser cache and so on.
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.
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.
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...
setIndexPolicy( $policy)
Set the index policy for the page, but leave the follow policy un- touched.
setPreventClickjacking(bool $enable)
Set the prevent-clickjacking flag.
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.
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>>.
addWikiTextAsContent( $text, $linestart=true, PageReference $title=null)
Convert wikitext in the page content language to HTML and add it to the buffer.
addHTML( $text)
Append $text to the body HTML.
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.
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...
addWikiTextAsInterface( $text, $linestart=true, PageReference $title=null)
Convert wikitext in the user interface language to HTML and add it to the buffer.
Service for getting rendered output of a given page.
Handles the page protection UI and backend.
Service for creating WikiPage objects.
Set options of the Parser.
setIsPrintable( $x)
Parsing the printable version of the page?
setRenderReason(string $renderReason)
Sets reason for rendering the content.
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)