83 $this->mOldId = $oldId;
84 $this->mPage = $this->
newPage( $title );
102 return $t == null ? null :
new static(
$t );
121 switch (
$title->getNamespace() ) {
132 $page->setContext( $context );
165 $this->mRedirectedFrom =
$from;
174 return $this->mPage->getTitle();
191 $this->mContentLoaded =
false;
193 $this->mRedirectedFrom = null; #
Title object if set
194 $this->mRevIdFetched = 0;
195 $this->mRedirectUrl =
false;
197 $this->mPage->clear();
235 if ( $this->mPage->getId() === 0 ) {
236 # If this is a MediaWiki:x message, then load the messages
237 # and return the message value for x.
239 $text = $this->
getTitle()->getDefaultMessageText();
240 if ( $text ===
false ) {
246 $message = $this->
getContext()->getUser()->isLoggedIn() ?
'noarticletext' :
'noarticletextanon';
261 if ( is_null( $this->mOldId ) ) {
274 $this->mRedirectUrl =
false;
277 $oldid =
$request->getIntOrNull(
'oldid' );
279 if ( $oldid === null ) {
283 if ( $oldid !== 0 ) {
284 # Load the given revision and check whether the page is another one.
285 # In that case, update this instance to reflect the change.
286 if ( $oldid === $this->mPage->getLatest() ) {
287 $this->mRevision = $this->mPage->getRevision();
290 if ( $this->mRevision !== null ) {
292 if ( $this->mPage->getId() != $this->mRevision->getPage() ) {
293 $function = [ get_class( $this->mPage ),
'newFromID' ];
294 $this->mPage = call_user_func( $function, $this->mRevision->getPage() );
300 if (
$request->getVal(
'direction' ) ==
'next' ) {
301 $nextid = $this->
getTitle()->getNextRevisionID( $oldid );
304 $this->mRevision = null;
306 $this->mRedirectUrl = $this->
getTitle()->getFullURL(
'redirect=no' );
308 } elseif (
$request->getVal(
'direction' ) ==
'prev' ) {
309 $previd = $this->
getTitle()->getPreviousRevisionID( $oldid );
312 $this->mRevision = null;
338 if ( $this->mContentLoaded && $this->mContent ) {
351 'ArticleAfterFetchContent',
352 [ &$this, &$this->mContent ],
372 if ( $this->mContentLoaded ) {
376 $this->mContentLoaded =
true;
377 $this->mContent = null;
381 # Pre-fill content with error message so that if something
382 # fails we'll have something telling us what we intended.
384 $this->mContentObject =
new MessageContent(
'missing-revision', [ $oldid ] );
387 # $this->mRevision might already be fetched by getOldIDFromRequest()
388 if ( !$this->mRevision ) {
390 if ( !$this->mRevision ) {
391 wfDebug( __METHOD__ .
" failed to retrieve specified revision, id $oldid\n" );
396 $oldid = $this->mPage->getLatest();
398 wfDebug( __METHOD__ .
" failed to find page data for title " .
399 $this->
getTitle()->getPrefixedText() .
"\n" );
403 # Update error message with correct oldid
404 $this->mContentObject =
new MessageContent(
'missing-revision', [ $oldid ] );
406 $this->mRevision = $this->mPage->getRevision();
408 if ( !$this->mRevision ) {
409 wfDebug( __METHOD__ .
" failed to retrieve current page, rev_id $oldid\n" );
417 $content = $this->mRevision->getContent(
423 wfDebug( __METHOD__ .
" failed to retrieve content of revision " .
424 $this->mRevision->getId() .
"\n" );
429 $this->mRevIdFetched = $this->mRevision->getId();
432 'ArticleAfterFetchContentObject',
433 [ &$this, &$this->mContentObject ],
446 # If no oldid, this is the current version.
451 return $this->mPage->exists() && $this->mRevision && $this->mRevision->isCurrent();
473 if ( $this->mRevIdFetched ) {
476 return $this->mPage->getLatest();
487 # Get variables from query string
488 # As side effect this will load the revision and update the title
489 # in a revision ID is passed in the request, so this should remain
490 # the first call of this method even if $oldid is used way below.
494 # Another whitelist check in case getOldID() is altering the title
495 $permErrors = $this->
getTitle()->getUserPermissionsErrors(
'read',
$user );
496 if ( count( $permErrors ) ) {
497 wfDebug( __METHOD__ .
": denied on secondary read check\n" );
501 $outputPage = $this->
getContext()->getOutput();
502 # getOldID() may as well want us to redirect somewhere else
503 if ( $this->mRedirectUrl ) {
504 $outputPage->redirect( $this->mRedirectUrl );
505 wfDebug( __METHOD__ .
": redirecting due to oldid\n" );
510 # If we got diff in the query, we want to see a diff page instead of the article.
511 if ( $this->
getContext()->getRequest()->getCheck(
'diff' ) ) {
512 wfDebug( __METHOD__ .
": showing diff page\n" );
518 # Set page title (may be overridden by DISPLAYTITLE)
519 $outputPage->setPageTitle( $this->
getTitle()->getPrefixedText() );
521 $outputPage->setArticleFlag(
true );
522 # Allow frames by default
523 $outputPage->allowClickjacking();
528 # Render printable version, use printable version cache
529 if ( $outputPage->isPrintable() ) {
530 $parserOptions->setIsPrintable(
true );
531 $parserOptions->setEditSection(
false );
533 $parserOptions->setEditSection(
false );
536 # Try client and file cache
537 if ( !$wgDebugToolbar && $oldid === 0 && $this->mPage->checkTouched() ) {
538 # Try to stream the output from file cache
540 wfDebug( __METHOD__ .
": done file cache\n" );
541 # tell wgOut that output is taken care of
542 $outputPage->disable();
543 $this->mPage->doViewUpdates(
$user, $oldid );
549 # Should the parser cache be used?
550 $useParserCache = $this->mPage->shouldCheckParserCache( $parserOptions, $oldid );
551 wfDebug(
'Article::view using parser cache: ' . ( $useParserCache ?
'yes' :
'no' ) .
"\n" );
552 if (
$user->getStubThreshold() ) {
553 $this->
getContext()->getStats()->increment(
'pcache_miss_stub' );
559 # Iterate through the possible ways of constructing the output text.
560 # Keep going until $outputDone is set, or we run out of things to do.
563 $this->mParserOutput =
false;
565 while ( !$outputDone && ++$pass ) {
568 Hooks::run(
'ArticleViewHeader', [ &$this, &$outputDone, &$useParserCache ] );
571 # Early abort if the page doesn't exist
572 if ( !$this->mPage->exists() ) {
573 wfDebug( __METHOD__ .
": showing missing article\n" );
575 $this->mPage->doViewUpdates(
$user );
579 # Try the parser cache
580 if ( $useParserCache ) {
581 $this->mParserOutput = $parserCache->get( $this->mPage, $parserOptions );
583 if ( $this->mParserOutput !==
false ) {
585 wfDebug( __METHOD__ .
": showing parser cache contents for current rev permalink\n" );
588 wfDebug( __METHOD__ .
": showing parser cache contents\n" );
590 $outputPage->addParserOutput( $this->mParserOutput );
591 # Ensure that UI elements requiring revision ID have
592 # the correct version information.
593 $outputPage->setRevisionId( $this->mPage->getLatest() );
594 # Preload timestamp to avoid a DB hit
595 $cachedTimestamp = $this->mParserOutput->getTimestamp();
596 if ( $cachedTimestamp !== null ) {
597 $outputPage->setRevisionTimestamp( $cachedTimestamp );
598 $this->mPage->setTimestamp( $cachedTimestamp );
605 # This will set $this->mRevision if needed
608 # Are we looking at an old revision
609 if ( $oldid && $this->mRevision ) {
613 wfDebug( __METHOD__ .
": cannot view deleted revision\n" );
618 # Ensure that UI elements requiring revision ID have
619 # the correct version information.
621 # Preload timestamp to avoid a DB hit
622 $outputPage->setRevisionTimestamp( $this->mPage->getTimestamp() );
624 # Pages containing custom CSS or JavaScript get special treatment
625 if ( $this->
getTitle()->isCssOrJsPage() || $this->
getTitle()->isCssJsSubpage() ) {
626 wfDebug( __METHOD__ .
": showing CSS/JS source\n" );
629 } elseif ( !
Hooks::run(
'ArticleContentViewCustom',
632 # Allow extensions do their own custom view for certain pages
639 # Allow extensions do their own custom view for certain pages
644 # Run the parse, protected by a pool counter
645 wfDebug( __METHOD__ .
": doing uncached parse\n" );
651 if ( !$poolArticleView->execute() ) {
652 $error = $poolArticleView->getError();
654 $outputPage->clearHTML();
655 $outputPage->enableClientCache(
false );
656 $outputPage->setRobotPolicy(
'noindex,nofollow' );
658 $errortext = $error->getWikiText(
false,
'view-pool-error' );
659 $outputPage->addWikiText(
'<div class="errorbox">' . $errortext .
'</div>' );
661 # Connection or timeout error
665 $this->mParserOutput = $poolArticleView->getParserOutput();
666 $outputPage->addParserOutput( $this->mParserOutput );
667 if (
$content->getRedirectTarget() ) {
668 $outputPage->addSubtitle(
"<span id=\"redirectsub\">" .
669 $this->
getContext()->msg(
'redirectpagesub' )->parse() .
"</span>" );
672 # Don't cache a dirty ParserOutput object
673 if ( $poolArticleView->getIsDirty() ) {
674 $outputPage->setCdnMaxage( 0 );
675 $outputPage->addHTML(
"<!-- parser cache is expired, " .
676 "sending anyway due to pool overload-->\n" );
681 # Should be unreachable, but just in case...
687 # Get the ParserOutput actually *displayed* here.
688 # Note that $this->mParserOutput is the *current*/oldid version output.
691 : $this->mParserOutput;
693 # Adjust title for main page & pages with displaytitle
698 # For the main page, overwrite the <title> element with the con-
699 # tents of 'pagetitle-view-mainpage' instead of the default (if
701 # This message always exists because it is in the i18n files
702 if ( $this->
getTitle()->isMainPage() ) {
703 $msg =
wfMessage(
'pagetitle-view-mainpage' )->inContentLanguage();
704 if ( !$msg->isDisabled() ) {
705 $outputPage->setHTMLTitle( $msg->title( $this->getTitle() )->
text() );
709 # Use adaptive TTLs for CDN so delayed/failed purges are noticed less often.
710 # This could use getTouched(), but that could be scary for major template edits.
713 # Check for any __NOINDEX__ tags on the page using $pOutput
715 $outputPage->setIndexPolicy( $policy[
'index'] );
716 $outputPage->setFollowPolicy( $policy[
'follow'] );
719 $this->mPage->doViewUpdates(
$user, $oldid );
721 $outputPage->addModules(
'mediawiki.action.view.postEdit' );
729 # Adjust the title if it was set by displaytitle, -{T|}- or language conversion
731 if ( strval( $titleText ) !==
'' ) {
732 $this->
getContext()->getOutput()->setPageTitle( $titleText );
746 $diffOnly =
$request->getBool(
'diffonly',
$user->getOption(
'diffonly' ) );
747 $purge =
$request->getVal(
'action' ) ==
'purge';
755 $msg = $this->
getContext()->msg(
'difference-missing-revision' )
759 $this->
getContext()->getOutput()->addHTML( $msg );
763 $contentHandler =
$rev->getContentHandler();
764 $de = $contentHandler->createDifferenceEngine(
774 $this->mRevIdFetched = $de->mNewid;
775 $de->showDiffPage( $diffOnly );
779 list( $old, $new ) = $de->mapDiffPrevNext( $oldid, $diff );
781 $this->mPage->doViewUpdates(
$user, (
int)$new );
796 $outputPage = $this->
getContext()->getOutput();
798 if ( $showCacheHint ) {
802 $outputPage->wrapWikiMsg(
803 "<div id='mw-clearyourcache' lang='$lang' dir='$dir' class='mw-content-$dir'>\n$1\n</div>",
810 if ( $this->mContentObject ) {
814 [ $this->mContentObject, $this->
getTitle(), $outputPage ],
819 $po = $this->mContentObject->getParserOutput( $this->
getTitle() );
820 $outputPage->addParserOutputContent( $po );
833 global $wgArticleRobotPolicies, $wgNamespaceRobotPolicies, $wgDefaultRobotPolicy;
835 $ns = $this->
getTitle()->getNamespace();
837 # Don't index user and user talk pages for blocked users (bug 11443)
839 $specificTarget = null;
841 $titleText = $this->
getTitle()->getText();
843 $vagueTarget = $titleText;
845 $specificTarget = $titleText;
849 'index' =>
'noindex',
850 'follow' =>
'nofollow'
855 if ( $this->mPage->getId() === 0 || $this->
getOldID() ) {
856 # Non-articles (special pages etc), and old revisions
858 'index' =>
'noindex',
859 'follow' =>
'nofollow'
861 } elseif ( $this->
getContext()->getOutput()->isPrintable() ) {
862 # Discourage indexing of printable versions, but encourage following
864 'index' =>
'noindex',
867 } elseif ( $this->
getContext()->getRequest()->getInt(
'curid' ) ) {
868 # For ?curid=x urls, disallow indexing
870 'index' =>
'noindex',
875 # Otherwise, construct the policy based on the various config variables.
876 $policy = self::formatRobotPolicy( $wgDefaultRobotPolicy );
878 if ( isset( $wgNamespaceRobotPolicies[$ns] ) ) {
879 # Honour customised robot policies for this namespace
880 $policy = array_merge(
882 self::formatRobotPolicy( $wgNamespaceRobotPolicies[$ns] )
885 if ( $this->
getTitle()->canUseNoindex() && is_object( $pOutput ) && $pOutput->getIndexPolicy() ) {
886 # __INDEX__ and __NOINDEX__ magic words, if allowed. Incorporates
887 # a final sanity check that we have really got the parser output.
888 $policy = array_merge(
890 [
'index' => $pOutput->getIndexPolicy() ]
894 if ( isset( $wgArticleRobotPolicies[$this->
getTitle()->getPrefixedText()] ) ) {
895 # (bug 14900) site config can override user-defined __INDEX__ or __NOINDEX__
896 $policy = array_merge(
898 self::formatRobotPolicy( $wgArticleRobotPolicies[$this->
getTitle()->getPrefixedText()] )
913 if ( is_array( $policy ) ) {
915 } elseif ( !$policy ) {
919 $policy = explode(
',', $policy );
920 $policy = array_map(
'trim', $policy );
923 foreach ( $policy
as $var ) {
924 if ( in_array( $var, [
'index',
'noindex' ] ) ) {
925 $arr[
'index'] = $var;
926 } elseif ( in_array( $var, [
'follow',
'nofollow' ] ) ) {
927 $arr[
'follow'] = $var;
945 $outputPage =
$context->getOutput();
947 $rdfrom =
$request->getVal(
'rdfrom' );
951 unset(
$query[
'rdfrom'] );
955 $query[
'redirect'] =
'no';
959 if ( isset( $this->mRedirectedFrom ) ) {
962 if (
Hooks::run(
'ArticleViewRedirect', [ &$this ] ) ) {
964 $this->mRedirectedFrom,
967 [
'redirect' =>
'no' ]
970 $outputPage->addSubtitle(
"<span class=\"mw-redirectedfrom\">" .
971 $context->msg(
'redirectedfrom' )->rawParams( $redir )->parse()
976 $outputPage->addJsConfigVars( [
977 'wgInternalRedirectTargetUrl' => $redirectTargetUrl,
979 $outputPage->addModules(
'mediawiki.action.view.redirect' );
982 $outputPage->setCanonicalUrl( $this->
getTitle()->getCanonicalURL() );
985 $outputPage->setRedirectedFrom( $this->mRedirectedFrom );
989 } elseif ( $rdfrom ) {
992 if ( $wgRedirectSources && preg_match( $wgRedirectSources, $rdfrom ) ) {
994 $outputPage->addSubtitle(
"<span class=\"mw-redirectedfrom\">" .
995 $context->msg(
'redirectedfrom' )->rawParams( $redir )->parse()
999 $outputPage->addJsConfigVars( [
1000 'wgInternalRedirectTargetUrl' => $redirectTargetUrl,
1002 $outputPage->addModules(
'mediawiki.action.view.redirect' );
1016 if ( $this->
getTitle()->isTalkPage() ) {
1017 if ( !
wfMessage(
'talkpageheader' )->isDisabled() ) {
1018 $this->
getContext()->getOutput()->wrapWikiMsg(
1019 "<div class=\"mw-talkpageheader\">\n$1\n</div>",
1020 [
'talkpageheader' ]
1030 # check if we're displaying a [[User talk:x.x.x.x]] anonymous talk page
1034 $this->
getContext()->getOutput()->addWikiMsg(
'anontalkpagetext' );
1040 Hooks::run(
'ArticleViewFooter', [ $this, $patrolFooterShown ] );
1053 global $wgUseNPPatrol, $wgUseRCPatrol, $wgUseFilePatrol, $wgEnableAPI, $wgEnableWriteAPI;
1055 $outputPage = $this->
getContext()->getOutput();
1061 || !( $wgUseRCPatrol || $wgUseNPPatrol
1068 if ( $this->mRevision
1079 if ( $cache->get( $key ) ) {
1084 $oldestRevisionTimestamp =
$dbr->selectField(
1086 'MIN( rev_timestamp )',
1087 [
'rev_page' =>
$title->getArticleID() ],
1096 $recentPageCreation =
false;
1097 if ( $oldestRevisionTimestamp
1101 $recentPageCreation =
true;
1105 'rc_timestamp' => $oldestRevisionTimestamp,
1106 'rc_namespace' =>
$title->getNamespace(),
1107 'rc_cur_id' =>
$title->getArticleID()
1113 $markPatrolledMsg =
wfMessage(
'markaspatrolledtext' );
1121 $recentFileUpload =
false;
1122 if ( ( !$rc || $rc->getAttribute(
'rc_patrolled' ) ) && $wgUseFilePatrol
1125 $newestUploadTimestamp =
$dbr->selectField(
1127 'MAX( img_timestamp )',
1128 [
'img_name' =>
$title->getDBkey() ],
1131 if ( $newestUploadTimestamp
1135 $recentFileUpload =
true;
1139 'rc_log_type' =>
'upload',
1140 'rc_timestamp' => $newestUploadTimestamp,
1142 'rc_cur_id' =>
$title->getArticleID()
1145 [
'USE INDEX' =>
'rc_timestamp' ]
1149 $markPatrolledMsg =
wfMessage(
'markaspatrolledtext-file' );
1154 if ( !$recentPageCreation && !$recentFileUpload ) {
1159 $cache->set( $key,
'1' );
1171 if ( $rc->getAttribute(
'rc_patrolled' ) ) {
1176 $cache->set( $key,
'1' );
1181 if ( $rc->getPerformer()->equals(
$user ) ) {
1187 $rcid = $rc->getAttribute(
'rc_id' );
1189 $token =
$user->getEditToken( $rcid );
1191 $outputPage->preventClickjacking();
1192 if ( $wgEnableAPI && $wgEnableWriteAPI &&
$user->isAllowed(
'writeapi' ) ) {
1193 $outputPage->addModules(
'mediawiki.page.patrol.ajax' );
1198 $markPatrolledMsg->escaped(),
1201 'action' =>
'markpatrolled',
1207 $outputPage->addHTML(
1208 "<div class='patrollink' data-mw='interface'>" .
1209 wfMessage(
'markaspatrolledlink' )->rawParams(
$link )->escaped() .
1234 $outputPage = $this->
getContext()->getOutput();
1236 $validUserPage =
false;
1240 # Show info in user (talk) namespace. Does the user exist? Is he blocked?
1244 $rootPart = explode(
'/',
$title->getText() )[0];
1249 if ( !( $user && $user->isLoggedIn() ) && !$ip ) { #
User does
not exist
1250 $outputPage->wrapWikiMsg(
"<div class=\"mw-userpage-userdoesnotexist error\">\n\$1\n</div>",
1253 # Show log extract if the user is currently blocked
1261 'showIfEmpty' =>
false,
1263 'blocked-notice-logextract',
1264 $user->getName() # Support GENDER
in notice
1268 $validUserPage = !
$title->isSubpage();
1270 $validUserPage = !
$title->isSubpage();
1274 Hooks::run(
'ShowMissingArticle', [ $this ] );
1276 # Show delete and move logs if there were any such events.
1277 # The logging query can DOS the site when bots/crawlers cause 404 floods,
1278 # so be careful showing this. 404 pages must be cheap as they are hard to cache.
1280 $key =
wfMemcKey(
'page-recent-delete', md5(
$title->getPrefixedText() ) );
1281 $loggedIn = $this->
getContext()->getUser()->isLoggedIn();
1282 if ( $loggedIn ||
$cache->get( $key ) ) {
1283 $logTypes = [
'delete',
'move' ];
1284 $conds = [
"log_action != 'revision'" ];
1286 Hooks::run(
'Article::MissingArticleConditions', [ &$conds, $logTypes ] );
1295 'showIfEmpty' =>
false,
1296 'msgKey' => [ $loggedIn
1297 ?
'moveddeleted-notice'
1298 :
'moveddeleted-notice-recent'
1304 if ( !$this->mPage->hasViewableContent() && $wgSend404Code && !$validUserPage ) {
1307 $this->
getContext()->getRequest()->response()->statusHeader( 404 );
1312 $outputPage->setIndexPolicy( $policy[
'index'] );
1313 $outputPage->setFollowPolicy( $policy[
'follow'] );
1315 $hookResult =
Hooks::run(
'BeforeDisplayNoArticleText', [ $this ] );
1317 if ( !$hookResult ) {
1321 # Show error message
1327 $text =
wfMessage(
'missing-revision', $oldid )->plain();
1328 } elseif (
$title->quickUserCan(
'create', $this->getContext()->getUser() )
1329 &&
$title->quickUserCan(
'edit', $this->getContext()->getUser() )
1331 $message = $this->
getContext()->getUser()->isLoggedIn() ?
'noarticletext' :
'noarticletextanon';
1334 $text =
wfMessage(
'noarticletext-nopermission' )->plain();
1340 'class' =>
"noarticletext mw-content-$dir",
1343 ] ) .
"\n$text\n</div>" );
1359 $outputPage = $this->
getContext()->getOutput();
1363 $outputPage->wrapWikiMsg(
"<div class='mw-warning plainlinks'>\n$1\n</div>\n",
1364 'rev-deleted-text-permission' );
1368 } elseif ( $this->
getContext()->getRequest()->getInt(
'unhide' ) != 1 ) {
1369 # Give explanation and add a link to view the revision...
1370 $oldid = intval( $this->
getOldID() );
1371 $link = $this->
getTitle()->getFullURL(
"oldid={$oldid}&unhide=1" );
1373 'rev-suppressed-text-unhide' :
'rev-deleted-text-unhide';
1374 $outputPage->wrapWikiMsg(
"<div class='mw-warning plainlinks'>\n$1\n</div>\n",
1381 'rev-suppressed-text-view' :
'rev-deleted-text-view';
1382 $outputPage->wrapWikiMsg(
"<div class='mw-warning plainlinks'>\n$1\n</div>\n", $msg );
1397 if ( !
Hooks::run(
'DisplayOldSubtitle', [ &$this, &$oldid ] ) ) {
1404 # Cascade unhide param in links for easy deletion browsing
1407 $extraParams[
'unhide'] = 1;
1410 if ( $this->mRevision && $this->mRevision->getId() === $oldid ) {
1418 $current = ( $oldid == $this->mPage->getLatest() );
1419 $language =
$context->getLanguage();
1426 # Show user links if allowed to see them. If hidden, then show them only if requested...
1429 $infomsg = $current && !
$context->msg(
'revision-info-current' )->isDisabled()
1430 ?
'revision-info-current'
1433 $outputPage =
$context->getOutput();
1434 $revisionInfo =
"<div id=\"mw-{$infomsg}\">" .
1436 ->rawParams( $userlinks )
1437 ->params( $revision->getId(), $tddate, $tdtime, $revision->getUserText() )
1443 ?
$context->msg(
'currentrevisionlink' )->escaped()
1446 $context->msg(
'currentrevisionlink' )->escaped(),
1451 ?
$context->msg(
'diff' )->escaped()
1454 $context->msg(
'diff' )->escaped(),
1461 $prev = $this->
getTitle()->getPreviousRevisionID( $oldid );
1465 $context->msg(
'previousrevision' )->escaped(),
1468 'direction' =>
'prev',
1472 :
$context->msg(
'previousrevision' )->escaped();
1476 $context->msg(
'diff' )->escaped(),
1483 :
$context->msg(
'diff' )->escaped();
1485 ?
$context->msg(
'nextrevision' )->escaped()
1488 $context->msg(
'nextrevision' )->escaped(),
1491 'direction' =>
'next',
1495 $nextdiff = $current
1496 ?
$context->msg(
'diff' )->escaped()
1499 $context->msg(
'diff' )->escaped(),
1508 if ( $cdel !==
'' ) {
1513 $outputPage->addSubtitle(
"<div class=\"mw-revision\">" . $revisionInfo .
1514 "<div id=\"mw-revision-nav\">" . $cdel .
1515 $context->msg(
'revision-nav' )->rawParams(
1516 $prevdiff, $prevlink, $lnk, $curdiff,
$nextlink, $nextdiff
1517 )->escaped() .
"</div></div>" );
1531 public function viewRedirect( $target, $appendSubtitle =
true, $forceKnown =
false ) {
1534 if ( $appendSubtitle ) {
1537 $out->addModuleStyles(
'mediawiki.action.view.redirectPage' );
1538 return static::getRedirectHeaderHtml(
$lang, $target, $forceKnown );
1554 if ( !is_array( $target ) ) {
1555 $target = [ $target ];
1558 $html =
'<ul class="redirectText">';
1563 htmlspecialchars( $title->getFullText() ),
1566 $title->isRedirect() ? [
'redirect' =>
'no' ] : [],
1567 ( $forceKnown ? [
'known',
'noclasses' ] : [] )
1572 $redirectToText =
wfMessage(
'redirectto' )->inLanguage( $lang )->escaped();
1574 return '<div class="redirectMsg">' .
1575 '<p>' . $redirectToText .
'</p>' .
1590 'namespace-' . $this->
getTitle()->getNamespace() .
'-helppage'
1594 if ( !$msg->isDisabled() ) {
1596 $out->addHelpLink( $helpUrl,
true );
1598 $out->addHelpLink( $to, $overrideBaseUrl );
1606 $this->
getContext()->getRequest()->response()->header(
'X-Robots-Tag: noindex' );
1607 $this->
getContext()->getOutput()->setArticleBodyOnly(
true );
1608 $this->
getContext()->getOutput()->enableSectionEditLinks(
false );
1630 public function delete() {
1631 # This code desperately needs to be totally rewritten
1639 $permissionErrors =
$title->getUserPermissionsErrors(
'delete',
$user );
1640 if ( count( $permissionErrors ) ) {
1644 # Read-only check...
1649 # Better double-check that it hasn't been deleted yet!
1650 $this->mPage->loadPageData(
1651 $request->wasPosted() ? WikiPage::READ_LATEST : WikiPage::READ_NORMAL
1653 if ( !$this->mPage->exists() ) {
1654 $deleteLogPage =
new LogPage(
'delete' );
1655 $outputPage =
$context->getOutput();
1656 $outputPage->setPageTitle(
$context->msg(
'cannotdelete-title',
$title->getPrefixedText() ) );
1657 $outputPage->wrapWikiMsg(
"<div class=\"error mw-error-cannotdelete\">\n$1\n</div>",
1660 $outputPage->addHTML(
1661 Xml::element(
'h2', null, $deleteLogPage->getName()->text() )
1672 $deleteReasonList =
$request->getText(
'wpDeleteReasonList',
'other' );
1673 $deleteReason =
$request->getText(
'wpReason' );
1675 if ( $deleteReasonList ==
'other' ) {
1676 $reason = $deleteReason;
1677 } elseif ( $deleteReason !=
'' ) {
1679 $colonseparator =
wfMessage(
'colon-separator' )->inContentLanguage()->text();
1680 $reason = $deleteReasonList . $colonseparator . $deleteReason;
1682 $reason = $deleteReasonList;
1686 [
'delete', $this->
getTitle()->getPrefixedText() ] )
1688 # Flag to hide all contents of the archived revisions
1689 $suppress =
$request->getVal(
'wpSuppress' ) &&
$user->isAllowed(
'suppressrevision' );
1691 $this->
doDelete( $reason, $suppress );
1699 $hasHistory =
false;
1704 # if a page is horribly broken, we still want to be able to
1705 # delete it. So be lenient about errors here.
1706 wfDebug(
"Error while building auto delete summary: $e" );
1712 if ( $hasHistory ) {
1721 $revisions = $edits = (int)
$dbr->selectField(
1724 [
'rev_page' =>
$title->getArticleID() ],
1730 '<strong class="mw-delete-warning-revisions">' .
1731 $context->msg(
'historywarning' )->numParams( $revisions )->parse() .
1733 $context->msg(
'history' )->escaped(),
1735 [
'action' =>
'history' ] ) .
1739 if (
$title->isBigDeletion() ) {
1740 global $wgDeleteRevisionsLimit;
1741 $context->getOutput()->wrapWikiMsg(
"<div class='error'>\n$1\n</div>\n",
1743 'delete-warning-toobig',
1744 $context->getLanguage()->formatNum( $wgDeleteRevisionsLimit )
1759 wfDebug(
"Article::confirmDelete\n" );
1763 $outputPage = $ctx->getOutput();
1764 $useMediaWikiUIEverywhere = $ctx->getConfig()->get(
'UseMediaWikiUIEverywhere' );
1765 $outputPage->setPageTitle(
wfMessage(
'delete-confirm',
$title->getPrefixedText() ) );
1766 $outputPage->addBacklinkSubtitle(
$title );
1767 $outputPage->setRobotPolicy(
'noindex,nofollow' );
1768 $backlinkCache =
$title->getBacklinkCache();
1769 if ( $backlinkCache->hasLinks(
'pagelinks' ) || $backlinkCache->hasLinks(
'templatelinks' ) ) {
1770 $outputPage->wrapWikiMsg(
"<div class='mw-warning plainlinks'>\n$1\n</div>\n",
1771 'deleting-backlinks-warning' );
1773 $outputPage->addWikiMsg(
'confirmdeletetext' );
1775 Hooks::run(
'ArticleConfirmDelete', [ $this, $outputPage, &$reason ] );
1779 if (
$user->isAllowed(
'suppressrevision' ) ) {
1782 'wpSuppress',
'wpSuppress',
false, [
'tabindex' =>
'4' ] ) .
1787 $checkWatch =
$user->getBoolOption(
'watchdeletion' ) ||
$user->isWatched(
$title );
1790 'action' =>
$title->getLocalURL(
'action=delete' ),
'id' =>
'deleteconfirm' ] ) .
1798 'wpDeleteReasonList',
1799 wfMessage(
'deletereason-dropdown' )->inContentLanguage()->
text(),
1800 wfMessage(
'deletereasonotherlist' )->inContentLanguage()->
text(),
1811 'maxlength' =>
'255',
1814 'class' =>
'mw-ui-input-inline',
1819 # Disallow watching if user is not logged in
1820 if (
$user->isLoggedIn() ) {
1823 'wpWatch',
'wpWatch', $checkWatch, [
'tabindex' =>
'3' ] );
1831 'name' =>
'wpConfirmB',
1832 'id' =>
'wpConfirmB',
1834 'class' => $useMediaWikiUIEverywhere ?
'mw-ui-button mw-ui-destructive' :
'',
1842 $user->getEditToken( [
'delete',
$title->getPrefixedText() ] )
1846 if (
$user->isAllowed(
'editinterface' ) ) {
1848 $ctx->msg(
'deletereason-dropdown' )->inContentLanguage()->getTitle(),
1849 wfMessage(
'delete-edit-reasonlist' )->escaped(),
1851 [
'action' =>
'edit' ]
1853 $form .=
'<p class="mw-delete-editreasons">' .
$link .
'</p>';
1856 $outputPage->addHTML( $form );
1858 $deleteLogPage =
new LogPage(
'delete' );
1859 $outputPage->addHTML(
Xml::element(
'h2', null, $deleteLogPage->getName()->text() ) );
1868 public function doDelete( $reason, $suppress =
false ) {
1871 $outputPage =
$context->getOutput();
1873 $status = $this->mPage->doDeleteArticleReal( $reason, $suppress, 0,
true, $error,
$user );
1876 $deleted = $this->
getTitle()->getPrefixedText();
1878 $outputPage->setPageTitle(
wfMessage(
'actioncomplete' ) );
1879 $outputPage->setRobotPolicy(
'noindex,nofollow' );
1881 $loglink =
'[[Special:Log/delete|' .
wfMessage(
'deletionlog' )->text() .
']]';
1883 $outputPage->addWikiMsg(
'deletedtext',
wfEscapeWikiText( $deleted ), $loglink );
1887 $outputPage->returnToMain(
false );
1889 $outputPage->setPageTitle(
1891 $this->
getTitle()->getPrefixedText() )
1894 if ( $error ==
'' ) {
1895 $outputPage->addWikiText(
1896 "<div class=\"error mw-error-cannotdelete\">\n" .
$status->getWikiText() .
"\n</div>"
1898 $deleteLogPage =
new LogPage(
'delete' );
1899 $outputPage->addHTML(
Xml::element(
'h2', null, $deleteLogPage->getName()->text() ) );
1907 $outputPage->addHTML( $error );
1922 static $called =
false;
1925 wfDebug(
"Article::tryFileCache(): called twice!?\n" );
1932 if (
$cache->isCacheGood( $this->mPage->getTouched() ) ) {
1933 wfDebug(
"Article::tryFileCache(): about to load file\n" );
1937 wfDebug(
"Article::tryFileCache(): starting buffer\n" );
1938 ob_start( [ &
$cache,
'saveToFileCache' ] );
1941 wfDebug(
"Article::tryFileCache(): not cacheable\n" );
1956 $cacheable = $this->mPage->getId()
1957 && !$this->mRedirectedFrom && !$this->
getTitle()->isRedirect();
1960 $cacheable =
Hooks::run(
'IsFileCacheable', [ &$this ] );
1983 if (
$user === null ) {
1986 $parserOptions = $this->mPage->makeParserOptions(
$user );
1989 return $this->mPage->getParserOutput( $parserOptions, $oldid );
1999 if ( $this->mParserOptions ) {
2000 throw new MWException(
"can't change parser options after they have already been set" );
2004 $this->mParserOptions = clone
$options;
2012 if ( !$this->mParserOptions ) {
2013 $this->mParserOptions = $this->mPage->makeParserOptions( $this->
getContext() );
2039 wfDebug( __METHOD__ .
" called and \$mContext is null. " .
2040 "Return RequestContext::getMain(); for sanity\n" );
2053 if ( property_exists( $this->mPage,
$fname ) ) {
2054 # wfWarn( "Access to raw $fname field " . __CLASS__ );
2055 return $this->mPage->$fname;
2057 trigger_error(
'Inaccessible property via __get(): ' .
$fname, E_USER_NOTICE );
2068 if ( property_exists( $this->mPage,
$fname ) ) {
2069 # wfWarn( "Access to raw $fname field of " . __CLASS__ );
2070 $this->mPage->$fname = $fvalue;
2072 } elseif ( !in_array(
$fname, [
'mContext',
'mPage' ] ) ) {
2073 $this->mPage->$fname = $fvalue;
2075 trigger_error(
'Inaccessible property via __set(): ' .
$fname, E_USER_NOTICE );
2084 return $this->mPage->checkFlags(
$flags );
2092 return $this->mPage->checkTouched();
2100 $this->mPage->clearPreparedEdit();
2108 $reason, $suppress =
false, $u1 = null, $u2 = null, &$error =
'',
User $user = null,
2111 return $this->mPage->doDeleteArticleReal(
2112 $reason, $suppress, $u1, $u2, $error,
$user, $tags
2121 return $this->mPage->doDeleteUpdates( $id,
$content );
2142 return $this->mPage->doEditContent( $content,
$summary,
$flags, $baseRevId,
2143 $user, $serialFormat
2152 return $this->mPage->doEditUpdates( $revision, $user,
$options );
2160 return $this->mPage->doPurge(
$flags );
2168 return $this->mPage->getLastPurgeTimestamp();
2176 $this->mPage->doViewUpdates( $user, $oldid );
2184 return $this->mPage->exists();
2192 return $this->mPage->followRedirect();
2200 return $this->mPage->getActionOverrides();
2208 return $this->mPage->getAutoDeleteReason( $hasHistory );
2216 return $this->mPage->getCategories();
2224 return $this->mPage->getComment( $audience,
$user );
2232 return $this->mPage->getContentHandler();
2240 return $this->mPage->getContentModel();
2248 return $this->mPage->getContributors();
2256 return $this->mPage->getCreator( $audience,
$user );
2264 return $this->mPage->getDeletionUpdates(
$content );
2272 return $this->mPage->getHiddenCategories();
2280 return $this->mPage->getId();
2288 return $this->mPage->getLatest();
2296 return $this->mPage->getLinksTimestamp();
2304 return $this->mPage->getMinorEdit();
2312 return $this->mPage->getOldestRevision();
2320 return $this->mPage->getRedirectTarget();
2328 return $this->mPage->getRedirectURL( $rt );
2336 return $this->mPage->getRevision();
2346 return $this->mPage->getText( $audience,
$user );
2354 return $this->mPage->getTimestamp();
2362 return $this->mPage->getTouched();
2370 return $this->mPage->getUndoContent( $undo, $undoafter );
2378 return $this->mPage->getUser( $audience,
$user );
2386 return $this->mPage->getUserText( $audience,
$user );
2394 return $this->mPage->hasViewableContent();
2402 return $this->mPage->insertOn( $dbw, $pageId );
2410 array $expiry, $cascade, $reason,
$user = null
2412 return $this->mPage->insertProtectNullRevision( $revCommentMsg, $limit,
2413 $expiry, $cascade, $reason,
$user
2422 return $this->mPage->insertRedirect();
2430 return $this->mPage->insertRedirectEntry( $rt, $oldLatest );
2438 return $this->mPage->isCountable( $editInfo );
2446 return $this->mPage->isRedirect();
2454 return $this->mPage->loadFromRow( $data,
$from );
2462 $this->mPage->loadPageData(
$from );
2470 return $this->mPage->lockAndGetLatest();
2478 return $this->mPage->makeParserOptions(
$context );
2486 return $this->mPage->pageDataFromId(
$dbr, $id,
$options );
2503 $serialFormat = null, $useCache =
true
2505 return $this->mPage->prepareContentForEdit(
2506 $content, $revision,
$user,
2507 $serialFormat, $useCache
2517 return $this->mPage->prepareTextForEdit( $text, $revid,
$user );
2525 return $this->mPage->protectDescription( $limit, $expiry );
2533 return $this->mPage->protectDescriptionLog( $limit, $expiry );
2541 $sectionTitle =
'', $baseRevId = null
2543 return $this->mPage->replaceSectionAtRev( $sectionId, $sectionContent,
2544 $sectionTitle, $baseRevId
2555 return $this->mPage->replaceSectionContent(
2556 $sectionId, $sectionContent, $sectionTitle, $edittime
2565 return $this->mPage->setTimestamp( $ts );
2573 return $this->mPage->shouldCheckParserCache( $parserOptions, $oldId );
2581 return $this->mPage->supportsSections();
2589 return $this->mPage->triggerOpportunisticLinksUpdate( $parserOutput );
2597 return $this->mPage->updateCategoryCounts( $added, $deleted, $id );
2605 return $this->mPage->updateIfNewerOn( $dbw, $revision );
2613 return $this->mPage->updateRedirectOn( $dbw, $redirectTitle, $lastRevIsRedirect = null );
2621 $lastRevIsRedirect = null
2623 return $this->mPage->updateRevisionOn( $dbw, $revision, $lastRevision,
2639 return $this->mPage->doUpdateRestrictions( $limit, $expiry, $cascade, $reason, $user );
2650 &$cascade = 0, $expiry = []
2652 return $this->mPage->doUpdateRestrictions(
2670 $reason, $suppress =
false, $u1 = null, $u2 = null, &$error =
''
2672 return $this->mPage->doDeleteArticle( $reason, $suppress, $u1, $u2, $error );
2686 return $this->mPage->doRollback( $fromP,
$summary, $token, $bot, $resultDetails,
$user );
2698 $guser = is_null( $guser ) ? $this->
getContext()->getUser() : $guser;
2699 return $this->mPage->commitRollback( $fromP,
$summary, $bot, $resultDetails, $guser );
2707 $title = $this->mPage->getTitle();
pageDataFromId($dbr, $id, $options=[])
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...
static newFromName($name, $validate= 'valid')
Static factory method for creation from username.
getRedirectTarget()
Call to WikiPage function for backwards compatibility.
static purgePatrolFooterCache($articleID)
Purge the cache used to check if it is worth showing the patrol footer For example, it is done during re-uploads when file patrol is used.
viewRedirect($target, $appendSubtitle=true, $forceKnown=false)
Return the HTML for the top of a redirect page.
static newFromID($id, $flags=0)
Create a new Title from an article ID.
static closeElement($element)
Returns "$element>".
lockAndGetLatest()
Call to WikiPage function for backwards compatibility.
static onArticleCreate(Title $title)
The onArticle*() functions are supposed to be a kind of hooks which should be called whenever any of ...
static onArticleCreate($title)
getUndoContent(Revision $undo, Revision $undoafter=null)
Call to WikiPage function for backwards compatibility.
static getMainWANInstance()
Get the main WAN cache object.
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
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
Interface for objects which can provide a MediaWiki context on request.
static isInRCLifespan($timestamp, $tolerance=0)
Check whether the given timestamp is new enough to have a RC row with a given tolerance as the recent...
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...
WikiPage $mPage
The WikiPage object of this instance.
wfGetDB($db, $groups=[], $wiki=false)
Get a Database object.
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
getRobotPolicy($action, $pOutput=null)
Get the robot policy to be used for the current view.
the array() calling protocol came about after MediaWiki 1.4rc1.
getRedirectedFrom()
Get the page this view was redirected from.
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
updateRestrictions($limit=[], $reason= '', &$cascade=0, $expiry=[])
doEditContent(Content $content, $summary, $flags=0, $baseRevId=false, User $user=null, $serialFormat=null)
Call to WikiPage function for backwards compatibility.
getText($audience=Revision::FOR_PUBLIC, User $user=null)
Call to WikiPage function for backwards compatibility.
getLatest()
Call to WikiPage function for backwards compatibility.
setParserOptions(ParserOptions $options)
Override the ParserOptions used to render the primary article wikitext.
doEditUpdates(Revision $revision, User $user, array $options=[])
Call to WikiPage function for backwards compatibility.
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 element($element, $attribs=null, $contents= '', $allowShortTag=true)
Format an XML element with given attributes and, optionally, text content.
exists()
Call to WikiPage function for backwards compatibility.
supportsSections()
Call to WikiPage function for backwards compatibility.
static makeUrl($name, $urlaction= '')
getContent()
Note that getContent does not follow redirects anymore.
doRollback($fromP, $summary, $token, $bot, &$resultDetails, User $user=null)
Show an error when the wiki is locked/read-only and the user tries to do something that requires writ...
doDeleteArticle($reason, $suppress=false, $u1=null, $u2=null, &$error= '')
protect()
action=protect 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 prev or next refreshes the diff cache $unhide
div flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException'returning false will NOT prevent logging $e
IContextSource $mContext
The context this Article is executed in.
Set options of the Parser.
isCountable($editInfo=false)
Call to WikiPage function for backwards compatibility.
Wrapper allowing us to handle a system message as a Content object.
getPage()
Get the WikiPage object of this instance.
getParserOutput($oldid=null, User $user=null)
#@-
static useFileCache(IContextSource $context, $mode=self::MODE_NORMAL)
Check if pages can be cached for this request/user.
updateCategoryCounts(array $added, array $deleted, $id=0)
Call to WikiPage function for backwards compatibility.
string bool $mRedirectUrl
URL to redirect to or false if none.
loadPageData($from= 'fromdb')
Call to WikiPage function for backwards compatibility.
if(!isset($args[0])) $lang
ParserOptions $mParserOptions
ParserOptions object for $wgUser articles.
Content $mContentObject
Content of the revision we are working on.
Special handling for category description pages, showing pages, subcategories and file that belong to...
isFileCacheable($mode=HTMLFileCache::MODE_NORMAL)
Check if the page can be cached.
doDeleteUpdates($id, Content $content=null)
Call to WikiPage function for backwards compatibility.
static newFromConds($conds, $fname=__METHOD__, $dbType=DB_REPLICA)
Find the first recent change matching some specific conditions.
adjustDisplayTitle(ParserOutput $pOutput)
Adjust title for pages with displaytitle, -{T|}- or language conversion.
static hidden($name, $value, array $attribs=[])
Convenience function to produce an input element with type=hidden.
shouldCheckParserCache(ParserOptions $parserOptions, $oldId)
Call to WikiPage function for backwards compatibility.
doUpdateRestrictions(array $limit, array $expiry, &$cascade, $reason, User $user)
Class for viewing MediaWiki article and history.
null for the local wiki Added in
Using a hook running we can avoid having all this option specific stuff in our mainline code Using the function array $article
Page view caching in the file system.
followRedirect()
Call to WikiPage function for backwards compatibility.
confirmDelete($reason)
Output deletion confirmation dialog.
Class for viewing MediaWiki file description pages.
doPurge($flags=WikiPage::PURGE_ALL)
Call to WikiPage function for backwards compatibility.
triggerOpportunisticLinksUpdate(ParserOutput $parserOutput)
Call to WikiPage function for backwards compatibility.
getOldIDFromRequest()
Sets $this->mRedirectUrl to a correct URL if the query parameters are incorrect.
__get($fname)
Use PHP's magic __get handler to handle accessing of raw WikiPage fields for backwards compatibility...
it s the revision text itself In either if gzip is the revision text is gzipped $flags
getDeletionUpdates(Content $content=null)
Call to WikiPage function for backwards compatibility.
updateIfNewerOn($dbw, $revision)
Call to WikiPage function for backwards compatibility.
clearPreparedEdit()
Call to WikiPage function for backwards compatibility.
static getMainStashInstance()
Get the cache object for the main stash.
when a variable name is used in a it is silently declared as a new local masking the global
getContributors()
Call to WikiPage function for backwards compatibility.
static submitButton($value, $attribs=[])
Convenience function to build an HTML submit button When $wgUseMediaWikiUIEverywhere is true it will ...
commitRollback($fromP, $summary, $bot, &$resultDetails, User $guser=null)
showMissingArticle()
Show the error text for a missing article.
wfDebug($text, $dest= 'all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
static showLogExtract(&$out, $types=[], $page= '', $user= '', $param=[])
Show log extract.
protectDescription(array $limit, array $expiry)
Call to WikiPage function for backwards compatibility.
Class to simplify the use of log pages.
usually copyright or history_copyright This message must be in HTML not wikitext & $link
getContext()
Gets the context this Article is executed in.
static closeElement($element)
Shortcut to close an XML element.
isRedirect()
Call to WikiPage function for backwards compatibility.
__construct(Title $title, $oldId=null)
Constructor and clear the article.
setTimestamp($ts)
Call to WikiPage function for backwards compatibility.
protectDescriptionLog(array $limit, array $expiry)
Call to WikiPage function for backwards compatibility.
static onArticleDelete($title)
static openElement($element, $attribs=[])
Identical to rawElement(), but has no third parameter and omits the end tag (and the self-closing '/'...
Interface for type hinting (accepts WikiPage, Article, ImagePage, CategoryPage)
makeParserOptions($context)
Call to WikiPage function for backwards compatibility.
wfEscapeWikiText($text)
Escapes the given text so that it may be output using addWikiText() without any linking, formatting, etc.
wfReadOnly()
Check whether the wiki is in read-only mode.
static getMain()
Static methods.
prepareContentForEdit(Content $content, $revision=null, User $user=null, $serialFormat=null, $useCache=true)
Call to WikiPage function for backwards compatibility.
static getCanonicalName($index)
Returns the canonical (English) name for a given index.
$wgUseFileCache
This will cache static pages for non-logged-in users to reduce database traffic on public sites...
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 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 unsetoffset-wrap String Wrap the message in html(usually something like"<
showViewFooter()
Show the footer section of an ordinary page view.
static newFromTarget($specificTarget, $vagueTarget=null, $fromMaster=false)
Given a target and the target's type, get an existing Block object if possible.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context $parserOutput
getRevisionFetched()
Get the fetched Revision object depending on request parameters or null on failure.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content as context as context $options
insertProtectNullRevision($revCommentMsg, array $limit, array $expiry, $cascade, $reason, $user=null)
Call to WikiPage function for backwards compatibility.
static isValid($ip)
Validate an IP address.
showRedirectedFromHeader()
If this request is a redirect view, send "redirected from" subtitle to the output.
static getContentText(Content $content=null)
Convenience function for getting flat text from a Content object.
ParserOutput $mParserOutput
getRevision()
Call to WikiPage function for backwards compatibility.
it s the revision text itself In either if gzip is set
generateReason(&$hasHistory)
static getRedirectHeaderHtml(Language $lang, $target, $forceKnown=false)
Return the HTML for the top of a redirect page.
insertRedirect()
Call to WikiPage function for backwards compatibility.
int null $mOldId
The oldid of the article that is to be shown, 0 for the current revision.
static openElement($element, $attribs=null)
This opens an XML element.
hasViewableContent()
Call to WikiPage function for backwards compatibility.
getComment($audience=Revision::FOR_PUBLIC, User $user=null)
Call to WikiPage function for backwards compatibility.
Base interface for content objects.
getTitle()
Get the title object of the article.
loadFromRow($data, $from)
Call to WikiPage function for backwards compatibility.
getActionOverrides()
Call to WikiPage function for backwards compatibility.
doViewUpdates(User $user, $oldid=0)
Call to WikiPage function for backwards compatibility.
getTitle()
Get the title object of the article.
doDeleteArticleReal($reason, $suppress=false, $u1=null, $u2=null, &$error= '', User $user=null, $tags=[])
Call to WikiPage function for backwards compatibility.
static newFromTitle($title, IContextSource $context)
Create an Article object of the appropriate class for the given page.
wfDeprecated($function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
render()
Handle action=render.
static isIP($name)
Does the string match an anonymous IP address?
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty & $sectionContent
getCategories()
Call to WikiPage function for backwards compatibility.
namespace and then decline to actually register it file or subcat img or subcat $title
static linkKnown($target, $html=null, $customAttribs=[], $query=[], $options=[ 'known'])
Identical to link(), except $options defaults to 'known'.
replaceSectionAtRev($sectionId, Content $sectionContent, $sectionTitle= '', $baseRevId=null)
Call to WikiPage function for backwards compatibility.
static run($event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text
checkFlags($flags)
Call to WikiPage function for backwards compatibility.
static makeContent($text, Title $title=null, $modelId=null, $format=null)
Convenience function for creating a Content object from a given textual representation.
$wgRedirectSources
If local interwikis are set up which allow redirects, set this regexp to restrict URLs which will be ...
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content as context as context the output can only depend on parameters provided to this hook not on global state indicating whether full HTML should be generated If generation of HTML may be but other information should still be present in the ParserOutput object to manipulate or replace but no entry for that model exists in $wgContentHandlers if desired 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 inclusive false for true for descending in case the handler function wants to provide a converted Content object Note that $result getContentModel() must return $toModel. 'CustomEditor'$rcid is used in generating this variable which contains information about the new such as the revision s whether the revision was marked as a minor edit or etc which include things like revision author revision RevisionDelete link and more some of which may have been injected with the DiffRevisionTools hook $nextlink
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
static getForTitle(Title $title)
Returns the appropriate ContentHandler singleton for the given title.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
getContentHandler()
Call to WikiPage function for backwards compatibility.
showCssOrJsPage($showCacheHint=true)
Show a page view for a page formatted as CSS or JavaScript.
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
static link($target, $html=null, $customAttribs=[], $query=[], $options=[])
This function returns an HTML link to the given target.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content as context as context the output can only depend on parameters provided to this hook not on global state indicating whether full HTML should be generated If generation of HTML may be but other information should still be present in the ParserOutput object to manipulate or replace but no entry for that model exists in $wgContentHandlers if desired 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 inclusive false for true for descending in case the handler function wants to provide a converted Content object Note that $result getContentModel() must return $toModel. 'CustomEditor'$rcid is used in generating this variable which contains information about the new such as the revision s whether the revision was marked as a minor edit or not
static onArticleEdit(Title $title, Revision $revision=null)
Purge caches on page update etc.
Title $mRedirectedFrom
Title from which we were redirected here.
getCreator($audience=Revision::FOR_PUBLIC, User $user=null)
Call to WikiPage function for backwards compatibility.
static singleton()
Get an instance of this object.
addHelpLink($to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
Class representing a MediaWiki article and history.
static newFromId($id, $flags=0)
Load a page revision from a given revision ID number.
getOldestRevision()
Call to WikiPage function for backwards compatibility.
string $mContent
Text of the revision we are working on.
static makeExternalLink($url, $text, $escape=true, $linktype= '', $attribs=[], $title=null)
Make an external link.
bool $mContentLoaded
Is the content ($mContent) already loaded?
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
getLastPurgeTimestamp()
Call to WikiPage function for backwards compatibility.
getAutoDeleteReason(&$hasHistory)
Call to WikiPage function for backwards compatibility.
checkTouched()
Call to WikiPage function for backwards compatibility.
updateRevisionOn($dbw, $revision, $lastRevision=null, $lastRevIsRedirect=null)
Call to WikiPage function for backwards compatibility.
prepareTextForEdit($text, $revid=null, User $user=null)
Call to WikiPage function for backwards compatibility.
error also a ContextSource you ll probably need to make sure the header is varied on $request
static newFromID($id)
Constructor from a page id.
if(!defined( 'MEDIAWIKI')) $fname
This file is not a valid entry point, perform no further processing unless MEDIAWIKI is defined...
getId()
Call to WikiPage function for backwards compatibility.
getTimestamp()
Call to WikiPage function for backwards compatibility.
pageDataFromTitle($dbr, $title, $options=[])
Call to WikiPage function for backwards compatibility.
getMinorEdit()
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...
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content $content
static onArticleDelete(Title $title)
Clears caches when article is deleted.
getContentObject()
Returns a Content object representing the pages effective display content, not necessarily the revisi...
doDelete($reason, $suppress=false)
Perform a deletion and output success or failure messages.
showNamespaceHeader()
Show a header specific to the namespace currently being viewed, like [[MediaWiki:Talkpagetext]].
Show an error when a user tries to do something they do not have the necessary permissions for...
updateRedirectOn($dbw, $redirectTitle, $lastRevIsRedirect=null)
Call to WikiPage function for backwards compatibility.
tryFileCache()
checkLastModified returns true if it has taken care of all output to the client that is necessary for...
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content as context as context the output can only depend on parameters provided to this hook not on global state indicating whether full HTML should be generated If generation of HTML may be but other information should still be present in the ParserOutput object to manipulate or replace but no entry for that model exists in $wgContentHandlers if desired 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 inclusive $limit
insertRedirectEntry(Title $rt, $oldLatest=null)
Call to WikiPage function for backwards compatibility.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set $status
doEdit($text, $summary, $flags=0, $baseRevId=false, $user=null)
Call to WikiPage function for backwards compatibility.
static checkLabel($label, $name, $id, $checked=false, $attribs=[])
Convenience function to build an HTML checkbox with a label.
int $mRevIdFetched
Revision ID of revision we are working on.
wfMemcKey()
Make a cache key for the local wiki.
fetchContentObject()
Get text content object Does NOT follow redirects.
setOldSubtitle($oldid=0)
Generate the navigation links when browsing through an article revisions It shows the information as:...
isCurrent()
Returns true if the currently-referenced revision is the current edit to this page (and it exists)...
unprotect()
action=unprotect handler (alias)
getTouched()
Call to WikiPage function for backwards compatibility.
static onArticleEdit($title)
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
getUser($audience=Revision::FOR_PUBLIC, User $user=null)
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.
fetchContent()
Get text of an article from database Does NOT follow redirects.
static selectFields()
Return the list of revision fields that should be selected to create a new page.
static getAutosummary($oldtext, $newtext, $flags)
Return an applicable autosummary if one exists for the given edit.
static doWatchOrUnwatch($watch, Title $title, User $user)
Watch or unwatch a page.
$wgSend404Code
Some web hosts attempt to rewrite all responses with a 404 (not found) status code, mangling or hiding MediaWiki's output.
replaceSectionContent($sectionId, Content $sectionContent, $sectionTitle= '', $edittime=null)
Call to WikiPage function for backwards compatibility.
setContext($context)
Sets the context this Article is executed in.
static listDropDown($name= '', $list= '', $other= '', $selected= '', $class= '', $tabindex=null)
Build a drop-down box from a textual list.
getRevIdFetched()
Use this to fetch the rev ID used on page views.
static revUserTools($rev, $isPublic=false)
Generate a user tool link cluster if the current user is allowed to view it.
showDiffPage()
Show a diff page according to current request variables.
static element($element, $attribs=[], $contents= '')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
getRedirectURL($rt)
Call to WikiPage function for backwards compatibility.
static getAutosummary($oldtext, $newtext, $flags)
showDeletedRevisionHeader()
If the revision requested for view is deleted, check permissions.
static makeTitle($ns, $title, $fragment= '', $interwiki= '')
Create a new Title from a namespace index and a DB key.
setRedirectedFrom(Title $from)
Tell the page view functions that this view was redirected from another page on the wiki...
getContentModel()
Call to WikiPage function for backwards compatibility.
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached $page
getLinksTimestamp()
Call to WikiPage function for backwards compatibility.
insertOn($dbw, $pageId=null)
Call to WikiPage function for backwards compatibility.
static runLegacyHooks($event, $args=[], $deprecatedVersion=null)
Call a legacy hook that uses text instead of Content objects.
getParserOptions()
Get parser options suitable for rendering the primary article wikitext.
Revision $mRevision
Revision we are working on.
getUserText($audience=Revision::FOR_PUBLIC, User $user=null)
Call to WikiPage function for backwards compatibility.
showPatrolFooter()
If patrol is possible, output a patrol UI box.
static label($label, $id, array $attribs=[])
Convenience function for generating a label for inputs.
static formatRobotPolicy($policy)
Converts a String robot policy into an associative array, to allow merging of several policies using ...
getHiddenCategories()
Call to WikiPage function for backwards compatibility.