131 $this->mOldId = $oldId;
132 $this->mPage = $this->
newPage( $title );
149 $t = Title::newFromID( $id );
150 return $t ==
null ? null :
new static(
$t );
161 if (
NS_MEDIA == $title->getNamespace() ) {
163 $title = Title::makeTitle(
NS_FILE, $title->getDBkey() );
167 Hooks::run(
'ArticleFromTitle', [ &$title, &$page,
$context ] );
169 switch ( $title->getNamespace() ) {
194 $article->mPage = $page;
213 $this->mRedirectedFrom = $from;
222 return $this->mPage->getTitle();
239 $this->mContentLoaded =
false;
241 $this->mRedirectedFrom =
null; #
Title object if set
242 $this->mRevIdFetched = 0;
243 $this->mRedirectUrl =
false;
244 $this->mRevision =
null;
245 $this->mContentObject =
null;
246 $this->fetchResult =
null;
250 $this->mPage->clear();
271 if ( $this->mPage->getId() === 0 ) {
287 # If this is a MediaWiki:x message, then load the messages
288 # and return the message value for x.
289 if ( $this->
getTitle()->getNamespace() == NS_MEDIAWIKI ) {
290 $text = $this->
getTitle()->getDefaultMessageText();
291 if ( $text ===
false ) {
297 $message = $this->
getContext()->getUser()->isLoggedIn() ?
'noarticletext' :
'noarticletextanon';
327 if ( is_null( $this->mOldId ) ) {
340 $this->mRedirectUrl =
false;
343 $oldid =
$request->getIntOrNull(
'oldid' );
345 if ( $oldid ===
null ) {
349 if ( $oldid !== 0 ) {
350 # Load the given revision and check whether the page is another one.
351 # In that case, update this instance to reflect the change.
352 if ( $oldid === $this->mPage->getLatest() ) {
353 $this->mRevision = $this->mPage->getRevision();
356 if ( $this->mRevision !==
null ) {
358 if ( $this->mPage->getId() != $this->mRevision->getPage() ) {
359 $function = get_class( $this->mPage ) .
'::newFromID';
360 $this->mPage = $function( $this->mRevision->getPage() );
366 if (
$request->getVal(
'direction' ) ==
'next' ) {
367 $nextid = $this->
getTitle()->getNextRevisionID( $oldid );
370 $this->mRevision =
null;
372 $this->mRedirectUrl = $this->
getTitle()->getFullURL(
'redirect=no' );
374 } elseif (
$request->getVal(
'direction' ) ==
'prev' ) {
375 $previd = $this->
getTitle()->getPreviousRevisionID( $oldid );
378 $this->mRevision =
null;
382 $this->mRevIdFetched = $this->mRevision ? $this->mRevision->getId() : 0;
401 if ( !$this->mContentLoaded ) {
418 if ( $this->fetchResult ) {
419 return $this->mRevision ? $this->mRevision->getRevisionRecord() :
null;
422 $this->mContentLoaded =
true;
423 $this->mContentObject =
null;
428 if ( !$this->mRevision ) {
430 $this->mRevision = $this->mPage->getRevision();
432 if ( !$this->mRevision ) {
433 wfDebug( __METHOD__ .
" failed to find page data for title " .
434 $this->
getTitle()->getPrefixedText() .
"\n" );
437 $this->fetchResult = Status::newFatal(
'noarticletext' );
444 if ( !$this->mRevision ) {
445 wfDebug( __METHOD__ .
" failed to load revision, rev_id $oldid\n" );
447 $this->fetchResult = Status::newFatal(
'missing-revision', $oldid );
454 $this->mRevIdFetched = $this->mRevision->getId();
455 $this->fetchResult = Status::newGood( $this->mRevision );
458 wfDebug( __METHOD__ .
" failed to retrieve content of revision " .
459 $this->mRevision->getId() .
"\n" );
462 $this->fetchResult = Status::newFatal(
'rev-deleted-text-permission' );
467 if ( Hooks::isRegistered(
'ArticleAfterFetchContentObject' ) ) {
468 $contentObject = $this->mRevision->getContent(
473 $hookContentObject = $contentObject;
476 $articlePage = $this;
479 'ArticleAfterFetchContentObject',
480 [ &$articlePage, &$hookContentObject ],
484 if ( $hookContentObject !== $contentObject ) {
491 $this->mContentObject = $this->mRevision->getContent(
496 return $this->mRevision->getRevisionRecord();
506 if ( !$this->fetchResult || $this->fetchResult->isOK() ) {
528 $rev->setContent( SlotRecord::MAIN, $override );
533 $this->mContentObject = $override;
542 # If no oldid, this is the current version.
547 return $this->mPage->exists() && $this->mRevision && $this->mRevision->isCurrent();
562 if ( $this->fetchResult->isOK() ) {
576 if ( $this->fetchResult && $this->fetchResult->isOK() ) {
577 return $this->fetchResult->value->getId();
579 return $this->mPage->getLatest();
590 # Get variables from query string
591 # As side effect this will load the revision and update the title
592 # in a revision ID is passed in the request, so this should remain
593 # the first call of this method even if $oldid is used way below.
597 # Another whitelist check in case getOldID() is altering the title
598 $permErrors = $this->
getTitle()->getUserPermissionsErrors(
'read', $user );
599 if ( count( $permErrors ) ) {
600 wfDebug( __METHOD__ .
": denied on secondary read check\n" );
604 $outputPage = $this->
getContext()->getOutput();
605 # getOldID() may as well want us to redirect somewhere else
606 if ( $this->mRedirectUrl ) {
607 $outputPage->redirect( $this->mRedirectUrl );
608 wfDebug( __METHOD__ .
": redirecting due to oldid\n" );
613 # If we got diff in the query, we want to see a diff page instead of the article.
614 if ( $this->
getContext()->getRequest()->getCheck(
'diff' ) ) {
615 wfDebug( __METHOD__ .
": showing diff page\n" );
621 # Set page title (may be overridden by DISPLAYTITLE)
622 $outputPage->setPageTitle( $this->
getTitle()->getPrefixedText() );
624 $outputPage->setArticleFlag(
true );
625 # Allow frames by default
626 $outputPage->allowClickjacking();
628 $parserCache = MediaWikiServices::getInstance()->getParserCache();
632 # Render printable version, use printable version cache
633 if ( $outputPage->isPrintable() ) {
634 $parserOptions->setIsPrintable(
true );
635 $poOptions[
'enableSectionEditLinks'] =
false;
636 } elseif ( $this->disableSectionEditForRender
639 $poOptions[
'enableSectionEditLinks'] =
false;
642 # Try client and file cache
643 if ( !
$wgDebugToolbar && $oldid === 0 && $this->mPage->checkTouched() ) {
644 # Try to stream the output from file cache
646 wfDebug( __METHOD__ .
": done file cache\n" );
647 # tell wgOut that output is taken care of
648 $outputPage->disable();
649 $this->mPage->doViewUpdates( $user, $oldid );
655 # Should the parser cache be used?
656 $useParserCache = $this->mPage->shouldCheckParserCache( $parserOptions, $oldid );
657 wfDebug(
'Article::view using parser cache: ' . ( $useParserCache ?
'yes' :
'no' ) .
"\n" );
658 if ( $user->getStubThreshold() ) {
659 MediaWikiServices::getInstance()->getStatsdDataFactory()->increment(
'pcache_miss_stub' );
665 # Iterate through the possible ways of constructing the output text.
666 # Keep going until $outputDone is set, or we run out of things to do.
669 $this->mParserOutput =
false;
671 while ( !$outputDone && ++$pass ) {
675 $articlePage = $this;
676 Hooks::run(
'ArticleViewHeader', [ &$articlePage, &$outputDone, &$useParserCache ] );
679 # Early abort if the page doesn't exist
680 if ( !$this->mPage->exists() ) {
681 wfDebug( __METHOD__ .
": showing missing article\n" );
683 $this->mPage->doViewUpdates( $user );
687 # Try the parser cache
688 if ( $useParserCache ) {
689 $this->mParserOutput = $parserCache->get( $this->mPage, $parserOptions );
691 if ( $this->mParserOutput !==
false ) {
693 wfDebug( __METHOD__ .
": showing parser cache contents for current rev permalink\n" );
696 wfDebug( __METHOD__ .
": showing parser cache contents\n" );
698 $outputPage->addParserOutput( $this->mParserOutput, $poOptions );
699 # Ensure that UI elements requiring revision ID have
700 # the correct version information.
701 $outputPage->setRevisionId( $this->mPage->getLatest() );
702 # Preload timestamp to avoid a DB hit
703 $cachedTimestamp = $this->mParserOutput->getTimestamp();
704 if ( $cachedTimestamp !==
null ) {
705 $outputPage->setRevisionTimestamp( $cachedTimestamp );
706 $this->mPage->setTimestamp( $cachedTimestamp );
713 # Are we looking at an old revision
715 if ( $oldid && $this->fetchResult->isOK() ) {
719 wfDebug( __METHOD__ .
": cannot view deleted revision\n" );
724 # Ensure that UI elements requiring revision ID have
725 # the correct version information.
727 # Preload timestamp to avoid a DB hit
728 $outputPage->setRevisionTimestamp( $this->mPage->getTimestamp() );
730 # Pages containing custom CSS or JavaScript get special treatment
731 if ( $this->
getTitle()->isSiteConfigPage() || $this->
getTitle()->isUserConfigPage() ) {
732 $dir = $this->
getContext()->getLanguage()->getDir();
735 $outputPage->wrapWikiMsg(
736 "<div id='mw-clearyourcache' lang='$lang' dir='$dir' class='mw-content-$dir'>\n$1\n</div>",
739 } elseif ( !Hooks::run(
'ArticleRevisionViewCustom', [
749 } elseif ( !Hooks::run(
'ArticleContentViewCustom',
758 # Run the parse, protected by a pool counter
759 wfDebug( __METHOD__ .
": doing uncached parse\n" );
774 $ok = $poolArticleView->execute();
775 $error = $poolArticleView->getError();
776 $this->mParserOutput = $poolArticleView->getParserOutput() ?:
null;
778 # Don't cache a dirty ParserOutput object
779 if ( $poolArticleView->getIsDirty() ) {
780 $outputPage->setCdnMaxage( 0 );
781 $outputPage->addHTML(
"<!-- parser cache is expired, " .
782 "sending anyway due to pool overload-->\n" );
790 $outputPage->clearHTML();
791 $outputPage->enableClientCache(
false );
792 $outputPage->setRobotPolicy(
'noindex,nofollow' );
794 $errortext = $error->getWikiText(
false,
'view-pool-error' );
795 $outputPage->addWikiText( Html::errorBox( $errortext ) );
797 # Connection or timeout error
801 if ( $this->mParserOutput ) {
802 $outputPage->addParserOutput( $this->mParserOutput, $poOptions );
806 $outputPage->addSubtitle(
"<span id=\"redirectsub\">" .
807 $this->
getContext()->msg(
'redirectpagesub' )->parse() .
"</span>" );
812 # Should be unreachable, but just in case...
825 : $this->mParserOutput ?:
null;
827 # Adjust title for main page & pages with displaytitle
832 # For the main page, overwrite the <title> element with the con-
833 # tents of 'pagetitle-view-mainpage' instead of the default (if
835 # This message always exists because it is in the i18n files
836 if ( $this->
getTitle()->isMainPage() ) {
837 $msg =
wfMessage(
'pagetitle-view-mainpage' )->inContentLanguage();
838 if ( !$msg->isDisabled() ) {
839 $outputPage->setHTMLTitle( $msg->title( $this->getTitle() )->text() );
843 # Use adaptive TTLs for CDN so delayed/failed purges are noticed less often.
844 # This could use getTouched(), but that could be scary for major template edits.
845 $outputPage->adaptCdnTTL( $this->mPage->getTimestamp(), IExpiringStore::TTL_DAY );
847 # Check for any __NOINDEX__ tags on the page using $pOutput
849 $outputPage->setIndexPolicy( $policy[
'index'] );
850 $outputPage->setFollowPolicy( $policy[
'follow'] );
853 $this->mPage->doViewUpdates( $user, $oldid );
855 # Load the postEdit module if the user just saved this revision
856 # See also EditPage::setPostEditCookie
859 $postEdit =
$request->getCookie( $cookieKey );
861 # Clear the cookie. This also prevents caching of the response.
862 $request->response()->clearCookie( $cookieKey );
863 $outputPage->addJsConfigVars(
'wgPostEdit', $postEdit );
864 $outputPage->addModules(
'mediawiki.action.view.postEdit' );
887 # Adjust the title if it was set by displaytitle, -{T|}- or language conversion
888 $titleText = $pOutput->getTitleText();
889 if ( strval( $titleText ) !==
'' ) {
890 $out->setPageTitle( $titleText );
891 $out->setDisplayTitle( $titleText );
904 $diffOnly =
$request->getBool(
'diffonly', $user->getOption(
'diffonly' ) );
905 $purge =
$request->getVal(
'action' ) ==
'purge';
913 $msg = $this->
getContext()->msg(
'difference-missing-revision' )
917 $this->
getContext()->getOutput()->addHTML( $msg );
921 $contentHandler =
$rev->getContentHandler();
922 $de = $contentHandler->createDifferenceEngine(
932 $this->mRevIdFetched = $de->getNewid();
933 $de->showDiffPage( $diffOnly );
937 list( $old, $new ) = $de->mapDiffPrevNext( $oldid, $diff );
939 $this->mPage->doViewUpdates( $user, (
int)$new );
952 $ns = $this->
getTitle()->getNamespace();
954 # Don't index user and user talk pages for blocked users (T13443)
956 $specificTarget =
null;
958 $titleText = $this->
getTitle()->getText();
959 if ( IP::isValid( $titleText ) ) {
960 $vagueTarget = $titleText;
962 $specificTarget = $titleText;
966 'index' =>
'noindex',
967 'follow' =>
'nofollow'
972 if ( $this->mPage->getId() === 0 || $this->getOldID() ) {
973 # Non-articles (special pages etc), and old revisions
975 'index' =>
'noindex',
976 'follow' =>
'nofollow'
978 } elseif ( $this->
getContext()->getOutput()->isPrintable() ) {
979 # Discourage indexing of printable versions, but encourage following
981 'index' =>
'noindex',
984 } elseif ( $this->
getContext()->getRequest()->getInt(
'curid' ) ) {
985 # For ?curid=x urls, disallow indexing
987 'index' =>
'noindex',
992 # Otherwise, construct the policy based on the various config variables.
996 # Honour customised robot policies for this namespace
997 $policy = array_merge(
1002 if ( $this->
getTitle()->canUseNoindex() && is_object( $pOutput ) && $pOutput->getIndexPolicy() ) {
1003 # __INDEX__ and __NOINDEX__ magic words, if allowed. Incorporates
1004 # a final sanity check that we have really got the parser output.
1005 $policy = array_merge(
1007 [
'index' => $pOutput->getIndexPolicy() ]
1012 # (T16900) site config can override user-defined __INDEX__ or __NOINDEX__
1013 $policy = array_merge(
1030 if ( is_array( $policy ) ) {
1032 } elseif ( !$policy ) {
1036 $policy = explode(
',', $policy );
1037 $policy = array_map(
'trim', $policy );
1040 foreach ( $policy as $var ) {
1041 if ( in_array( $var, [
'index',
'noindex' ] ) ) {
1042 $arr[
'index'] = $var;
1043 } elseif ( in_array( $var, [
'follow',
'nofollow' ] ) ) {
1044 $arr[
'follow'] = $var;
1062 $outputPage =
$context->getOutput();
1064 $rdfrom =
$request->getVal(
'rdfrom' );
1068 unset(
$query[
'rdfrom'] );
1069 unset(
$query[
'title'] );
1072 $query[
'redirect'] =
'no';
1076 if ( isset( $this->mRedirectedFrom ) ) {
1078 $articlePage = $this;
1082 if ( Hooks::run(
'ArticleViewRedirect', [ &$articlePage ] ) ) {
1084 $this->mRedirectedFrom,
1087 [
'redirect' =>
'no' ]
1090 $outputPage->addSubtitle(
"<span class=\"mw-redirectedfrom\">" .
1091 $context->msg(
'redirectedfrom' )->rawParams( $redir )->parse()
1096 $outputPage->addJsConfigVars( [
1097 'wgInternalRedirectTargetUrl' => $redirectTargetUrl,
1099 $outputPage->addModules(
'mediawiki.action.view.redirect' );
1102 $outputPage->setCanonicalUrl( $this->
getTitle()->getCanonicalURL() );
1105 $outputPage->setRedirectedFrom( $this->mRedirectedFrom );
1109 } elseif ( $rdfrom ) {
1114 $outputPage->addSubtitle(
"<span class=\"mw-redirectedfrom\">" .
1115 $context->msg(
'redirectedfrom' )->rawParams( $redir )->parse()
1119 $outputPage->addJsConfigVars( [
1120 'wgInternalRedirectTargetUrl' => $redirectTargetUrl,
1122 $outputPage->addModules(
'mediawiki.action.view.redirect' );
1136 if ( $this->
getTitle()->isTalkPage() ) {
1137 if ( !
wfMessage(
'talkpageheader' )->isDisabled() ) {
1138 $this->
getContext()->getOutput()->wrapWikiMsg(
1139 "<div class=\"mw-talkpageheader\">\n$1\n</div>",
1140 [
'talkpageheader' ]
1150 # check if we're displaying a [[User talk:x.x.x.x]] anonymous talk page
1152 && IP::isValid( $this->
getTitle()->getText() )
1154 $this->
getContext()->getOutput()->addWikiMsg(
'anontalkpagetext' );
1160 Hooks::run(
'ArticleViewFooter', [ $this, $patrolFooterShown ] );
1176 if ( !Hooks::run(
'ArticleShowPatrolFooter', [ $this ] ) ) {
1180 $outputPage = $this->
getContext()->getOutput();
1185 if ( !$title->quickUserCan(
'patrol', $user )
1193 if ( $this->mRevision
1194 && !RecentChange::isInRCLifespan( $this->mRevision->getTimestamp(), 21600 )
1202 $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
1203 $key =
$cache->makeKey(
'unpatrollable-page', $title->getArticleID() );
1204 if (
$cache->get( $key ) ) {
1209 $oldestRevisionTimestamp =
$dbr->selectField(
1211 'MIN( rev_timestamp )',
1212 [
'rev_page' => $title->getArticleID() ],
1221 $recentPageCreation =
false;
1222 if ( $oldestRevisionTimestamp
1223 && RecentChange::isInRCLifespan( $oldestRevisionTimestamp, 21600 )
1226 $recentPageCreation =
true;
1227 $rc = RecentChange::newFromConds(
1230 'rc_timestamp' => $oldestRevisionTimestamp,
1231 'rc_namespace' => $title->getNamespace(),
1232 'rc_cur_id' => $title->getArticleID()
1238 $markPatrolledMsg =
wfMessage(
'markaspatrolledtext' );
1246 $recentFileUpload =
false;
1248 && $title->getNamespace() ===
NS_FILE ) {
1250 $newestUploadTimestamp =
$dbr->selectField(
1252 'MAX( img_timestamp )',
1253 [
'img_name' => $title->getDBkey() ],
1256 if ( $newestUploadTimestamp
1257 && RecentChange::isInRCLifespan( $newestUploadTimestamp, 21600 )
1260 $recentFileUpload =
true;
1261 $rc = RecentChange::newFromConds(
1264 'rc_log_type' =>
'upload',
1265 'rc_timestamp' => $newestUploadTimestamp,
1267 'rc_cur_id' => $title->getArticleID()
1273 $markPatrolledMsg =
wfMessage(
'markaspatrolledtext-file' );
1278 if ( !$recentPageCreation && !$recentFileUpload ) {
1283 $cache->set( $key,
'1' );
1295 if ( $rc->getAttribute(
'rc_patrolled' ) ) {
1300 $cache->set( $key,
'1' );
1305 if ( $rc->getPerformer()->equals( $user ) ) {
1311 $outputPage->preventClickjacking();
1312 if ( $user->isAllowed(
'writeapi' ) ) {
1313 $outputPage->addModules(
'mediawiki.page.patrol.ajax' );
1318 $markPatrolledMsg->escaped(),
1321 'action' =>
'markpatrolled',
1322 'rcid' => $rc->getAttribute(
'rc_id' ),
1326 $outputPage->addHTML(
1327 "<div class='patrollink' data-mw='interface'>" .
1328 wfMessage(
'markaspatrolledlink' )->rawParams(
$link )->escaped() .
1342 $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
1343 $cache->delete(
$cache->makeKey(
'unpatrollable-page', $articleID ) );
1353 $outputPage = $this->
getContext()->getOutput();
1355 $validUserPage =
false;
1359 # Show info in user (talk) namespace. Does the user exist? Is he blocked?
1360 if ( $title->getNamespace() == NS_USER
1363 $rootPart = explode(
'/', $title->getText() )[0];
1368 if ( !( $user && $user->isLoggedIn() ) && !$ip ) { #
User does not exist
1369 $outputPage->wrapWikiMsg(
"<div class=\"mw-userpage-userdoesnotexist error\">\n\$1\n</div>",
1372 # Show log extract if the user is currently blocked
1376 MWNamespace::getCanonicalName( NS_USER ) .
':' . $block->getTarget(),
1380 'showIfEmpty' =>
false,
1382 'blocked-notice-logextract',
1383 $user->getName() # Support GENDER in notice
1387 $validUserPage = !$title->isSubpage();
1389 $validUserPage = !$title->isSubpage();
1393 Hooks::run(
'ShowMissingArticle', [ $this ] );
1395 # Show delete and move logs if there were any such events.
1396 # The logging query can DOS the site when bots/crawlers cause 404 floods,
1397 # so be careful showing this. 404 pages must be cheap as they are hard to cache.
1398 $cache = MediaWikiServices::getInstance()->getMainObjectStash();
1399 $key =
$cache->makeKey(
'page-recent-delete', md5( $title->getPrefixedText() ) );
1400 $loggedIn = $this->
getContext()->getUser()->isLoggedIn();
1401 $sessionExists = $this->
getContext()->getRequest()->getSession()->isPersistent();
1402 if ( $loggedIn ||
$cache->get( $key ) || $sessionExists ) {
1403 $logTypes = [
'delete',
'move',
'protect' ];
1407 $conds = [
'log_action != ' .
$dbr->addQuotes(
'revision' ) ];
1409 Hooks::run(
'Article::MissingArticleConditions', [ &$conds, $logTypes ] );
1418 'showIfEmpty' =>
false,
1419 'msgKey' => [ $loggedIn || $sessionExists
1420 ?
'moveddeleted-notice'
1421 :
'moveddeleted-notice-recent'
1427 if ( !$this->mPage->hasViewableContent() &&
$wgSend404Code && !$validUserPage ) {
1430 $this->
getContext()->getRequest()->response()->statusHeader( 404 );
1435 $outputPage->setIndexPolicy( $policy[
'index'] );
1436 $outputPage->setFollowPolicy( $policy[
'follow'] );
1438 $hookResult = Hooks::run(
'BeforeDisplayNoArticleText', [ $this ] );
1440 if ( !$hookResult ) {
1444 # Show error message
1446 if ( !$oldid && $title->getNamespace() === NS_MEDIAWIKI && $title->hasSourceText() ) {
1448 $parserOptions = ParserOptions::newCanonical(
'canonical' );
1452 $text =
wfMessage(
'missing-revision', $oldid )->plain();
1453 } elseif ( $title->quickUserCan(
'create', $this->getContext()->getUser() )
1454 && $title->quickUserCan(
'edit', $this->getContext()->getUser() )
1456 $message = $this->
getContext()->getUser()->isLoggedIn() ?
'noarticletext' :
'noarticletextanon';
1459 $text =
wfMessage(
'noarticletext-nopermission' )->plain();
1462 $dir = $this->
getContext()->getLanguage()->getDir();
1464 $outputPage->addWikiText( Xml::openElement(
'div', [
1465 'class' =>
"noarticletext mw-content-$dir",
1468 ] ) .
"\n$text\n</div>" );
1484 $outputPage = $this->
getContext()->getOutput();
1488 $outputPage->wrapWikiMsg(
"<div class='mw-warning plainlinks'>\n$1\n</div>\n",
1489 'rev-deleted-text-permission' );
1493 } elseif ( $this->
getContext()->getRequest()->getInt(
'unhide' ) != 1 ) {
1494 # Give explanation and add a link to view the revision...
1495 $oldid = intval( $this->
getOldID() );
1496 $link = $this->
getTitle()->getFullURL(
"oldid={$oldid}&unhide=1" );
1498 'rev-suppressed-text-unhide' :
'rev-deleted-text-unhide';
1499 $outputPage->wrapWikiMsg(
"<div class='mw-warning plainlinks'>\n$1\n</div>\n",
1506 'rev-suppressed-text-view' :
'rev-deleted-text-view';
1507 $outputPage->wrapWikiMsg(
"<div class='mw-warning plainlinks'>\n$1\n</div>\n", $msg );
1523 $articlePage = $this;
1525 if ( !Hooks::run(
'DisplayOldSubtitle', [ &$articlePage, &$oldid ] ) ) {
1532 # Cascade unhide param in links for easy deletion browsing
1535 $extraParams[
'unhide'] = 1;
1538 if ( $this->mRevision && $this->mRevision->getId() === $oldid ) {
1544 $timestamp = $revision->getTimestamp();
1546 $current = ( $oldid == $this->mPage->getLatest() );
1547 $language =
$context->getLanguage();
1550 $td = $language->userTimeAndDate( $timestamp, $user );
1551 $tddate = $language->userDate( $timestamp, $user );
1552 $tdtime = $language->userTime( $timestamp, $user );
1554 # Show user links if allowed to see them. If hidden, then show them only if requested...
1557 $infomsg = $current && !
$context->msg(
'revision-info-current' )->isDisabled()
1558 ?
'revision-info-current'
1561 $outputPage =
$context->getOutput();
1562 $revisionInfo =
"<div id=\"mw-{$infomsg}\">" .
1564 ->rawParams( $userlinks )
1565 ->params( $revision->getId(), $tddate, $tdtime, $revision->getUserText() )
1571 ?
$context->msg(
'currentrevisionlink' )->escaped()
1574 $context->msg(
'currentrevisionlink' )->escaped(),
1579 ?
$context->msg(
'diff' )->escaped()
1582 $context->msg(
'diff' )->escaped(),
1589 $prev = $this->
getTitle()->getPreviousRevisionID( $oldid );
1593 $context->msg(
'previousrevision' )->escaped(),
1596 'direction' =>
'prev',
1600 :
$context->msg(
'previousrevision' )->escaped();
1604 $context->msg(
'diff' )->escaped(),
1611 :
$context->msg(
'diff' )->escaped();
1612 $nextlink = $current
1613 ?
$context->msg(
'nextrevision' )->escaped()
1616 $context->msg(
'nextrevision' )->escaped(),
1619 'direction' =>
'next',
1623 $nextdiff = $current
1624 ?
$context->msg(
'diff' )->escaped()
1627 $context->msg(
'diff' )->escaped(),
1636 if ( $cdel !==
'' ) {
1641 $outputPage->addSubtitle(
"<div class=\"mw-revision\">" . $revisionInfo .
1642 "<div id=\"mw-revision-nav\">" . $cdel .
1643 $context->msg(
'revision-nav' )->rawParams(
1644 $prevdiff, $prevlink, $lnk, $curdiff, $nextlink, $nextdiff
1645 )->escaped() .
"</div></div>" );
1661 public function viewRedirect( $target, $appendSubtitle =
true, $forceKnown =
false ) {
1664 if ( $appendSubtitle ) {
1667 $out->addModuleStyles(
'mediawiki.action.view.redirectPage' );
1668 return static::getRedirectHeaderHtml(
$lang, $target, $forceKnown );
1684 if ( !is_array( $target ) ) {
1685 $target = [ $target ];
1688 $html =
'<ul class="redirectText">';
1690 foreach ( $target as $title ) {
1693 htmlspecialchars( $title->getFullText() ),
1696 $title->isRedirect() ? [
'redirect' =>
'no' ] : [],
1697 ( $forceKnown ? [
'known',
'noclasses' ] : [] )
1702 $redirectToText =
wfMessage(
'redirectto' )->inLanguage(
$lang )->escaped();
1704 return '<div class="redirectMsg">' .
1705 '<p>' . $redirectToText .
'</p>' .
1720 'namespace-' . $this->
getTitle()->getNamespace() .
'-helppage'
1724 if ( !$msg->isDisabled() ) {
1725 $helpUrl = Skin::makeUrl( $msg->plain() );
1726 $out->addHelpLink( $helpUrl,
true );
1728 $out->addHelpLink( $to, $overrideBaseUrl );
1736 $this->
getContext()->getRequest()->response()->header(
'X-Robots-Tag: noindex' );
1737 $this->
getContext()->getOutput()->setArticleBodyOnly(
true );
1738 $this->disableSectionEditForRender =
true;
1760 public function delete() {
1761 # This code desperately needs to be totally rewritten
1769 $permissionErrors = $title->getUserPermissionsErrors(
'delete', $user );
1770 if ( count( $permissionErrors ) ) {
1774 # Read-only check...
1779 # Better double-check that it hasn't been deleted yet!
1780 $this->mPage->loadPageData(
1781 $request->wasPosted() ? WikiPage::READ_LATEST : WikiPage::READ_NORMAL
1783 if ( !$this->mPage->exists() ) {
1784 $deleteLogPage =
new LogPage(
'delete' );
1785 $outputPage =
$context->getOutput();
1786 $outputPage->setPageTitle(
$context->msg(
'cannotdelete-title', $title->getPrefixedText() ) );
1787 $outputPage->wrapWikiMsg(
"<div class=\"error mw-error-cannotdelete\">\n$1\n</div>",
1790 $outputPage->addHTML(
1791 Xml::element(
'h2',
null, $deleteLogPage->getName()->text() )
1802 $deleteReasonList =
$request->getText(
'wpDeleteReasonList',
'other' );
1803 $deleteReason =
$request->getText(
'wpReason' );
1805 if ( $deleteReasonList ==
'other' ) {
1806 $reason = $deleteReason;
1807 } elseif ( $deleteReason !=
'' ) {
1809 $colonseparator =
wfMessage(
'colon-separator' )->inContentLanguage()->text();
1810 $reason = $deleteReasonList . $colonseparator . $deleteReason;
1812 $reason = $deleteReasonList;
1815 if (
$request->wasPosted() && $user->matchEditToken(
$request->getVal(
'wpEditToken' ),
1816 [
'delete', $this->getTitle()->getPrefixedText() ] )
1818 # Flag to hide all contents of the archived revisions
1819 $suppress =
$request->getCheck(
'wpSuppress' ) && $user->isAllowed(
'suppressrevision' );
1821 $this->
doDelete( $reason, $suppress );
1829 $hasHistory =
false;
1833 }
catch ( Exception
$e ) {
1834 # if a page is horribly broken, we still want to be able to
1835 # delete it. So be lenient about errors here.
1836 wfDebug(
"Error while building auto delete summary: $e" );
1842 if ( $hasHistory ) {
1851 $revisions = $edits = (int)
$dbr->selectField(
1854 [
'rev_page' => $title->getArticleID() ],
1860 '<strong class="mw-delete-warning-revisions">' .
1861 $context->msg(
'historywarning' )->numParams( $revisions )->parse() .
1863 $context->msg(
'history' )->escaped(),
1865 [
'action' =>
'history' ] ) .
1869 if ( $title->isBigDeletion() ) {
1871 $context->getOutput()->wrapWikiMsg(
"<div class='error'>\n$1\n</div>\n",
1873 'delete-warning-toobig',
1889 wfDebug(
"Article::confirmDelete\n" );
1893 $outputPage = $ctx->getOutput();
1894 $outputPage->setPageTitle(
wfMessage(
'delete-confirm', $title->getPrefixedText() ) );
1895 $outputPage->addBacklinkSubtitle( $title );
1896 $outputPage->setRobotPolicy(
'noindex,nofollow' );
1897 $outputPage->addModules(
'mediawiki.action.delete' );
1899 $backlinkCache = $title->getBacklinkCache();
1900 if ( $backlinkCache->hasLinks(
'pagelinks' ) || $backlinkCache->hasLinks(
'templatelinks' ) ) {
1901 $outputPage->wrapWikiMsg(
"<div class='mw-warning plainlinks'>\n$1\n</div>\n",
1902 'deleting-backlinks-warning' );
1905 $subpageQueryLimit = 51;
1906 $subpages = $title->getSubpages( $subpageQueryLimit );
1907 $subpageCount = count( $subpages );
1908 if ( $subpageCount > 0 ) {
1909 $outputPage->wrapWikiMsg(
"<div class='mw-warning plainlinks'>\n$1\n</div>\n",
1910 [
'deleting-subpages-warning', Message::numParam( $subpageCount ) ] );
1912 $outputPage->addWikiMsg(
'confirmdeletetext' );
1914 Hooks::run(
'ArticleConfirmDelete', [ $this, $outputPage, &$reason ] );
1917 $checkWatch = $user->getBoolOption(
'watchdeletion' ) || $user->isWatched( $title );
1919 $outputPage->enableOOUI();
1921 $options = Xml::listDropDownOptions(
1922 $ctx->msg(
'deletereason-dropdown' )->inContentLanguage()->text(),
1923 [
'other' => $ctx->msg(
'deletereasonotherlist' )->inContentLanguage()->text() ]
1927 $fields[] =
new OOUI\FieldLayout(
1928 new OOUI\DropdownInputWidget( [
1929 'name' =>
'wpDeleteReasonList',
1930 'inputId' =>
'wpDeleteReasonList',
1932 'infusable' =>
true,
1937 'label' => $ctx->msg(
'deletecomment' )->text(),
1946 $oldCommentSchema = $conf->get(
'CommentTableSchemaMigrationStage' ) ===
MIGRATION_OLD;
1947 $fields[] =
new OOUI\FieldLayout(
1948 new OOUI\TextInputWidget( [
1949 'name' =>
'wpReason',
1950 'inputId' =>
'wpReason',
1952 'maxLength' => $oldCommentSchema ? 255 : CommentStore::COMMENT_CHARACTER_LIMIT,
1953 'infusable' =>
true,
1955 'autofocus' =>
true,
1958 'label' => $ctx->msg(
'deleteotherreason' )->text(),
1963 if ( $user->isLoggedIn() ) {
1964 $fields[] =
new OOUI\FieldLayout(
1965 new OOUI\CheckboxInputWidget( [
1966 'name' =>
'wpWatch',
1967 'inputId' =>
'wpWatch',
1969 'selected' => $checkWatch,
1972 'label' => $ctx->msg(
'watchthis' )->text(),
1973 'align' =>
'inline',
1974 'infusable' =>
true,
1979 if ( $user->isAllowed(
'suppressrevision' ) ) {
1980 $fields[] =
new OOUI\FieldLayout(
1981 new OOUI\CheckboxInputWidget( [
1982 'name' =>
'wpSuppress',
1983 'inputId' =>
'wpSuppress',
1987 'label' => $ctx->msg(
'revdelete-suppress' )->text(),
1988 'align' =>
'inline',
1989 'infusable' =>
true,
1994 $fields[] =
new OOUI\FieldLayout(
1995 new OOUI\ButtonInputWidget( [
1996 'name' =>
'wpConfirmB',
1997 'inputId' =>
'wpConfirmB',
1999 'value' => $ctx->msg(
'deletepage' )->text(),
2000 'label' => $ctx->msg(
'deletepage' )->text(),
2001 'flags' => [
'primary',
'destructive' ],
2009 $fieldset =
new OOUI\FieldsetLayout( [
2010 'label' => $ctx->msg(
'delete-legend' )->text(),
2011 'id' =>
'mw-delete-table',
2015 $form =
new OOUI\FormLayout( [
2017 'action' => $title->getLocalURL(
'action=delete' ),
2018 'id' =>
'deleteconfirm',
2020 $form->appendContent(
2022 new OOUI\HtmlSnippet(
2023 Html::hidden(
'wpEditToken', $user->getEditToken( [
'delete', $title->getPrefixedText() ] ) )
2027 $outputPage->addHTML(
2028 new OOUI\PanelLayout( [
2029 'classes' => [
'deletepage-wrapper' ],
2030 'expanded' =>
false,
2037 if ( $user->isAllowed(
'editinterface' ) ) {
2039 $ctx->msg(
'deletereason-dropdown' )->inContentLanguage()->getTitle(),
2040 wfMessage(
'delete-edit-reasonlist' )->escaped(),
2042 [
'action' =>
'edit' ]
2044 $outputPage->addHTML(
'<p class="mw-delete-editreasons">' .
$link .
'</p>' );
2047 $deleteLogPage =
new LogPage(
'delete' );
2048 $outputPage->addHTML( Xml::element(
'h2',
null, $deleteLogPage->getName()->text() ) );
2060 public function doDelete( $reason, $suppress =
false, $immediate =
false ) {
2063 $outputPage =
$context->getOutput();
2065 $status = $this->mPage->doDeleteArticleReal( $reason, $suppress, 0,
true, $error, $user,
2066 [],
'delete', $immediate );
2069 $deleted = $this->
getTitle()->getPrefixedText();
2071 $outputPage->setPageTitle(
wfMessage(
'actioncomplete' ) );
2072 $outputPage->setRobotPolicy(
'noindex,nofollow' );
2075 $loglink =
'[[Special:Log/delete|' .
wfMessage(
'deletionlog' )->text() .
']]';
2076 $outputPage->addWikiMsg(
'deletedtext',
wfEscapeWikiText( $deleted ), $loglink );
2077 Hooks::run(
'ArticleDeleteAfterSuccess', [ $this->
getTitle(), $outputPage ] );
2079 $outputPage->addWikiMsg(
'delete-scheduled',
wfEscapeWikiText( $deleted ) );
2082 $outputPage->returnToMain(
false );
2084 $outputPage->setPageTitle(
2086 $this->
getTitle()->getPrefixedText() )
2089 if ( $error ==
'' ) {
2090 $outputPage->addWikiText(
2091 "<div class=\"error mw-error-cannotdelete\">\n" .
$status->getWikiText() .
"\n</div>"
2093 $deleteLogPage =
new LogPage(
'delete' );
2094 $outputPage->addHTML( Xml::element(
'h2',
null, $deleteLogPage->getName()->text() ) );
2102 $outputPage->addHTML( $error );
2117 static $called =
false;
2120 wfDebug(
"Article::tryFileCache(): called twice!?\n" );
2127 if (
$cache->isCacheGood( $this->mPage->getTouched() ) ) {
2128 wfDebug(
"Article::tryFileCache(): about to load file\n" );
2132 wfDebug(
"Article::tryFileCache(): starting buffer\n" );
2133 ob_start( [ &
$cache,
'saveToFileCache' ] );
2136 wfDebug(
"Article::tryFileCache(): not cacheable\n" );
2151 $cacheable = $this->mPage->getId()
2152 && !$this->mRedirectedFrom && !$this->
getTitle()->isRedirect();
2156 $articlePage = $this;
2157 $cacheable = Hooks::run(
'IsFileCacheable', [ &$articlePage ] );
2180 if ( $user ===
null ) {
2183 $parserOptions = $this->mPage->makeParserOptions( $user );
2186 return $this->mPage->getParserOutput( $parserOptions, $oldid );
2196 if ( $this->mParserOptions ) {
2197 throw new MWException(
"can't change parser options after they have already been set" );
2201 $this->mParserOptions = clone
$options;
2209 if ( !$this->mParserOptions ) {
2210 $this->mParserOptions = $this->mPage->makeParserOptions( $this->
getContext() );
2236 wfDebug( __METHOD__ .
" called and \$mContext is null. " .
2237 "Return RequestContext::getMain(); for sanity\n" );
2238 return RequestContext::getMain();
2250 if ( property_exists( $this->mPage,
$fname ) ) {
2251 # wfWarn( "Access to raw $fname field " . __CLASS__ );
2252 return $this->mPage->$fname;
2254 trigger_error(
'Inaccessible property via __get(): ' .
$fname, E_USER_NOTICE );
2265 if ( property_exists( $this->mPage,
$fname ) ) {
2266 # wfWarn( "Access to raw $fname field of " . __CLASS__ );
2267 $this->mPage->$fname = $fvalue;
2269 } elseif ( !in_array(
$fname, [
'mContext',
'mPage' ] ) ) {
2270 $this->mPage->$fname = $fvalue;
2272 trigger_error(
'Inaccessible property via __set(): ' .
$fname, E_USER_NOTICE );
2281 return $this->mPage->checkFlags( $flags );
2289 return $this->mPage->checkTouched();
2297 $this->mPage->clearPreparedEdit();
2305 $reason, $suppress =
false, $u1 =
null, $u2 =
null, &$error =
'',
User $user =
null,
2306 $tags = [], $immediate =
false
2308 return $this->mPage->doDeleteArticleReal(
2309 $reason, $suppress, $u1, $u2, $error, $user, $tags,
'delete', $immediate
2323 $this->mPage->doDeleteUpdates( $id,
$content, $revision, $user );
2332 User $user =
null, $serialFormat =
null
2335 return $this->mPage->doEditContent(
$content, $summary, $flags, $originalRevId,
2336 $user, $serialFormat
2345 return $this->mPage->doEditUpdates( $revision, $user,
$options );
2355 return $this->mPage->doPurge();
2363 $this->mPage->doViewUpdates( $user, $oldid );
2371 return $this->mPage->exists();
2379 return $this->mPage->followRedirect();
2387 return $this->mPage->getActionOverrides();
2395 return $this->mPage->getAutoDeleteReason( $hasHistory );
2403 return $this->mPage->getCategories();
2411 return $this->mPage->getComment( $audience, $user );
2419 return $this->mPage->getContentHandler();
2427 return $this->mPage->getContentModel();
2435 return $this->mPage->getContributors();
2443 return $this->mPage->getCreator( $audience, $user );
2451 return $this->mPage->getDeletionUpdates(
$content );
2459 return $this->mPage->getHiddenCategories();
2467 return $this->mPage->getId();
2475 return $this->mPage->getLatest();
2483 return $this->mPage->getLinksTimestamp();
2491 return $this->mPage->getMinorEdit();
2499 return $this->mPage->getOldestRevision();
2507 return $this->mPage->getRedirectTarget();
2515 return $this->mPage->getRedirectURL( $rt );
2523 return $this->mPage->getRevision();
2531 return $this->mPage->getTimestamp();
2539 return $this->mPage->getTouched();
2547 return $this->mPage->getUndoContent( $undo, $undoafter );
2555 return $this->mPage->getUser( $audience, $user );
2563 return $this->mPage->getUserText( $audience, $user );
2571 return $this->mPage->hasViewableContent();
2579 return $this->mPage->insertOn( $dbw, $pageId );
2587 array $expiry, $cascade, $reason, $user =
null
2589 return $this->mPage->insertProtectNullRevision( $revCommentMsg, $limit,
2590 $expiry, $cascade, $reason, $user
2599 return $this->mPage->insertRedirect();
2607 return $this->mPage->insertRedirectEntry( $rt, $oldLatest );
2615 return $this->mPage->isCountable( $editInfo );
2623 return $this->mPage->isRedirect();
2631 return $this->mPage->loadFromRow( $data, $from );
2639 $this->mPage->loadPageData( $from );
2647 return $this->mPage->lockAndGetLatest();
2655 return $this->mPage->makeParserOptions(
$context );
2663 return $this->mPage->pageDataFromId(
$dbr, $id,
$options );
2671 return $this->mPage->pageDataFromTitle(
$dbr, $title,
$options );
2680 $serialFormat =
null, $useCache =
true
2682 return $this->mPage->prepareContentForEdit(
2684 $serialFormat, $useCache
2693 return $this->mPage->protectDescription( $limit, $expiry );
2701 return $this->mPage->protectDescriptionLog( $limit, $expiry );
2709 $sectionTitle =
'', $baseRevId =
null
2711 return $this->mPage->replaceSectionAtRev( $sectionId, $sectionContent,
2712 $sectionTitle, $baseRevId
2721 $sectionId,
Content $sectionContent, $sectionTitle =
'', $edittime =
null
2723 return $this->mPage->replaceSectionContent(
2724 $sectionId, $sectionContent, $sectionTitle, $edittime
2733 return $this->mPage->setTimestamp( $ts );
2741 return $this->mPage->shouldCheckParserCache( $parserOptions, $oldId );
2749 return $this->mPage->supportsSections();
2757 return $this->mPage->triggerOpportunisticLinksUpdate( $parserOutput );
2765 return $this->mPage->updateCategoryCounts( $added, $deleted, $id );
2773 return $this->mPage->updateIfNewerOn( $dbw, $revision );
2781 return $this->mPage->updateRedirectOn( $dbw, $redirectTitle, $lastRevIsRedirect );
2789 $lastRevIsRedirect =
null
2791 return $this->mPage->updateRevisionOn( $dbw, $revision, $lastRevision,
2807 return $this->mPage->doUpdateRestrictions( $limit, $expiry, $cascade, $reason, $user );
2818 &$cascade = 0, $expiry = []
2820 return $this->mPage->doUpdateRestrictions(
2841 $reason, $suppress =
false, $u1 =
null, $u2 =
null, &$error =
'', $immediate =
false
2843 return $this->mPage->doDeleteArticle( $reason, $suppress, $u1, $u2, $error,
2856 public function doRollback( $fromP, $summary, $token, $bot, &$resultDetails,
User $user =
null ) {
2858 return $this->mPage->doRollback( $fromP, $summary, $token, $bot, $resultDetails, $user );
2870 $guser = is_null( $guser ) ? $this->
getContext()->getUser() : $guser;
2871 return $this->mPage->commitRollback( $fromP, $summary, $bot, $resultDetails, $guser );
2879 $title = $this->mPage->getTitle();
2880 $handler = ContentHandler::getForTitle( $title );
2881 return $handler->getAutoDeleteReason( $title, $hasHistory );
$wgArticleRobotPolicies
Robot policies per article.
$wgDefaultRobotPolicy
Default robot policy.
$wgSend404Code
Some web hosts attempt to rewrite all responses with a 404 (not found) status code,...
$wgRedirectSources
If local interwikis are set up which allow redirects, set this regexp to restrict URLs which will be ...
$wgUseFilePatrol
Use file patrolling to check new files on Special:Newfiles.
$wgUseRCPatrol
Use RC Patrolling to check for vandalism (from recent changes and watchlists) New pages and new files...
$wgNamespaceRobotPolicies
Robot policies per namespaces.
$wgUseNPPatrol
Use new page patrolling to check new pages on Special:Newpages.
$wgDeleteRevisionsLimit
Optional to restrict deletion of pages with higher revision counts to users with the 'bigdelete' perm...
$wgDebugToolbar
Display the new debugging toolbar.
$wgUseFileCache
This will cache static pages for non-logged-in users to reduce database traffic on public sites.
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
wfReadOnly()
Check whether the wiki is in read-only mode.
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
wfEscapeWikiText( $text)
Escapes the given text so that it may be output using addWikiText() without any linking,...
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
if(defined( 'MW_SETUP_CALLBACK')) $fname
Customization point after all loading (constants, functions, classes, DefaultSettings,...
Class for viewing MediaWiki article and history.
shouldCheckParserCache(ParserOptions $parserOptions, $oldId)
Call to WikiPage function for backwards compatibility.
getRevisionFetched()
Get the fetched Revision object depending on request parameters or null on failure.
doDeleteUpdates( $id, Content $content=null, $revision=null, User $user=null)
Call to WikiPage function for backwards compatibility.
updateRedirectOn( $dbw, $redirectTitle, $lastRevIsRedirect=null)
Call to WikiPage function for backwards compatibility.
generateReason(&$hasHistory)
getSubstituteContent()
Returns Content object to use when the page does not exist.
checkFlags( $flags)
Call to WikiPage function for backwards compatibility.
checkTouched()
Call to WikiPage function for backwards compatibility.
getHiddenCategories()
Call to WikiPage function for backwards compatibility.
static newFromWikiPage(WikiPage $page, IContextSource $context)
Create an Article object of the appropriate class for the given page.
doViewUpdates(User $user, $oldid=0)
Call to WikiPage function for backwards compatibility.
getContext()
Gets the context this Article is executed in.
getCategories()
Call to WikiPage function for backwards compatibility.
commitRollback( $fromP, $summary, $bot, &$resultDetails, User $guser=null)
getOldIDFromRequest()
Sets $this->mRedirectUrl to a correct URL if the query parameters are incorrect.
getParserOutput( $oldid=null, User $user=null)
#-
insertProtectNullRevision( $revCommentMsg, array $limit, array $expiry, $cascade, $reason, $user=null)
Call to WikiPage function for backwards compatibility.
doEditContent(Content $content, $summary, $flags=0, $originalRevId=false, User $user=null, $serialFormat=null)
Call to WikiPage function for backwards compatibility.
doPurge()
Call to WikiPage function for backwards compatibility.
getRedirectedFrom()
Get the page this view was redirected from.
Title null $mRedirectedFrom
Title from which we were redirected here, if any.
getUserText( $audience=Revision::FOR_PUBLIC, User $user=null)
Call to WikiPage function for backwards compatibility.
insertOn( $dbw, $pageId=null)
Call to WikiPage function for backwards compatibility.
updateRevisionOn( $dbw, $revision, $lastRevision=null, $lastRevIsRedirect=null)
Call to WikiPage function for backwards compatibility.
fetchContentObject()
Get text content object Does NOT follow redirects.
supportsSections()
Call to WikiPage function for backwards compatibility.
pageDataFromTitle( $dbr, $title, $options=[])
Call to WikiPage function for backwards compatibility.
bool $disableSectionEditForRender
Whether render() was called.
getContentHandler()
Call to WikiPage function for backwards compatibility.
updateCategoryCounts(array $added, array $deleted, $id=0)
Call to WikiPage function for backwards compatibility.
view()
This is the default action of the index.php entry point: just view the page of the given title.
loadPageData( $from='fromdb')
Call to WikiPage function for backwards compatibility.
doDeleteArticleReal( $reason, $suppress=false, $u1=null, $u2=null, &$error='', User $user=null, $tags=[], $immediate=false)
Call to WikiPage function for backwards compatibility.
doUpdateRestrictions(array $limit, array $expiry, &$cascade, $reason, User $user)
protectDescriptionLog(array $limit, array $expiry)
Call to WikiPage function for backwards compatibility.
WikiPage null $mPage
The WikiPage object of this instance.
clearPreparedEdit()
Call to WikiPage function for backwards compatibility.
__construct(Title $title, $oldId=null)
Constructor and clear the article.
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,...
followRedirect()
Call to WikiPage function for backwards compatibility.
prepareContentForEdit(Content $content, $revision=null, User $user=null, $serialFormat=null, $useCache=true)
Call to WikiPage function for backwards compatibility.
doDelete( $reason, $suppress=false, $immediate=false)
Perform a deletion and output success or failure messages.
replaceSectionAtRev( $sectionId, Content $sectionContent, $sectionTitle='', $baseRevId=null)
Call to WikiPage function for backwards compatibility.
ParserOutput null false $mParserOutput
The ParserOutput generated for viewing the page, initialized by view().
getAutoDeleteReason(&$hasHistory)
Call to WikiPage function for backwards compatibility.
getLinksTimestamp()
Call to WikiPage function for backwards compatibility.
protectDescription(array $limit, array $expiry)
Call to WikiPage function for backwards compatibility.
getOldestRevision()
Call to WikiPage function for backwards compatibility.
setTimestamp( $ts)
Call to WikiPage function for backwards compatibility.
getTitle()
Get the title object of the article.
getActionOverrides()
Call to WikiPage function for backwards compatibility.
doEditUpdates(Revision $revision, User $user, array $options=[])
Call to WikiPage function for backwards compatibility.
adjustDisplayTitle(ParserOutput $pOutput)
Adjust title for pages with displaytitle, -{T|}- or language conversion.
updateIfNewerOn( $dbw, $revision)
Call to WikiPage function for backwards compatibility.
getLatest()
Call to WikiPage function for backwards compatibility.
pageDataFromId( $dbr, $id, $options=[])
Call to WikiPage function for backwards compatibility.
insertRedirect()
Call to WikiPage function for backwards compatibility.
getContributors()
Call to WikiPage function for backwards compatibility.
showDeletedRevisionHeader()
If the revision requested for view is deleted, check permissions.
isCountable( $editInfo=false)
Call to WikiPage function for backwards compatibility.
getParserOptions()
Get parser options suitable for rendering the primary article wikitext.
getCreator( $audience=Revision::FOR_PUBLIC, User $user=null)
Call to WikiPage function for backwards compatibility.
getComment( $audience=Revision::FOR_PUBLIC, User $user=null)
Call to WikiPage function for backwards compatibility.
IContextSource null $mContext
The context this Article is executed in.
getContentModel()
Call to WikiPage function for backwards compatibility.
Revision null $mRevision
Revision to be shown.
static getRedirectHeaderHtml(Language $lang, $target, $forceKnown=false)
Return the HTML for the top of a redirect page.
protect()
action=protect handler
lockAndGetLatest()
Call to WikiPage function for backwards compatibility.
isCurrent()
Returns true if the currently-referenced revision is the current edit to this page (and it exists).
updateRestrictions( $limit=[], $reason='', &$cascade=0, $expiry=[])
showMissingArticle()
Show the error text for a missing article.
getUndoContent(Revision $undo, Revision $undoafter=null)
Call to WikiPage function for backwards compatibility.
__set( $fname, $fvalue)
Use PHP's magic __set handler to handle setting of raw WikiPage fields for backwards compatibility.
getId()
Call to WikiPage function for backwards compatibility.
unprotect()
action=unprotect handler (alias)
int $mRevIdFetched
Revision ID of revision that was loaded.
applyContentOverride(Content $override)
Applies a content override by constructing a fake Revision object and assigning it to mRevision.
isRedirect()
Call to WikiPage function for backwards compatibility.
ParserOptions null $mParserOptions
ParserOptions object for $wgUser articles.
makeFetchErrorContent()
Returns a Content object representing any error in $this->fetchContent, or null if there is no such e...
confirmDelete( $reason)
Output deletion confirmation dialog.
getPage()
Get the WikiPage object of this instance.
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
getTouched()
Call to WikiPage function for backwards compatibility.
getRevision()
Call to WikiPage function for backwards compatibility.
string bool $mRedirectUrl
URL to redirect to or false if none.
getTimestamp()
Call to WikiPage function for backwards compatibility.
static newFromID( $id)
Constructor from a page id.
getRedirectTarget()
Call to WikiPage function for backwards compatibility.
getUser( $audience=Revision::FOR_PUBLIC, User $user=null)
Call to WikiPage function for backwards compatibility.
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.
viewRedirect( $target, $appendSubtitle=true, $forceKnown=false)
Return the HTML for the top of a redirect page.
insertRedirectEntry(Title $rt, $oldLatest=null)
Call to WikiPage function for backwards compatibility.
triggerOpportunisticLinksUpdate(ParserOutput $parserOutput)
Call to WikiPage function for backwards compatibility.
makeParserOptions( $context)
Call to WikiPage function for backwards compatibility.
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.
Status null $fetchResult
represents the outcome of fetchRevisionRecord().
loadFromRow( $data, $from)
Call to WikiPage function for backwards compatibility.
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.
doDeleteArticle( $reason, $suppress=false, $u1=null, $u2=null, &$error='', $immediate=false)
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.
replaceSectionContent( $sectionId, Content $sectionContent, $sectionTitle='', $edittime=null)
Call to WikiPage function for backwards compatibility.
showNamespaceHeader()
Show a header specific to the namespace currently being viewed, like [[MediaWiki:Talkpagetext]].
__get( $fname)
Use PHP's magic __get handler to handle accessing of raw WikiPage fields for backwards compatibility.
getRevisionRedirectTarget(RevisionRecord $revision)
static newFromTitle( $title, IContextSource $context)
Create an Article object of the appropriate class for the given page.
hasViewableContent()
Call to WikiPage function for backwards compatibility.
getContentObject()
Returns a Content object representing the pages effective display content, not necessarily the revisi...
showDiffPage()
Show a diff page according to current request variables.
getMinorEdit()
Call to WikiPage function for backwards compatibility.
setParserOptions(ParserOptions $options)
Override the ParserOptions used to render the primary article wikitext.
getEmptyPageParserOutput(ParserOptions $options)
Returns ParserOutput to use when a page does not exist.
render()
Handle action=render.
showRedirectedFromHeader()
If this request is a redirect view, send "redirected from" subtitle to the output.
exists()
Call to WikiPage function for backwards compatibility.
setContext( $context)
Sets the context this Article is executed in.
getRedirectURL( $rt)
Call to WikiPage function for backwards compatibility.
bool $mContentLoaded
Is the target revision loaded? Set by fetchRevisionRecord().
getDeletionUpdates(Content $content=null)
Call to WikiPage function for backwards compatibility.
doRollback( $fromP, $summary, $token, $bot, &$resultDetails, User $user=null)
Content null $mContentObject
Content of the main slot of $this->mRevision.
static newFromTarget( $specificTarget, $vagueTarget=null, $fromMaster=false)
Given a target and the target's type, get an existing Block object if possible.
Special handling for category description pages, showing pages, subcategories and file that belong to...
const POST_EDIT_COOKIE_KEY_PREFIX
Prefix of key for cookie used to pass post-edit state.
Page view caching in the file system.
static useFileCache(IContextSource $context, $mode=self::MODE_NORMAL)
Check if pages can be cached for this request/user.
Class for viewing MediaWiki file description pages.
Internationalisation code.
static link( $target, $html=null, $customAttribs=[], $query=[], $options=[])
This function returns an HTML link to the given target.
static linkKnown( $target, $html=null, $customAttribs=[], $query=[], $options=[ 'known'])
Identical to link(), except $options defaults to 'known'.
static revComment(Revision $rev, $local=false, $isPublic=false)
Wrap and format the given revision's comment block, if the current user is allowed to view it.
static revUserTools( $rev, $isPublic=false)
Generate a user tool link cluster if the current user is allowed to view it.
static makeExternalLink( $url, $text, $escape=true, $linktype='', $attribs=[], $title=null)
Make an external link.
static getRevDeleteLink(User $user, Revision $rev, Title $title)
Get a revision-deletion link, or disabled link, or nothing, depending on user permissions & the setti...
static showLogExtract(&$out, $types=[], $page='', $user='', $param=[])
Show log extract.
Class to simplify the use of log pages.
Wrapper allowing us to handle a system message as a Content object.
Set options of the Parser.
Show an error when a user tries to do something they do not have the necessary permissions for.
Show an error when the wiki is locked/read-only and the user tries to do something that requires writ...
static newFromId( $id, $flags=0)
Load a page revision from a given revision ID number.
Generic operation result class Has warning/error list, boolean status and arbitrary value.
Represents a title within MediaWiki.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
static isIP( $name)
Does the string match an anonymous IP address?
static doWatchOrUnwatch( $watch, Title $title, User $user)
Watch or unwatch a page.
Class representing a MediaWiki article and history.
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
null for the local wiki Added should default to null in handler for backwards compatibility add a value to it if you want to add a cookie that have to vary cache options can modify as strings Extensions should add to this list prev or next refreshes the diff cache $unhide
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on $request
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped & $options
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on and they can depend only on the ResourceLoaderContext $context
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation use $formDescriptor instead default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "<div ...>$1</div>"). - flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException':Called before an exception(or PHP error) is logged. This is meant for integration with external error aggregation services
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output $out
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses & $html
usually copyright or history_copyright This message must be in HTML not wikitext & $link
return true to allow those checks to and false if checking is done remove or add to the links of a group of changes in EnhancedChangesList Hook subscribers can return false to omit this line from recentchanges use this to change the tables headers change it to an object instance and return false override the list derivative used the name of the old file & $article
Status::newGood()` to allow deletion, and then `return false` from the hook function. Ensure you consume the 'ChangeTagAfterDelete' hook to carry out custom deletion actions. $tag:name of the tag $user:user initiating the action & $status:Status object. See above. 'ChangeTagsListActive':Allows you to nominate which of the tags your extension uses are in active use. & $tags:list of all active tags. Append to this array. 'ChangeTagsAfterUpdateTags':Called after tags have been updated with the ChangeTags::updateTags function. Params:$addedTags:tags effectively added in the update $removedTags:tags effectively removed in the update $prevTags:tags that were present prior to the update $rc_id:recentchanges table id $rev_id:revision table id $log_id:logging table id $params:tag params $rc:RecentChange being tagged when the tagging accompanies the action, or null $user:User who performed the tagging when the tagging is subsequent to the action, or null 'ChangeTagsAllowedAdd':Called when checking if a user can add tags to a change. & $allowedTags:List of all the tags the user is allowed to add. Any tags the user wants to add( $addTags) that are not in this array will cause it to fail. You may add or remove tags to this array as required. $addTags:List of tags user intends to add. $user:User who is adding the tags. 'ChangeUserGroups':Called before user groups are changed. $performer:The User who will perform the change $user:The User whose groups will be changed & $add:The groups that will be added & $remove:The groups that will be removed 'Collation::factory':Called if $wgCategoryCollation is an unknown collation. $collationName:Name of the collation in question & $collationObject:Null. Replace with a subclass of the Collation class that implements the collation given in $collationName. 'ConfirmEmailComplete':Called after a user 's email has been confirmed successfully. $user:user(object) whose email is being confirmed 'ContentAlterParserOutput':Modify parser output for a given content object. Called by Content::getParserOutput after parsing has finished. Can be used for changes that depend on the result of the parsing but have to be done before LinksUpdate is called(such as adding tracking categories based on the rendered HTML). $content:The Content to render $title:Title of the page, as context $parserOutput:ParserOutput to manipulate 'ContentGetParserOutput':Customize parser output for a given content object, called by AbstractContent::getParserOutput. May be used to override the normal model-specific rendering of page content. $content:The Content to render $title:Title of the page, as context $revId:The revision ID, as context $options:ParserOptions for rendering. To avoid confusing the parser cache, the output can only depend on parameters provided to this hook function, not on global state. $generateHtml:boolean, indicating whether full HTML should be generated. If false, generation of HTML may be skipped, but other information should still be present in the ParserOutput object. & $output:ParserOutput, to manipulate or replace 'ContentHandlerDefaultModelFor':Called when the default content model is determined for a given title. May be used to assign a different model for that title. $title:the Title in question & $model:the model name. Use with CONTENT_MODEL_XXX constants. 'ContentHandlerForModelID':Called when a ContentHandler is requested for a given content model name, but no entry for that model exists in $wgContentHandlers. Note:if your extension implements additional models via this hook, please use GetContentModels hook to make them known to core. $modeName:the requested content model name & $handler:set this to a ContentHandler object, if desired. 'ContentModelCanBeUsedOn':Called to determine whether that content model can be used on a given page. This is especially useful to prevent some content models to be used in some special location. $contentModel:ID of the content model in question $title:the Title in question. & $ok:Output parameter, whether it is OK to use $contentModel on $title. Handler functions that modify $ok should generally return false to prevent further hooks from further modifying $ok. 'ContribsPager::getQueryInfo':Before the contributions query is about to run & $pager:Pager object for contributions & $queryInfo:The query for the contribs Pager 'ContribsPager::reallyDoQuery':Called before really executing the query for My Contributions & $data:an array of results of all contribs queries $pager:The ContribsPager object hooked into $offset:Index offset, inclusive $limit:Exact query limit $descending:Query direction, false for ascending, true for descending 'ContributionsLineEnding':Called before a contributions HTML line is finished $page:SpecialPage object for contributions & $ret:the HTML line $row:the DB row for this line & $classes:the classes to add to the surrounding< li > & $attribs:associative array of other HTML attributes for the< li > element. Currently only data attributes reserved to MediaWiki are allowed(see Sanitizer::isReservedDataAttribute). 'ContributionsToolLinks':Change tool links above Special:Contributions $id:User identifier $title:User page title & $tools:Array of tool links $specialPage:SpecialPage instance for context and services. Can be either SpecialContributions or DeletedContributionsPage. Extensions should type hint against a generic SpecialPage though. 'ConvertContent':Called by AbstractContent::convert when a conversion to another content model is requested. Handler functions that modify $result should generally return false to disable further attempts at conversion. $content:The Content object to be converted. $toModel:The ID of the content model to convert to. $lossy: boolean indicating whether lossy conversion is allowed. & $result:Output parameter, in case the handler function wants to provide a converted Content object. Note that $result->getContentModel() must return $toModel. 'ContentSecurityPolicyDefaultSource':Modify the allowed CSP load sources. This affects all directives except for the script directive. If you want to add a script source, see ContentSecurityPolicyScriptSource hook. & $defaultSrc:Array of Content-Security-Policy allowed sources $policyConfig:Current configuration for the Content-Security-Policy header $mode:ContentSecurityPolicy::REPORT_ONLY_MODE or ContentSecurityPolicy::FULL_MODE depending on type of header 'ContentSecurityPolicyDirectives':Modify the content security policy directives. Use this only if ContentSecurityPolicyDefaultSource and ContentSecurityPolicyScriptSource do not meet your needs. & $directives:Array of CSP directives $policyConfig:Current configuration for the CSP header $mode:ContentSecurityPolicy::REPORT_ONLY_MODE or ContentSecurityPolicy::FULL_MODE depending on type of header 'ContentSecurityPolicyScriptSource':Modify the allowed CSP script sources. Note that you also have to use ContentSecurityPolicyDefaultSource if you want non-script sources to be loaded from whatever you add. & $scriptSrc:Array of CSP directives $policyConfig:Current configuration for the CSP header $mode:ContentSecurityPolicy::REPORT_ONLY_MODE or ContentSecurityPolicy::FULL_MODE depending on type of header 'CustomEditor':When invoking the page editor Return true to allow the normal editor to be used, or false if implementing a custom editor, e.g. for a special namespace, etc. $article:Article being edited $user:User performing the edit 'DatabaseOraclePostInit':Called after initialising an Oracle database $db:the DatabaseOracle object 'DeletedContribsPager::reallyDoQuery':Called before really executing the query for Special:DeletedContributions Similar to ContribsPager::reallyDoQuery & $data:an array of results of all contribs queries $pager:The DeletedContribsPager object hooked into $offset:Index offset, inclusive $limit:Exact query limit $descending:Query direction, false for ascending, true for descending 'DeletedContributionsLineEnding':Called before a DeletedContributions HTML line is finished. Similar to ContributionsLineEnding $page:SpecialPage object for DeletedContributions & $ret:the HTML line $row:the DB row for this line & $classes:the classes to add to the surrounding< li > & $attribs:associative array of other HTML attributes for the< li > element. Currently only data attributes reserved to MediaWiki are allowed(see Sanitizer::isReservedDataAttribute). 'DeleteUnknownPreferences':Called by the cleanupPreferences.php maintenance script to build a WHERE clause with which to delete preferences that are not known about. This hook is used by extensions that have dynamically-named preferences that should not be deleted in the usual cleanup process. For example, the Gadgets extension creates preferences prefixed with 'gadget-', and so anything with that prefix is excluded from the deletion. &where:An array that will be passed as the $cond parameter to IDatabase::select() to determine what will be deleted from the user_properties table. $db:The IDatabase object, useful for accessing $db->buildLike() etc. 'DifferenceEngineAfterLoadNewText':called in DifferenceEngine::loadNewText() after the new revision 's content has been loaded into the class member variable $differenceEngine->mNewContent but before returning true from this function. $differenceEngine:DifferenceEngine object 'DifferenceEngineLoadTextAfterNewContentIsLoaded':called in DifferenceEngine::loadText() after the new revision 's content has been loaded into the class member variable $differenceEngine->mNewContent but before checking if the variable 's value is null. This hook can be used to inject content into said class member variable. $differenceEngine:DifferenceEngine object 'DifferenceEngineMarkPatrolledLink':Allows extensions to change the "mark as
patrolled" link which is shown both on the diff header as well as on the bottom of a page, usually wrapped in a span element which has class="patrollink". $differenceEngine:DifferenceEngine object & $markAsPatrolledLink:The "mark as patrolled" link HTML(string) $rcid:Recent change ID(rc_id) for this change(int) 'DifferenceEngineMarkPatrolledRCID':Allows extensions to possibly change the rcid parameter. For example the rcid might be set to zero due to the user being the same as the performer of the change but an extension might still want to show it under certain conditions. & $rcid:rc_id(int) of the change or 0 $differenceEngine:DifferenceEngine object $change:RecentChange object $user:User object representing the current user 'DifferenceEngineNewHeader':Allows extensions to change the $newHeader variable, which contains information about the new revision, such as the revision 's author, whether the revision was marked as a minor edit or not, etc. $differenceEngine:DifferenceEngine object & $newHeader:The string containing the various #mw-diff-otitle[1-5] divs, which include things like revision author info, revision comment, RevisionDelete link and more $formattedRevisionTools:Array containing revision tools, some of which may have been injected with the DiffRevisionTools hook $nextlink:String containing the link to the next revision(if any) $status
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output modifiable modifiable after all normalizations have been except for the $wgMaxImageArea check set to true or false to override the $wgMaxImageArea check result gives extension the possibility to transform it themselves $handler
null for the local wiki Added should default to null in handler for backwards compatibility add a value to it if you want to add a cookie that have to vary cache options can modify $query
presenting them properly to the user as errors is done by the caller return true use this to change the list i e etc $rev
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a local account $user
returning false will NOT prevent logging $e
Base interface for content objects.
Interface for objects which can provide a MediaWiki context on request.
Interface for type hinting (accepts WikiPage, Article, ImagePage, CategoryPage)
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))
if(!isset( $args[0])) $lang