131 $this->mPage = $this->
newPage( $title );
148 $t = Title::newFromID( $id );
149 return $t ==
null ?
null :
new static(
$t );
160 if (
NS_MEDIA == $title->getNamespace() ) {
162 $title = Title::makeTitle(
NS_FILE, $title->getDBkey() );
166 Hooks::run(
'ArticleFromTitle', [ &$title, &$page,
$context ] );
168 switch ( $title->getNamespace() ) {
212 $this->mRedirectedFrom = $from;
221 return $this->mPage->getTitle();
238 $this->mContentLoaded =
false;
240 $this->mRedirectedFrom =
null; #
Title object if set
241 $this->mRevIdFetched = 0;
242 $this->mRedirectUrl =
false;
243 $this->mRevision =
null;
244 $this->mContentObject =
null;
245 $this->fetchResult =
null;
249 $this->mPage->clear();
270 if ( $this->mPage->getId() === 0 ) {
286 # If this is a MediaWiki:x message, then load the messages
287 # and return the message value for x.
288 if ( $this->
getTitle()->getNamespace() == NS_MEDIAWIKI ) {
289 $text = $this->
getTitle()->getDefaultMessageText();
290 if ( $text ===
false ) {
296 $message = $this->
getContext()->getUser()->isLoggedIn() ?
'noarticletext' :
'noarticletextanon';
326 if (
is_null( $this->mOldId ) ) {
339 $this->mRedirectUrl =
false;
342 $oldid =
$request->getIntOrNull(
'oldid' );
344 if ( $oldid ===
null ) {
348 if ( $oldid !== 0 ) {
349 # Load the given revision and check whether the page is another one.
350 # In that case, update this instance to reflect the change.
351 if ( $oldid === $this->mPage->getLatest() ) {
352 $this->mRevision = $this->mPage->getRevision();
355 if ( $this->mRevision !==
null ) {
357 if ( $this->mPage->getId() != $this->mRevision->getPage() ) {
358 $function =
get_class( $this->mPage ) .
'::newFromID';
359 $this->mPage =
$function( $this->mRevision->getPage() );
365 if (
$request->getVal(
'direction' ) ==
'next' ) {
366 $nextid = $this->
getTitle()->getNextRevisionID( $oldid );
369 $this->mRevision =
null;
371 $this->mRedirectUrl = $this->
getTitle()->getFullURL(
'redirect=no' );
374 $previd = $this->
getTitle()->getPreviousRevisionID( $oldid );
377 $this->mRevision =
null;
381 $this->mRevIdFetched = $this->mRevision ? $this->mRevision->getId() : 0;
400 if ( !$this->mContentLoaded ) {
417 if ( $this->fetchResult ) {
418 return $this->mRevision ? $this->mRevision->getRevisionRecord() :
null;
421 $this->mContentLoaded =
true;
422 $this->mContentObject =
null;
427 if ( !$this->mRevision ) {
429 $this->mRevision = $this->mPage->getRevision();
431 if ( !$this->mRevision ) {
432 wfDebug( __METHOD__ .
" failed to find page data for title " .
433 $this->
getTitle()->getPrefixedText() .
"\n" );
436 $this->fetchResult = Status::newFatal(
'noarticletext' );
443 if ( !$this->mRevision ) {
444 wfDebug( __METHOD__ .
" failed to load revision, rev_id $oldid\n" );
446 $this->fetchResult = Status::newFatal(
'missing-revision', $oldid );
453 $this->mRevIdFetched = $this->mRevision->getId();
454 $this->fetchResult = Status::newGood( $this->mRevision );
457 wfDebug( __METHOD__ .
" failed to retrieve content of revision " .
458 $this->mRevision->getId() .
"\n" );
461 $this->fetchResult = Status::newFatal(
'rev-deleted-text-permission' );
466 if ( Hooks::isRegistered(
'ArticleAfterFetchContentObject' ) ) {
467 $contentObject = $this->mRevision->getContent(
475 $articlePage =
$this;
478 'ArticleAfterFetchContentObject',
479 [ &$articlePage, &$hookContentObject ],
483 if ( $hookContentObject !== $contentObject ) {
490 $this->mContentObject = $this->mRevision->getContent(
495 return $this->mRevision->getRevisionRecord();
505 if ( !$this->fetchResult || $this->fetchResult->isOK() ) {
527 $rev->setContent( SlotRecord::MAIN, $override );
541 # If no oldid, this is the current version.
546 return $this->mPage->exists() && $this->mRevision && $this->mRevision->isCurrent();
561 if ( $this->fetchResult->isOK() ) {
575 if ( $this->fetchResult && $this->fetchResult->isOK() ) {
576 return $this->fetchResult->value->getId();
578 return $this->mPage->getLatest();
589 # Get variables from query string
590 # As side effect this will load the revision and update the title
591 # in a revision ID is passed in the request, so this should remain
592 # the first call of this method even if $oldid is used way below.
596 # Another whitelist check in case getOldID() is altering the title
597 $permErrors = $this->
getTitle()->getUserPermissionsErrors(
'read', $user );
598 if ( count( $permErrors ) ) {
599 wfDebug( __METHOD__ .
": denied on secondary read check\n" );
603 $outputPage = $this->
getContext()->getOutput();
604 # getOldID() may as well want us to redirect somewhere else
605 if ( $this->mRedirectUrl ) {
606 $outputPage->redirect( $this->mRedirectUrl );
607 wfDebug( __METHOD__ .
": redirecting due to oldid\n" );
612 # If we got diff in the query, we want to see a diff page instead of the article.
613 if ( $this->
getContext()->getRequest()->getCheck(
'diff' ) ) {
614 wfDebug( __METHOD__ .
": showing diff page\n" );
620 # Set page title (may be overridden by DISPLAYTITLE)
621 $outputPage->setPageTitle( $this->
getTitle()->getPrefixedText() );
623 $outputPage->setArticleFlag(
true );
624 # Allow frames by default
625 $outputPage->allowClickjacking();
627 $parserCache = MediaWikiServices::getInstance()->getParserCache();
631 # Render printable version, use printable version cache
632 if ( $outputPage->isPrintable() ) {
633 $parserOptions->setIsPrintable(
true );
634 $poOptions[
'enableSectionEditLinks'] =
false;
635 }
elseif ( $this->viewIsRenderAction
638 $poOptions[
'enableSectionEditLinks'] =
false;
641 # Try client and file cache
642 if ( !
$wgDebugToolbar && $oldid === 0 && $this->mPage->checkTouched() ) {
643 # Try to stream the output from file cache
645 wfDebug( __METHOD__ .
": done file cache\n" );
646 # tell wgOut that output is taken care of
647 $outputPage->disable();
648 $this->mPage->doViewUpdates( $user, $oldid );
654 # Should the parser cache be used?
655 $useParserCache = $this->mPage->shouldCheckParserCache( $parserOptions, $oldid );
656 wfDebug(
'Article::view using parser cache: ' . ( $useParserCache ?
'yes' :
'no' ) .
"\n" );
657 if ( $user->getStubThreshold() ) {
658 MediaWikiServices::getInstance()->getStatsdDataFactory()->increment(
'pcache_miss_stub' );
664 # Iterate through the possible ways of constructing the output text.
665 # Keep going until $outputDone is set, or we run out of things to do.
668 $this->mParserOutput =
false;
670 while ( !$outputDone && ++$pass ) {
674 $articlePage =
$this;
675 Hooks::run(
'ArticleViewHeader', [ &$articlePage, &$outputDone, &$useParserCache ] );
678 # Early abort if the page doesn't exist
679 if ( !$this->mPage->exists() ) {
680 wfDebug( __METHOD__ .
": showing missing article\n" );
682 $this->mPage->doViewUpdates( $user );
686 # Try the parser cache
687 if ( $useParserCache ) {
688 $this->mParserOutput = $parserCache->get( $this->mPage, $parserOptions );
690 if ( $this->mParserOutput !==
false ) {
692 wfDebug( __METHOD__ .
": showing parser cache contents for current rev permalink\n" );
695 wfDebug( __METHOD__ .
": showing parser cache contents\n" );
697 $outputPage->addParserOutput( $this->mParserOutput, $poOptions );
698 # Ensure that UI elements requiring revision ID have
699 # the correct version information.
700 $outputPage->setRevisionId( $this->mPage->getLatest() );
701 # Preload timestamp to avoid a DB hit
702 $cachedTimestamp = $this->mParserOutput->getTimestamp();
703 if ( $cachedTimestamp !==
null ) {
704 $outputPage->setRevisionTimestamp( $cachedTimestamp );
705 $this->mPage->setTimestamp( $cachedTimestamp );
712 # Are we looking at an old revision
714 if ( $oldid && $this->fetchResult->isOK() ) {
718 wfDebug( __METHOD__ .
": cannot view deleted revision\n" );
723 # Ensure that UI elements requiring revision ID have
724 # the correct version information.
726 # Preload timestamp to avoid a DB hit
727 $outputPage->setRevisionTimestamp( $this->mPage->getTimestamp() );
729 # Pages containing custom CSS or JavaScript get special treatment
730 if ( $this->
getTitle()->isSiteConfigPage() || $this->
getTitle()->isUserConfigPage() ) {
731 $dir = $this->
getContext()->getLanguage()->getDir();
734 $outputPage->wrapWikiMsg(
735 "<div id='mw-clearyourcache' lang='$lang' dir='$dir' class='mw-content-$dir'>\n$1\n</div>",
738 }
elseif ( !Hooks::run(
'ArticleRevisionViewCustom', [
748 }
elseif ( !Hooks::run(
'ArticleContentViewCustom',
757 # Run the parse, protected by a pool counter
758 wfDebug( __METHOD__ .
": doing uncached parse\n" );
773 $ok = $poolArticleView->execute();
774 $error = $poolArticleView->getError();
775 $this->mParserOutput = $poolArticleView->getParserOutput() ?:
null;
777 # Don't cache a dirty ParserOutput object
778 if ( $poolArticleView->getIsDirty() ) {
779 $outputPage->setCdnMaxage( 0 );
780 $outputPage->addHTML(
"<!-- parser cache is expired, " .
781 "sending anyway due to pool overload-->\n" );
789 $outputPage->clearHTML();
790 $outputPage->enableClientCache(
false );
791 $outputPage->setRobotPolicy(
'noindex,nofollow' );
793 $errortext = $error->getWikiText(
false,
'view-pool-error' );
794 $outputPage->wrapWikiTextAsInterface(
'errorbox', $errortext );
796 # Connection or timeout error
800 if ( $this->mParserOutput ) {
801 $outputPage->addParserOutput( $this->mParserOutput, $poOptions );
805 $outputPage->addSubtitle(
"<span id=\"redirectsub\">" .
806 $this->
getContext()->msg(
'redirectpagesub' )->parse() .
"</span>" );
811 # Should be unreachable, but just in case...
823 : ( $this->mParserOutput ?:
null );
825 # Adjust title for main page & pages with displaytitle
830 # For the main page, overwrite the <title> element with the con-
831 # tents of 'pagetitle-view-mainpage' instead of the default (if
833 # This message always exists because it is in the i18n files
834 if ( $this->
getTitle()->isMainPage() ) {
835 $msg =
wfMessage(
'pagetitle-view-mainpage' )->inContentLanguage();
836 if ( !$msg->isDisabled() ) {
837 $outputPage->setHTMLTitle( $msg->title( $this->getTitle() )->text() );
841 # Use adaptive TTLs for CDN so delayed/failed purges are noticed less often.
842 # This could use getTouched(), but that could be scary for major template edits.
843 $outputPage->adaptCdnTTL( $this->mPage->getTimestamp(), IExpiringStore::TTL_DAY );
845 # Check for any __NOINDEX__ tags on the page using $pOutput
847 $outputPage->setIndexPolicy( $policy[
'index'] );
848 $outputPage->setFollowPolicy( $policy[
'follow'] );
851 $this->mPage->doViewUpdates( $user, $oldid );
853 # Load the postEdit module if the user just saved this revision
854 # See also EditPage::setPostEditCookie
857 $postEdit =
$request->getCookie( $cookieKey );
859 # Clear the cookie. This also prevents caching of the response.
860 $request->response()->clearCookie( $cookieKey );
861 $outputPage->addJsConfigVars(
'wgPostEdit', $postEdit );
862 $outputPage->addModules(
'mediawiki.action.view.postEdit' );
885 # Adjust the title if it was set by displaytitle, -{T|}- or language conversion
886 $titleText = $pOutput->getTitleText();
887 if (
strval( $titleText ) !==
'' ) {
888 $out->setPageTitle( $titleText );
889 $out->setDisplayTitle( $titleText );
902 $diffOnly =
$request->getBool(
'diffonly', $user->getOption(
'diffonly' ) );
903 $purge =
$request->getVal(
'action' ) ==
'purge';
911 $msg = $this->
getContext()->msg(
'difference-missing-revision' )
915 $this->
getContext()->getOutput()->addHTML( $msg );
919 $contentHandler =
$rev->getContentHandler();
920 $de = $contentHandler->createDifferenceEngine(
930 $this->mRevIdFetched = $de->getNewid();
931 $de->showDiffPage( $diffOnly );
935 list( $old, $new ) = $de->mapDiffPrevNext( $oldid, $diff );
937 $this->mPage->doViewUpdates( $user, (
int)$new );
950 $ns = $this->
getTitle()->getNamespace();
952 # Don't index user and user talk pages for blocked users (T13443)
954 $specificTarget =
null;
956 $titleText = $this->
getTitle()->getText();
957 if ( IP::isValid( $titleText ) ) {
958 $vagueTarget = $titleText;
960 $specificTarget = $titleText;
964 'index' =>
'noindex',
965 'follow' =>
'nofollow'
970 if ( $this->mPage->getId() === 0 || $this->getOldID() ) {
971 # Non-articles (special pages etc), and old revisions
973 'index' =>
'noindex',
974 'follow' =>
'nofollow'
977 # Discourage indexing of printable versions, but encourage following
979 'index' =>
'noindex',
983 # For ?curid=x urls, disallow indexing
985 'index' =>
'noindex',
990 # Otherwise, construct the policy based on the various config variables.
994 # Honour customised robot policies for this namespace
1000 if ( $this->
getTitle()->canUseNoindex() &&
is_object( $pOutput ) && $pOutput->getIndexPolicy() ) {
1001 # __INDEX__ and __NOINDEX__ magic words, if allowed. Incorporates
1002 # a final sanity check that we have really got the parser output.
1005 [
'index' => $pOutput->getIndexPolicy() ]
1010 # (T16900) site config can override user-defined __INDEX__ or __NOINDEX__
1034 $policy = explode(
',', $policy );
1038 foreach ( $policy as $var ) {
1039 if (
in_array( $var, [
'index',
'noindex' ] ) ) {
1040 $arr[
'index'] =
$var;
1042 $arr[
'follow'] =
$var;
1060 $outputPage =
$context->getOutput();
1062 $rdfrom =
$request->getVal(
'rdfrom' );
1070 $query[
'redirect'] =
'no';
1074 if (
isset( $this->mRedirectedFrom ) ) {
1076 $articlePage =
$this;
1080 if ( Hooks::run(
'ArticleViewRedirect', [ &$articlePage ] ) ) {
1082 $this->mRedirectedFrom,
1085 [
'redirect' =>
'no' ]
1088 $outputPage->addSubtitle(
"<span class=\"mw-redirectedfrom\">" .
1089 $context->msg(
'redirectedfrom' )->rawParams( $redir )->parse()
1094 $outputPage->addJsConfigVars( [
1095 'wgInternalRedirectTargetUrl' => $redirectTargetUrl,
1097 $outputPage->addModules(
'mediawiki.action.view.redirect' );
1100 $outputPage->setCanonicalUrl( $this->
getTitle()->getCanonicalURL() );
1103 $outputPage->setRedirectedFrom( $this->mRedirectedFrom );
1112 $outputPage->addSubtitle(
"<span class=\"mw-redirectedfrom\">" .
1113 $context->msg(
'redirectedfrom' )->rawParams( $redir )->parse()
1117 $outputPage->addJsConfigVars( [
1118 'wgInternalRedirectTargetUrl' => $redirectTargetUrl,
1120 $outputPage->addModules(
'mediawiki.action.view.redirect' );
1134 if ( $this->
getTitle()->isTalkPage() && !
wfMessage(
'talkpageheader' )->isDisabled() ) {
1135 $this->
getContext()->getOutput()->wrapWikiMsg(
1136 "<div class=\"mw-talkpageheader\">\n$1\n</div>",
1137 [
'talkpageheader' ]
1146 # check if we're displaying a [[User talk:x.x.x.x]] anonymous talk page
1148 && IP::isValid( $this->
getTitle()->getText() )
1150 $this->
getContext()->getOutput()->addWikiMsg(
'anontalkpagetext' );
1156 Hooks::run(
'ArticleViewFooter', [ $this, $patrolFooterShown ] );
1172 if ( !Hooks::run(
'ArticleShowPatrolFooter', [ $this ] ) ) {
1176 $outputPage = $this->
getContext()->getOutput();
1181 if ( !$title->quickUserCan(
'patrol', $user )
1189 if ( $this->mRevision
1190 && !RecentChange::isInRCLifespan( $this->mRevision->getTimestamp(), 21600 )
1198 $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
1199 $key =
$cache->makeKey(
'unpatrollable-page', $title->getArticleID() );
1200 if (
$cache->get( $key ) ) {
1205 $oldestRevisionTimestamp =
$dbr->selectField(
1207 'MIN( rev_timestamp )',
1208 [
'rev_page' => $title->getArticleID() ],
1217 $recentPageCreation =
false;
1218 if ( $oldestRevisionTimestamp
1219 && RecentChange::isInRCLifespan( $oldestRevisionTimestamp, 21600 )
1222 $recentPageCreation =
true;
1223 $rc = RecentChange::newFromConds(
1226 'rc_timestamp' => $oldestRevisionTimestamp,
1227 'rc_namespace' => $title->getNamespace(),
1228 'rc_cur_id' => $title->getArticleID()
1234 $markPatrolledMsg =
wfMessage(
'markaspatrolledtext' );
1242 $recentFileUpload =
false;
1244 && $title->getNamespace() ===
NS_FILE ) {
1246 $newestUploadTimestamp =
$dbr->selectField(
1248 'MAX( img_timestamp )',
1249 [
'img_name' => $title->getDBkey() ],
1252 if ( $newestUploadTimestamp
1253 && RecentChange::isInRCLifespan( $newestUploadTimestamp, 21600 )
1256 $recentFileUpload =
true;
1257 $rc = RecentChange::newFromConds(
1260 'rc_log_type' =>
'upload',
1261 'rc_timestamp' => $newestUploadTimestamp,
1263 'rc_cur_id' => $title->getArticleID()
1269 $markPatrolledMsg =
wfMessage(
'markaspatrolledtext-file' );
1274 if ( !$recentPageCreation && !$recentFileUpload ) {
1279 $cache->set( $key,
'1' );
1291 if ( $rc->getAttribute(
'rc_patrolled' ) ) {
1296 $cache->set( $key,
'1' );
1301 if ( $rc->getPerformer()->equals( $user ) ) {
1307 $outputPage->preventClickjacking();
1308 if ( $user->isAllowed(
'writeapi' ) ) {
1309 $outputPage->addModules(
'mediawiki.page.patrol.ajax' );
1314 $markPatrolledMsg->escaped(),
1317 'action' =>
'markpatrolled',
1318 'rcid' => $rc->getAttribute(
'rc_id' ),
1322 $outputPage->addHTML(
1323 "<div class='patrollink' data-mw='interface'>" .
1324 wfMessage(
'markaspatrolledlink' )->rawParams(
$link )->escaped() .
1338 $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
1339 $cache->delete(
$cache->makeKey(
'unpatrollable-page', $articleID ) );
1349 $outputPage = $this->
getContext()->getOutput();
1351 $validUserPage =
false;
1355 # Show info in user (talk) namespace. Does the user exist? Is he blocked?
1356 if ( $title->getNamespace() == NS_USER
1359 $rootPart = explode(
'/', $title->getText() )[0];
1364 if ( !( $user && $user->isLoggedIn() ) && !$ip ) { #
User does not exist
1365 $outputPage->wrapWikiMsg(
"<div class=\"mw-userpage-userdoesnotexist error\">\n\$1\n</div>",
1370 ( $block->isSitewide() || $user->isBlockedFrom( $title ) )
1377 MWNamespace::getCanonicalName( NS_USER ) .
':' . $block->getTarget(),
1381 'showIfEmpty' =>
false,
1383 'blocked-notice-logextract',
1384 $user->getName() # Support GENDER in notice
1388 $validUserPage = !$title->isSubpage();
1390 $validUserPage = !$title->isSubpage();
1394 Hooks::run(
'ShowMissingArticle', [ $this ] );
1396 # Show delete and move logs if there were any such events.
1397 # The logging query can DOS the site when bots/crawlers cause 404 floods,
1398 # so be careful showing this. 404 pages must be cheap as they are hard to cache.
1399 $cache = MediaWikiServices::getInstance()->getMainObjectStash();
1400 $key =
$cache->makeKey(
'page-recent-delete',
md5( $title->getPrefixedText() ) );
1401 $loggedIn = $this->
getContext()->getUser()->isLoggedIn();
1402 $sessionExists = $this->
getContext()->getRequest()->getSession()->isPersistent();
1403 if ( $loggedIn ||
$cache->get( $key ) || $sessionExists ) {
1404 $logTypes = [
'delete',
'move',
'protect' ];
1408 $conds = [
'log_action != ' .
$dbr->addQuotes(
'revision' ) ];
1410 Hooks::run(
'Article::MissingArticleConditions', [ &$conds, $logTypes ] );
1419 'showIfEmpty' =>
false,
1420 'msgKey' => [ $loggedIn || $sessionExists
1421 ?
'moveddeleted-notice'
1422 :
'moveddeleted-notice-recent'
1431 $this->
getContext()->getRequest()->response()->statusHeader( 404 );
1436 $outputPage->setIndexPolicy( $policy[
'index'] );
1437 $outputPage->setFollowPolicy( $policy[
'follow'] );
1439 $hookResult = Hooks::run(
'BeforeDisplayNoArticleText', [ $this ] );
1441 if ( !$hookResult ) {
1445 # Show error message
1447 if ( !$oldid && $title->getNamespace() === NS_MEDIAWIKI && $title->hasSourceText() ) {
1449 $parserOptions = ParserOptions::newCanonical(
'canonical' );
1453 $text =
wfMessage(
'missing-revision', $oldid )->plain();
1454 }
elseif ( $title->quickUserCan(
'create', $this->getContext()->getUser() )
1455 && $title->quickUserCan(
'edit', $this->getContext()->getUser() )
1457 $message = $this->
getContext()->getUser()->isLoggedIn() ?
'noarticletext' :
'noarticletextanon';
1460 $text =
wfMessage(
'noarticletext-nopermission' )->plain();
1463 $dir = $this->
getContext()->getLanguage()->getDir();
1465 $outputPage->addWikiTextAsInterface( Xml::openElement(
'div', [
1466 'class' =>
"noarticletext mw-content-$dir",
1469 ] ) .
"\n$text\n</div>" );
1485 $outputPage = $this->
getContext()->getOutput();
1489 $outputPage->wrapWikiMsg(
"<div class='mw-warning plainlinks'>\n$1\n</div>\n",
1490 'rev-deleted-text-permission' );
1495 # Give explanation and add a link to view the revision...
1497 $link = $this->
getTitle()->getFullURL(
"oldid={$oldid}&unhide=1" );
1499 'rev-suppressed-text-unhide' :
'rev-deleted-text-unhide';
1500 $outputPage->wrapWikiMsg(
"<div class='mw-warning plainlinks'>\n$1\n</div>\n",
1507 'rev-suppressed-text-view' :
'rev-deleted-text-view';
1508 $outputPage->wrapWikiMsg(
"<div class='mw-warning plainlinks'>\n$1\n</div>\n", $msg );
1524 $articlePage =
$this;
1526 if ( !Hooks::run(
'DisplayOldSubtitle', [ &$articlePage, &$oldid ] ) ) {
1533 # Cascade unhide param in links for easy deletion browsing
1536 $extraParams[
'unhide'] = 1;
1539 if ( $this->mRevision && $this->mRevision->getId() === $oldid ) {
1545 $timestamp = $revision->getTimestamp();
1547 $current = ( $oldid == $this->mPage->getLatest() );
1548 $language =
$context->getLanguage();
1551 $td = $language->userTimeAndDate( $timestamp, $user );
1552 $tddate = $language->userDate( $timestamp, $user );
1553 $tdtime = $language->userTime( $timestamp, $user );
1555 # Show user links if allowed to see them. If hidden, then show them only if requested...
1558 $infomsg = $current && !
$context->msg(
'revision-info-current' )->isDisabled()
1559 ?
'revision-info-current'
1562 $outputPage =
$context->getOutput();
1563 $revisionInfo =
"<div id=\"mw-{$infomsg}\">" .
1565 ->rawParams( $userlinks )
1566 ->params( $revision->getId(), $tddate, $tdtime, $revision->getUserText() )
1572 ?
$context->msg(
'currentrevisionlink' )->escaped()
1575 $context->msg(
'currentrevisionlink' )->escaped(),
1580 ?
$context->msg(
'diff' )->escaped()
1583 $context->msg(
'diff' )->escaped(),
1590 $prev = $this->
getTitle()->getPreviousRevisionID( $oldid );
1594 $context->msg(
'previousrevision' )->escaped(),
1597 'direction' =>
'prev',
1601 :
$context->msg(
'previousrevision' )->escaped();
1605 $context->msg(
'diff' )->escaped(),
1612 :
$context->msg(
'diff' )->escaped();
1613 $nextlink = $current
1614 ?
$context->msg(
'nextrevision' )->escaped()
1617 $context->msg(
'nextrevision' )->escaped(),
1620 'direction' =>
'next',
1624 $nextdiff = $current
1625 ?
$context->msg(
'diff' )->escaped()
1628 $context->msg(
'diff' )->escaped(),
1637 if ( $cdel !==
'' ) {
1642 $outputPage->addSubtitle(
"<div class=\"mw-revision\">" . $revisionInfo .
1643 "<div id=\"mw-revision-nav\">" . $cdel .
1644 $context->msg(
'revision-nav' )->rawParams(
1645 $prevdiff, $prevlink, $lnk, $curdiff, $nextlink, $nextdiff
1646 )->escaped() .
"</div></div>" );
1662 public function viewRedirect( $target, $appendSubtitle =
true, $forceKnown =
false ) {
1665 if ( $appendSubtitle ) {
1668 $out->addModuleStyles(
'mediawiki.action.view.redirectPage' );
1669 return static::getRedirectHeaderHtml(
$lang, $target, $forceKnown );
1686 $target = [ $target ];
1689 $html =
'<ul class="redirectText">';
1691 foreach ( $target as $title ) {
1697 $title->isRedirect() ? [
'redirect' =>
'no' ] : [],
1698 ( $forceKnown ? [
'known',
'noclasses' ] : [] )
1703 $redirectToText =
wfMessage(
'redirectto' )->inLanguage(
$lang )->escaped();
1705 return '<div class="redirectMsg">' .
1706 '<p>' . $redirectToText .
'</p>' .
1721 'namespace-' . $this->
getTitle()->getNamespace() .
'-helppage'
1725 if ( !$msg->isDisabled() ) {
1726 $helpUrl = Skin::makeUrl( $msg->plain() );
1727 $out->addHelpLink( $helpUrl,
true );
1729 $out->addHelpLink( $to, $overrideBaseUrl );
1737 $this->
getContext()->getRequest()->response()->header(
'X-Robots-Tag: noindex' );
1738 $this->
getContext()->getOutput()->setArticleBodyOnly(
true );
1740 $this->viewIsRenderAction =
true;
1762 public function delete() {
1763 # This code desperately needs to be totally rewritten
1771 $permissionErrors = $title->getUserPermissionsErrors(
'delete', $user );
1772 if ( count( $permissionErrors ) ) {
1776 # Read-only check...
1781 # Better double-check that it hasn't been deleted yet!
1782 $this->mPage->loadPageData(
1783 $request->wasPosted() ? WikiPage::READ_LATEST : WikiPage::READ_NORMAL
1785 if ( !$this->mPage->exists() ) {
1786 $deleteLogPage =
new LogPage(
'delete' );
1787 $outputPage =
$context->getOutput();
1788 $outputPage->setPageTitle(
$context->msg(
'cannotdelete-title', $title->getPrefixedText() ) );
1789 $outputPage->wrapWikiMsg(
"<div class=\"error mw-error-cannotdelete\">\n$1\n</div>",
1792 $outputPage->addHTML(
1793 Xml::element(
'h2',
null, $deleteLogPage->getName()->text() )
1804 $deleteReasonList =
$request->getText(
'wpDeleteReasonList',
'other' );
1805 $deleteReason =
$request->getText(
'wpReason' );
1807 if ( $deleteReasonList ==
'other' ) {
1809 }
elseif ( $deleteReason !=
'' ) {
1811 $colonseparator =
wfMessage(
'colon-separator' )->inContentLanguage()->text();
1812 $reason = $deleteReasonList . $colonseparator .
$deleteReason;
1817 if (
$request->wasPosted() && $user->matchEditToken(
$request->getVal(
'wpEditToken' ),
1818 [
'delete', $this->getTitle()->getPrefixedText() ] )
1820 # Flag to hide all contents of the archived revisions
1821 $suppress =
$request->getCheck(
'wpSuppress' ) && $user->isAllowed(
'suppressrevision' );
1823 $this->
doDelete( $reason, $suppress );
1831 $hasHistory =
false;
1835 }
catch ( Exception
$e ) {
1836 # if a page is horribly broken, we still want to be able to
1837 # delete it. So be lenient about errors here.
1838 wfDebug(
"Error while building auto delete summary: $e" );
1844 if ( $hasHistory ) {
1853 $revisions = $edits = (
int)
$dbr->selectField(
1856 [
'rev_page' => $title->getArticleID() ],
1862 '<strong class="mw-delete-warning-revisions">' .
1863 $context->msg(
'historywarning' )->numParams( $revisions )->parse() .
1865 $context->msg(
'history' )->escaped(),
1867 [
'action' =>
'history' ] ) .
1871 if ( $title->isBigDeletion() ) {
1873 $context->getOutput()->wrapWikiMsg(
"<div class='error'>\n$1\n</div>\n",
1875 'delete-warning-toobig',
1891 wfDebug(
"Article::confirmDelete\n" );
1895 $outputPage = $ctx->getOutput();
1896 $outputPage->setPageTitle(
wfMessage(
'delete-confirm', $title->getPrefixedText() ) );
1897 $outputPage->addBacklinkSubtitle( $title );
1898 $outputPage->setRobotPolicy(
'noindex,nofollow' );
1899 $outputPage->addModules(
'mediawiki.action.delete' );
1901 $backlinkCache = $title->getBacklinkCache();
1902 if ( $backlinkCache->hasLinks(
'pagelinks' ) || $backlinkCache->hasLinks(
'templatelinks' ) ) {
1903 $outputPage->wrapWikiMsg(
"<div class='mw-warning plainlinks'>\n$1\n</div>\n",
1904 'deleting-backlinks-warning' );
1907 $subpageQueryLimit = 51;
1908 $subpages = $title->getSubpages( $subpageQueryLimit );
1909 $subpageCount = count( $subpages );
1910 if ( $subpageCount > 0 ) {
1911 $outputPage->wrapWikiMsg(
"<div class='mw-warning plainlinks'>\n$1\n</div>\n",
1912 [
'deleting-subpages-warning', Message::numParam( $subpageCount ) ] );
1914 $outputPage->addWikiMsg(
'confirmdeletetext' );
1916 Hooks::run(
'ArticleConfirmDelete', [ $this, $outputPage, &$reason ] );
1919 $checkWatch = $user->getBoolOption(
'watchdeletion' ) || $user->isWatched( $title );
1921 $outputPage->enableOOUI();
1923 $options = Xml::listDropDownOptions(
1924 $ctx->msg(
'deletereason-dropdown' )->inContentLanguage()->text(),
1925 [
'other' => $ctx->msg(
'deletereasonotherlist' )->inContentLanguage()->text() ]
1929 $fields[] =
new OOUI\FieldLayout(
1930 new OOUI\DropdownInputWidget( [
1931 'name' =>
'wpDeleteReasonList',
1932 'inputId' =>
'wpDeleteReasonList',
1934 'infusable' =>
true,
1939 'label' => $ctx->msg(
'deletecomment' )->text(),
1947 $fields[] =
new OOUI\FieldLayout(
1948 new OOUI\TextInputWidget( [
1949 'name' =>
'wpReason',
1950 'inputId' =>
'wpReason',
1952 'maxLength' => 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(
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(
1982 'name' =>
'wpSuppress',
1983 'inputId' =>
'wpSuppress',
1987 'label' => $ctx->msg(
'revdelete-suppress' )->text(),
1988 'align' =>
'inline',
1989 'infusable' =>
true,
1994 $fields[] =
new OOUI\FieldLayout(
1996 'name' =>
'wpConfirmB',
1997 'inputId' =>
'wpConfirmB',
1999 'value' => $ctx->msg(
'deletepage' )->text(),
2000 'label' => $ctx->msg(
'deletepage' )->text(),
2001 'flags' => [
'primary',
'destructive' ],
2010 'label' => $ctx->msg(
'delete-legend' )->text(),
2011 'id' =>
'mw-delete-table',
2017 'action' => $title->getLocalURL(
'action=delete' ),
2018 'id' =>
'deleteconfirm',
2020 $form->appendContent(
2023 Html::hidden(
'wpEditToken', $user->getEditToken( [
'delete', $title->getPrefixedText() ] ) )
2027 $outputPage->addHTML(
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->wrapWikiTextAsInterface(
2091 'error mw-error-cannotdelete',
2094 $deleteLogPage =
new LogPage(
'delete' );
2095 $outputPage->addHTML( Xml::element(
'h2',
null, $deleteLogPage->getName()->text() ) );
2103 $outputPage->addHTML( $error );
2118 static $called =
false;
2121 wfDebug(
"Article::tryFileCache(): called twice!?\n" );
2128 if (
$cache->isCacheGood( $this->mPage->getTouched() ) ) {
2129 wfDebug(
"Article::tryFileCache(): about to load file\n" );
2133 wfDebug(
"Article::tryFileCache(): starting buffer\n" );
2137 wfDebug(
"Article::tryFileCache(): not cacheable\n" );
2152 $cacheable = $this->mPage->getId()
2153 && !$this->mRedirectedFrom && !$this->
getTitle()->isRedirect();
2157 $articlePage =
$this;
2158 $cacheable = Hooks::run(
'IsFileCacheable', [ &$articlePage ] );
2181 if ( $user ===
null ) {
2184 $parserOptions = $this->mPage->makeParserOptions( $user );
2187 return $this->mPage->getParserOutput( $parserOptions, $oldid );
2197 if ( $this->mParserOptions ) {
2198 throw new MWException(
"can't change parser options after they have already been set" );
2202 $this->mParserOptions = clone
$options;
2210 if ( !$this->mParserOptions ) {
2211 $this->mParserOptions = $this->mPage->makeParserOptions( $this->
getContext() );
2237 wfDebug( __METHOD__ .
" called and \$mContext is null. " .
2238 "Return RequestContext::getMain(); for sanity\n" );
2239 return RequestContext::getMain();
2252 # wfWarn( "Access to raw $fname field " . __CLASS__ );
2253 return $this->mPage->$fname;
2267 # wfWarn( "Access to raw $fname field of " . __CLASS__ );
2268 $this->mPage->$fname =
$fvalue;
2271 $this->mPage->$fname =
$fvalue;
2282 return $this->mPage->checkFlags( $flags );
2290 return $this->mPage->checkTouched();
2298 $this->mPage->clearPreparedEdit();
2306 $reason, $suppress =
false, $u1 =
null, $u2 =
null, &$error =
'',
User $user =
null,
2307 $tags = [], $immediate =
false
2309 return $this->mPage->doDeleteArticleReal(
2310 $reason, $suppress, $u1, $u2, $error, $user, $tags,
'delete', $immediate
2324 $this->mPage->doDeleteUpdates( $id,
$content, $revision, $user );
2333 User $user =
null, $serialFormat =
null
2336 return $this->mPage->doEditContent(
$content, $summary, $flags, $originalRevId,
2337 $user, $serialFormat
2346 return $this->mPage->doEditUpdates( $revision, $user,
$options );
2356 return $this->mPage->doPurge();
2364 $this->mPage->doViewUpdates( $user, $oldid );
2372 return $this->mPage->exists();
2380 return $this->mPage->followRedirect();
2388 return $this->mPage->getActionOverrides();
2396 return $this->mPage->getAutoDeleteReason( $hasHistory );
2404 return $this->mPage->getCategories();
2412 return $this->mPage->getComment( $audience, $user );
2420 return $this->mPage->getContentHandler();
2428 return $this->mPage->getContentModel();
2436 return $this->mPage->getContributors();
2444 return $this->mPage->getCreator( $audience, $user );
2452 return $this->mPage->getDeletionUpdates(
$content );
2460 return $this->mPage->getHiddenCategories();
2468 return $this->mPage->getId();
2476 return $this->mPage->getLatest();
2484 return $this->mPage->getLinksTimestamp();
2492 return $this->mPage->getMinorEdit();
2500 return $this->mPage->getOldestRevision();
2508 return $this->mPage->getRedirectTarget();
2516 return $this->mPage->getRedirectURL( $rt );
2524 return $this->mPage->getRevision();
2532 return $this->mPage->getTimestamp();
2540 return $this->mPage->getTouched();
2548 return $this->mPage->getUndoContent( $undo, $undoafter );
2556 return $this->mPage->getUser( $audience, $user );
2564 return $this->mPage->getUserText( $audience, $user );
2572 return $this->mPage->hasViewableContent();
2580 return $this->mPage->insertOn( $dbw, $pageId );
2588 array $expiry, $cascade, $reason, $user =
null
2590 return $this->mPage->insertProtectNullRevision( $revCommentMsg, $limit,
2591 $expiry, $cascade, $reason, $user
2600 return $this->mPage->insertRedirect();
2608 return $this->mPage->insertRedirectEntry( $rt, $oldLatest );
2616 return $this->mPage->isCountable( $editInfo );
2624 return $this->mPage->isRedirect();
2632 return $this->mPage->loadFromRow(
$data, $from );
2640 $this->mPage->loadPageData( $from );
2648 return $this->mPage->lockAndGetLatest();
2656 return $this->mPage->makeParserOptions(
$context );
2664 return $this->mPage->pageDataFromId(
$dbr, $id,
$options );
2672 return $this->mPage->pageDataFromTitle(
$dbr, $title,
$options );
2681 $serialFormat =
null, $useCache =
true
2683 return $this->mPage->prepareContentForEdit(
2685 $serialFormat, $useCache
2694 return $this->mPage->protectDescription( $limit, $expiry );
2702 return $this->mPage->protectDescriptionLog( $limit, $expiry );
2710 $sectionTitle =
'', $baseRevId =
null
2712 return $this->mPage->replaceSectionAtRev( $sectionId, $sectionContent,
2713 $sectionTitle, $baseRevId
2722 $sectionId,
Content $sectionContent, $sectionTitle =
'', $edittime =
null
2724 return $this->mPage->replaceSectionContent(
2725 $sectionId, $sectionContent, $sectionTitle, $edittime
2734 $this->mPage->setTimestamp( $ts );
2742 return $this->mPage->shouldCheckParserCache( $parserOptions, $oldId );
2750 return $this->mPage->supportsSections();
2758 return $this->mPage->triggerOpportunisticLinksUpdate( $parserOutput );
2766 return $this->mPage->updateCategoryCounts( $added, $deleted, $id );
2774 return $this->mPage->updateIfNewerOn( $dbw, $revision );
2782 return $this->mPage->updateRedirectOn( $dbw, $redirectTitle, $lastRevIsRedirect );
2790 $lastRevIsRedirect =
null
2792 return $this->mPage->updateRevisionOn( $dbw, $revision, $lastRevision,
2808 return $this->mPage->doUpdateRestrictions( $limit, $expiry, $cascade, $reason, $user );
2819 &$cascade = 0, $expiry = []
2821 return $this->mPage->doUpdateRestrictions(
2842 $reason, $suppress =
false, $u1 =
null, $u2 =
null, &$error =
'', $immediate =
false
2844 return $this->mPage->doDeleteArticle( $reason, $suppress, $u1, $u2, $error,
2857 public function doRollback( $fromP, $summary, $token, $bot, &$resultDetails,
User $user =
null ) {
2862 return $this->mPage->doRollback( $fromP, $summary, $token, $bot, $resultDetails, $user );
2878 return $this->mPage->commitRollback( $fromP, $summary, $bot, $resultDetails, $guser );
2886 $title = $this->mPage->getTitle();
2887 $handler = ContentHandler::getForTitle( $title );
2888 return $handler->getAutoDeleteReason( $title, $hasHistory );
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
$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.
bool $viewIsRenderAction
Whether render() was called.
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.
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, $useParentheses=true)
Wrap and format the given revision's comment block, if the current user is allowed to view it.
static revUserTools( $rev, $isPublic=false, $useParentheses=true)
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
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not it can be in the form of< username >< more info > e g for bot passwords intended to be added to log contexts Fields it might only if the login was with a bot password 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
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not it can be in the form of< username >< more info > e g for bot passwords intended to be added to log contexts Fields it might only if the login was with a bot password 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 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
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not null
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
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
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
returning false will NOT prevent logging $e
$data
Utility to generate mapping file used in mw.Title (phpCharToUpper.json)
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