83 $this->mOldId = $oldId;
84 $this->mPage = $this->
newPage( $title );
102 # @todo FIXME: Doesn't inherit right
103 return $t ==
null ? null :
new self(
$t );
104 # return $t == null ? null : new static( $t );
123 switch (
$title->getNamespace() ) {
158 $this->mRedirectedFrom =
$from;
167 return $this->mPage->getTitle();
184 $this->mContentLoaded =
false;
186 $this->mRedirectedFrom =
null; #
Title object if set
187 $this->mRevIdFetched = 0;
188 $this->mRedirectUrl =
false;
190 $this->mPage->clear();
228 if ( $this->mPage->getId() === 0 ) {
229 # If this is a MediaWiki:x message, then load the messages
230 # and return the message value for x.
232 $text = $this->
getTitle()->getDefaultMessageText();
233 if ( $text ===
false ) {
239 $message = $this->
getContext()->getUser()->isLoggedIn() ?
'noarticletext' :
'noarticletextanon';
254 if ( is_null( $this->mOldId ) ) {
267 $this->mRedirectUrl =
false;
270 $oldid =
$request->getIntOrNull(
'oldid' );
272 if ( $oldid ===
null ) {
276 if ( $oldid !== 0 ) {
277 # Load the given revision and check whether the page is another one.
278 # In that case, update this instance to reflect the change.
279 if ( $oldid === $this->mPage->getLatest() ) {
280 $this->mRevision = $this->mPage->getRevision();
283 if ( $this->mRevision !==
null ) {
285 if ( $this->mPage->getId() != $this->mRevision->getPage() ) {
286 $function = [ get_class( $this->mPage ),
'newFromID' ];
287 $this->mPage = call_user_func( $function, $this->mRevision->getPage() );
293 if (
$request->getVal(
'direction' ) ==
'next' ) {
294 $nextid = $this->
getTitle()->getNextRevisionID( $oldid );
297 $this->mRevision =
null;
299 $this->mRedirectUrl = $this->
getTitle()->getFullURL(
'redirect=no' );
301 } elseif (
$request->getVal(
'direction' ) ==
'prev' ) {
302 $previd = $this->
getTitle()->getPreviousRevisionID( $oldid );
305 $this->mRevision =
null;
331 if ( $this->mContentLoaded && $this->mContent ) {
345 $articlePage = $this;
364 if ( $this->mContentLoaded ) {
368 $this->mContentLoaded =
true;
369 $this->mContent =
null;
373 # Pre-fill content with error message so that if something
374 # fails we'll have something telling us what we intended.
376 $this->mContentObject =
new MessageContent(
'missing-revision', [ $oldid ] );
379 # $this->mRevision might already be fetched by getOldIDFromRequest()
380 if ( !$this->mRevision ) {
382 if ( !$this->mRevision ) {
383 wfDebug( __METHOD__ .
" failed to retrieve specified revision, id $oldid\n" );
388 $oldid = $this->mPage->getLatest();
390 wfDebug( __METHOD__ .
" failed to find page data for title " .
391 $this->
getTitle()->getPrefixedText() .
"\n" );
395 # Update error message with correct oldid
396 $this->mContentObject =
new MessageContent(
'missing-revision', [ $oldid ] );
398 $this->mRevision = $this->mPage->getRevision();
400 if ( !$this->mRevision ) {
401 wfDebug( __METHOD__ .
" failed to retrieve current page, rev_id $oldid\n" );
409 $content = $this->mRevision->getContent(
415 wfDebug( __METHOD__ .
" failed to retrieve content of revision " .
416 $this->mRevision->getId() .
"\n" );
421 $this->mRevIdFetched = $this->mRevision->getId();
424 $articlePage = $this;
425 Hooks::run(
'ArticleAfterFetchContentObject', [ &$articlePage, &$this->mContentObject ] );
436 # If no oldid, this is the current version.
441 return $this->mPage->exists() && $this->mRevision && $this->mRevision->isCurrent();
463 if ( $this->mRevIdFetched ) {
466 return $this->mPage->getLatest();
477 # Get variables from query string
478 # As side effect this will load the revision and update the title
479 # in a revision ID is passed in the request, so this should remain
480 # the first call of this method even if $oldid is used way below.
484 # Another whitelist check in case getOldID() is altering the title
485 $permErrors = $this->
getTitle()->getUserPermissionsErrors(
'read',
$user );
486 if ( count( $permErrors ) ) {
487 wfDebug( __METHOD__ .
": denied on secondary read check\n" );
491 $outputPage = $this->
getContext()->getOutput();
492 # getOldID() may as well want us to redirect somewhere else
493 if ( $this->mRedirectUrl ) {
494 $outputPage->redirect( $this->mRedirectUrl );
495 wfDebug( __METHOD__ .
": redirecting due to oldid\n" );
500 # If we got diff in the query, we want to see a diff page instead of the article.
501 if ( $this->
getContext()->getRequest()->getCheck(
'diff' ) ) {
502 wfDebug( __METHOD__ .
": showing diff page\n" );
508 # Set page title (may be overridden by DISPLAYTITLE)
509 $outputPage->setPageTitle( $this->
getTitle()->getPrefixedText() );
511 $outputPage->setArticleFlag(
true );
512 # Allow frames by default
513 $outputPage->allowClickjacking();
518 # Render printable version, use printable version cache
519 if ( $outputPage->isPrintable() ) {
520 $parserOptions->setIsPrintable(
true );
521 $parserOptions->setEditSection(
false );
523 $parserOptions->setEditSection(
false );
526 # Try client and file cache
527 if ( !
$wgDebugToolbar && $oldid === 0 && $this->mPage->checkTouched() ) {
529 $outputPage->setETag( $parserCache->getETag( $this->mPage, $parserOptions ) );
532 # Use the greatest of the page's timestamp or the timestamp of any
533 # redirect in the chain (bug 67849)
535 if ( isset( $this->mRedirectedFrom ) ) {
538 # If there can be more than one redirect in the chain, we have
539 # to go through the whole chain too in case an intermediate
540 # redirect was changed.
544 ->getRedirectChain();
555 # Is it client cached?
556 if ( $outputPage->checkLastModified(
$timestamp ) ) {
557 wfDebug( __METHOD__ .
": done 304\n" );
562 wfDebug( __METHOD__ .
": done file cache\n" );
563 # tell wgOut that output is taken care of
564 $outputPage->disable();
565 $this->mPage->doViewUpdates(
$user, $oldid );
571 # Should the parser cache be used?
572 $useParserCache = $this->mPage->shouldCheckParserCache( $parserOptions, $oldid );
573 wfDebug(
'Article::view using parser cache: ' . ( $useParserCache ?
'yes' :
'no' ) .
"\n" );
574 if (
$user->getStubThreshold() ) {
575 $this->
getContext()->getStats()->increment(
'pcache_miss_stub' );
581 # Iterate through the possible ways of constructing the output text.
582 # Keep going until $outputDone is set, or we run out of things to do.
585 $this->mParserOutput =
false;
587 while ( !$outputDone && ++$pass ) {
591 $articlePage = $this;
592 Hooks::run(
'ArticleViewHeader', [ &$articlePage, &$outputDone, &$useParserCache ] );
595 # Early abort if the page doesn't exist
596 if ( !$this->mPage->exists() ) {
597 wfDebug( __METHOD__ .
": showing missing article\n" );
599 $this->mPage->doViewUpdates(
$user );
603 # Try the parser cache
604 if ( $useParserCache ) {
605 $this->mParserOutput = $parserCache->get( $this->mPage, $parserOptions );
607 if ( $this->mParserOutput !==
false ) {
609 wfDebug( __METHOD__ .
": showing parser cache contents for current rev permalink\n" );
612 wfDebug( __METHOD__ .
": showing parser cache contents\n" );
614 $outputPage->addParserOutput( $this->mParserOutput );
615 # Ensure that UI elements requiring revision ID have
616 # the correct version information.
617 $outputPage->setRevisionId( $this->mPage->getLatest() );
618 # Preload timestamp to avoid a DB hit
619 $cachedTimestamp = $this->mParserOutput->getTimestamp();
620 if ( $cachedTimestamp !==
null ) {
621 $outputPage->setRevisionTimestamp( $cachedTimestamp );
622 $this->mPage->setTimestamp( $cachedTimestamp );
629 # This will set $this->mRevision if needed
632 # Are we looking at an old revision
633 if ( $oldid && $this->mRevision ) {
637 wfDebug( __METHOD__ .
": cannot view deleted revision\n" );
642 # Ensure that UI elements requiring revision ID have
643 # the correct version information.
645 # Preload timestamp to avoid a DB hit
646 $outputPage->setRevisionTimestamp( $this->mPage->getTimestamp() );
648 # Pages containing custom CSS or JavaScript get special treatment
649 if ( $this->
getTitle()->isCssOrJsPage() || $this->
getTitle()->isCssJsSubpage() ) {
650 wfDebug( __METHOD__ .
": showing CSS/JS source\n" );
653 } elseif ( !Hooks::run(
'ArticleContentViewCustom',
656 # Allow extensions do their own custom view for certain pages
661 # Allow extensions do their own custom view for certain pages
666 # Run the parse, protected by a pool counter
667 wfDebug( __METHOD__ .
": doing uncached parse\n" );
673 if ( !$poolArticleView->execute() ) {
674 $error = $poolArticleView->getError();
676 $outputPage->clearHTML();
677 $outputPage->enableClientCache(
false );
678 $outputPage->setRobotPolicy(
'noindex,nofollow' );
680 $errortext = $error->getWikiText(
false,
'view-pool-error' );
681 $outputPage->addWikiText(
'<div class="errorbox">' . $errortext .
'</div>' );
683 # Connection or timeout error
687 $this->mParserOutput = $poolArticleView->getParserOutput();
688 $outputPage->addParserOutput( $this->mParserOutput );
689 if (
$content->getRedirectTarget() ) {
690 $outputPage->addSubtitle(
"<span id=\"redirectsub\">" .
691 $this->
getContext()->msg(
'redirectpagesub' )->parse() .
"</span>" );
694 # Don't cache a dirty ParserOutput object
695 if ( $poolArticleView->getIsDirty() ) {
696 $outputPage->setCdnMaxage( 0 );
697 $outputPage->addHTML(
"<!-- parser cache is expired, " .
698 "sending anyway due to pool overload-->\n" );
703 # Should be unreachable, but just in case...
709 # Get the ParserOutput actually *displayed* here.
710 # Note that $this->mParserOutput is the *current*/oldid version output.
715 # Adjust title for main page & pages with displaytitle
720 # For the main page, overwrite the <title> element with the con-
721 # tents of 'pagetitle-view-mainpage' instead of the default (if
723 # This message always exists because it is in the i18n files
724 if ( $this->
getTitle()->isMainPage() ) {
725 $msg =
wfMessage(
'pagetitle-view-mainpage' )->inContentLanguage();
726 if ( !$msg->isDisabled() ) {
727 $outputPage->setHTMLTitle( $msg->title( $this->getTitle() )->text() );
731 # Check for any __NOINDEX__ tags on the page using $pOutput
733 $outputPage->setIndexPolicy( $policy[
'index'] );
734 $outputPage->setFollowPolicy( $policy[
'follow'] );
737 $this->mPage->doViewUpdates(
$user, $oldid );
739 $outputPage->addModules(
'mediawiki.action.view.postEdit' );
748 # Adjust the title if it was set by displaytitle, -{T|}- or language conversion
750 if ( strval( $titleText ) !==
'' ) {
751 $this->
getContext()->getOutput()->setPageTitle( $titleText );
765 $diffOnly =
$request->getBool(
'diffonly',
$user->getOption(
'diffonly' ) );
766 $purge =
$request->getVal(
'action' ) ==
'purge';
774 $msg = $this->
getContext()->msg(
'difference-missing-revision' )
778 $this->
getContext()->getOutput()->addHTML( $msg );
782 $contentHandler =
$rev->getContentHandler();
783 $de = $contentHandler->createDifferenceEngine(
793 $this->mRevIdFetched = $de->mNewid;
794 $de->showDiffPage( $diffOnly );
798 list( $old, $new ) = $de->mapDiffPrevNext( $oldid, $diff );
800 $this->mPage->doViewUpdates(
$user, (
int)$new );
815 $outputPage = $this->
getContext()->getOutput();
817 if ( $showCacheHint ) {
821 $outputPage->wrapWikiMsg(
822 "<div id='mw-clearyourcache' lang='$lang' dir='$dir' class='mw-content-$dir'>\n$1\n</div>",
829 if ( $this->mContentObject ) {
833 [ $this->mContentObject, $this->
getTitle(), $outputPage ] )
837 $po = $this->mContentObject->getParserOutput( $this->
getTitle() );
838 $outputPage->addParserOutputContent( $po );
853 $ns = $this->
getTitle()->getNamespace();
855 # Don't index user and user talk pages for blocked users (bug 11443)
857 $specificTarget =
null;
859 $titleText = $this->
getTitle()->getText();
861 $vagueTarget = $titleText;
863 $specificTarget = $titleText;
867 'index' =>
'noindex',
868 'follow' =>
'nofollow'
873 if ( $this->mPage->getId() === 0 || $this->getOldID() ) {
874 # Non-articles (special pages etc), and old revisions
876 'index' =>
'noindex',
877 'follow' =>
'nofollow'
879 } elseif ( $this->
getContext()->getOutput()->isPrintable() ) {
880 # Discourage indexing of printable versions, but encourage following
882 'index' =>
'noindex',
885 } elseif ( $this->
getContext()->getRequest()->getInt(
'curid' ) ) {
886 # For ?curid=x urls, disallow indexing
888 'index' =>
'noindex',
893 # Otherwise, construct the policy based on the various config variables.
897 # Honour customised robot policies for this namespace
898 $policy = array_merge(
903 if ( $this->
getTitle()->canUseNoindex() && is_object( $pOutput ) && $pOutput->getIndexPolicy() ) {
904 # __INDEX__ and __NOINDEX__ magic words, if allowed. Incorporates
905 # a final sanity check that we have really got the parser output.
906 $policy = array_merge(
908 [
'index' => $pOutput->getIndexPolicy() ]
913 # (bug 14900) site config can override user-defined __INDEX__ or __NOINDEX__
914 $policy = array_merge(
931 if ( is_array( $policy ) ) {
933 } elseif ( !$policy ) {
937 $policy = explode(
',', $policy );
938 $policy = array_map(
'trim', $policy );
941 foreach ( $policy
as $var ) {
942 if ( in_array( $var, [
'index',
'noindex' ] ) ) {
943 $arr[
'index'] = $var;
944 } elseif ( in_array( $var, [
'follow',
'nofollow' ] ) ) {
945 $arr[
'follow'] = $var;
963 $outputPage =
$context->getOutput();
965 $rdfrom =
$request->getVal(
'rdfrom' );
969 unset(
$query[
'rdfrom'] );
973 $query[
'redirect'] =
'no';
977 if ( isset( $this->mRedirectedFrom ) ) {
979 $articlePage = $this;
983 if ( Hooks::run(
'ArticleViewRedirect', [ &$articlePage ] ) ) {
985 $this->mRedirectedFrom,
988 [
'redirect' =>
'no' ]
991 $outputPage->addSubtitle(
"<span class=\"mw-redirectedfrom\">" .
992 $context->msg(
'redirectedfrom' )->rawParams( $redir )->parse()
997 $outputPage->addJsConfigVars( [
998 'wgInternalRedirectTargetUrl' => $redirectTargetUrl,
1000 $outputPage->addModules(
'mediawiki.action.view.redirect' );
1003 $outputPage->setCanonicalUrl( $this->
getTitle()->getCanonicalURL() );
1006 $outputPage->setRedirectedFrom( $this->mRedirectedFrom );
1010 } elseif ( $rdfrom ) {
1015 $outputPage->addSubtitle(
"<span class=\"mw-redirectedfrom\">" .
1016 $context->msg(
'redirectedfrom' )->rawParams( $redir )->parse()
1020 $outputPage->addJsConfigVars( [
1021 'wgInternalRedirectTargetUrl' => $redirectTargetUrl,
1023 $outputPage->addModules(
'mediawiki.action.view.redirect' );
1037 if ( $this->
getTitle()->isTalkPage() ) {
1038 if ( !
wfMessage(
'talkpageheader' )->isDisabled() ) {
1039 $this->
getContext()->getOutput()->wrapWikiMsg(
1040 "<div class=\"mw-talkpageheader\">\n$1\n</div>",
1041 [
'talkpageheader' ]
1051 # check if we're displaying a [[User talk:x.x.x.x]] anonymous talk page
1055 $this->
getContext()->getOutput()->addWikiMsg(
'anontalkpagetext' );
1061 Hooks::run(
'ArticleViewFooter', [ $this, $patrolFooterShown ] );
1076 $outputPage = $this->
getContext()->getOutput();
1089 if ( $this->mRevision
1100 if (
$cache->get( $key ) ) {
1105 $oldestRevisionTimestamp =
$dbr->selectField(
1107 'MIN( rev_timestamp )',
1108 [
'rev_page' =>
$title->getArticleID() ],
1117 $recentPageCreation =
false;
1118 if ( $oldestRevisionTimestamp
1122 $recentPageCreation =
true;
1126 'rc_timestamp' => $oldestRevisionTimestamp,
1127 'rc_namespace' =>
$title->getNamespace(),
1128 'rc_cur_id' =>
$title->getArticleID()
1134 $markPatrolledMsg =
wfMessage(
'markaspatrolledtext' );
1142 $recentFileUpload =
false;
1146 $newestUploadTimestamp =
$dbr->selectField(
1148 'MAX( img_timestamp )',
1149 [
'img_name' =>
$title->getDBkey() ],
1152 if ( $newestUploadTimestamp
1156 $recentFileUpload =
true;
1160 'rc_log_type' =>
'upload',
1161 'rc_timestamp' => $newestUploadTimestamp,
1163 'rc_cur_id' =>
$title->getArticleID()
1169 $markPatrolledMsg =
wfMessage(
'markaspatrolledtext-file' );
1174 if ( !$recentPageCreation && !$recentFileUpload ) {
1179 $cache->set( $key,
'1' );
1191 if ( $rc->getAttribute(
'rc_patrolled' ) ) {
1196 $cache->set( $key,
'1' );
1201 if ( $rc->getPerformer()->equals(
$user ) ) {
1207 $rcid = $rc->getAttribute(
'rc_id' );
1209 $token =
$user->getEditToken( $rcid );
1211 $outputPage->preventClickjacking();
1213 $outputPage->addModules(
'mediawiki.page.patrol.ajax' );
1218 $markPatrolledMsg->escaped(),
1221 'action' =>
'markpatrolled',
1227 $outputPage->addHTML(
1228 "<div class='patrollink' data-mw='interface'>" .
1229 wfMessage(
'markaspatrolledlink' )->rawParams(
$link )->escaped() .
1254 $outputPage = $this->
getContext()->getOutput();
1256 $validUserPage =
false;
1260 # Show info in user (talk) namespace. Does the user exist? Is he blocked?
1264 $rootPart = explode(
'/',
$title->getText() )[0];
1265 $user = User::newFromName( $rootPart,
false );
1266 $ip = User::isIP( $rootPart );
1269 if ( !(
$user &&
$user->isLoggedIn() ) && !$ip ) { #
User does not exist
1270 $outputPage->wrapWikiMsg(
"<div class=\"mw-userpage-userdoesnotexist error\">\n\$1\n</div>",
1273 # Show log extract if the user is currently blocked
1281 'showIfEmpty' =>
false,
1283 'blocked-notice-logextract',
1284 $user->getName() # Support GENDER
in notice
1288 $validUserPage = !
$title->isSubpage();
1290 $validUserPage = !
$title->isSubpage();
1294 Hooks::run(
'ShowMissingArticle', [ $this ] );
1296 # Show delete and move logs if there were any such events.
1297 # The logging query can DOS the site when bots/crawlers cause 404 floods,
1298 # so be careful showing this. 404 pages must be cheap as they are hard to cache.
1300 $key =
wfMemcKey(
'page-recent-delete', md5(
$title->getPrefixedText() ) );
1301 $loggedIn = $this->
getContext()->getUser()->isLoggedIn();
1302 if ( $loggedIn ||
$cache->get( $key ) ) {
1303 $logTypes = [
'delete',
'move' ];
1304 $conds = [
"log_action != 'revision'" ];
1306 Hooks::run(
'Article::MissingArticleConditions', [ &$conds, $logTypes ] );
1315 'showIfEmpty' =>
false,
1316 'msgKey' => [ $loggedIn
1317 ?
'moveddeleted-notice'
1318 :
'moveddeleted-notice-recent'
1324 if ( !$this->mPage->hasViewableContent() &&
$wgSend404Code && !$validUserPage ) {
1327 $this->
getContext()->getRequest()->response()->statusHeader( 404 );
1332 $outputPage->setIndexPolicy( $policy[
'index'] );
1333 $outputPage->setFollowPolicy( $policy[
'follow'] );
1335 $hookResult = Hooks::run(
'BeforeDisplayNoArticleText', [ $this ] );
1337 if ( !$hookResult ) {
1341 # Show error message
1347 $text =
wfMessage(
'missing-revision', $oldid )->plain();
1348 } elseif (
$title->quickUserCan(
'create', $this->getContext()->getUser() )
1349 &&
$title->quickUserCan(
'edit', $this->getContext()->getUser() )
1351 $message = $this->
getContext()->getUser()->isLoggedIn() ?
'noarticletext' :
'noarticletextanon';
1354 $text =
wfMessage(
'noarticletext-nopermission' )->plain();
1360 'class' =>
"noarticletext mw-content-$dir",
1363 ] ) .
"\n$text\n</div>" );
1379 $outputPage = $this->
getContext()->getOutput();
1383 $outputPage->wrapWikiMsg(
"<div class='mw-warning plainlinks'>\n$1\n</div>\n",
1384 'rev-deleted-text-permission' );
1388 } elseif ( $this->
getContext()->getRequest()->getInt(
'unhide' ) != 1 ) {
1389 # Give explanation and add a link to view the revision...
1390 $oldid = intval( $this->
getOldID() );
1393 'rev-suppressed-text-unhide' :
'rev-deleted-text-unhide';
1394 $outputPage->wrapWikiMsg(
"<div class='mw-warning plainlinks'>\n$1\n</div>\n",
1401 'rev-suppressed-text-view' :
'rev-deleted-text-view';
1402 $outputPage->wrapWikiMsg(
"<div class='mw-warning plainlinks'>\n$1\n</div>\n", $msg );
1418 $articlePage = $this;
1420 if ( !Hooks::run(
'DisplayOldSubtitle', [ &$articlePage, &$oldid ] ) ) {
1427 # Cascade unhide param in links for easy deletion browsing
1430 $extraParams[
'unhide'] = 1;
1433 if ( $this->mRevision && $this->mRevision->getId() === $oldid ) {
1441 $current = ( $oldid == $this->mPage->getLatest() );
1442 $language =
$context->getLanguage();
1449 # Show user links if allowed to see them. If hidden, then show them only if requested...
1452 $infomsg = $current && !
$context->msg(
'revision-info-current' )->isDisabled()
1453 ?
'revision-info-current'
1456 $outputPage =
$context->getOutput();
1457 $outputPage->addSubtitle(
"<div id=\"mw-{$infomsg}\">" .
1459 ->rawParams( $userlinks )
1460 ->params( $revision->getId(), $tddate, $tdtime, $revision->getUserText() )
1467 ?
$context->msg(
'currentrevisionlink' )->escaped()
1470 $context->msg(
'currentrevisionlink' )->escaped(),
1475 ?
$context->msg(
'diff' )->escaped()
1478 $context->msg(
'diff' )->escaped(),
1485 $prev = $this->
getTitle()->getPreviousRevisionID( $oldid );
1489 $context->msg(
'previousrevision' )->escaped(),
1492 'direction' =>
'prev',
1496 :
$context->msg(
'previousrevision' )->escaped();
1500 $context->msg(
'diff' )->escaped(),
1507 :
$context->msg(
'diff' )->escaped();
1508 $nextlink = $current
1509 ?
$context->msg(
'nextrevision' )->escaped()
1512 $context->msg(
'nextrevision' )->escaped(),
1515 'direction' =>
'next',
1519 $nextdiff = $current
1520 ?
$context->msg(
'diff' )->escaped()
1523 $context->msg(
'diff' )->escaped(),
1532 if ( $cdel !==
'' ) {
1536 $outputPage->addSubtitle(
"<div id=\"mw-revision-nav\">" . $cdel .
1537 $context->msg(
'revision-nav' )->rawParams(
1538 $prevdiff, $prevlink, $lnk, $curdiff, $nextlink, $nextdiff
1539 )->escaped() .
"</div>" );
1553 public function viewRedirect( $target, $appendSubtitle =
true, $forceKnown =
false ) {
1556 if ( $appendSubtitle ) {
1559 $out->addModuleStyles(
'mediawiki.action.view.redirectPage' );
1560 return static::getRedirectHeaderHtml(
$lang, $target, $forceKnown );
1576 if ( !is_array( $target ) ) {
1577 $target = [ $target ];
1580 $html =
'<ul class="redirectText">';
1585 htmlspecialchars(
$title->getFullText() ),
1588 $title->isRedirect() ? [
'redirect' =>
'no' ] : [],
1589 ( $forceKnown ? [
'known',
'noclasses' ] : [] )
1594 $redirectToText =
wfMessage(
'redirectto' )->inLanguage(
$lang )->escaped();
1596 return '<div class="redirectMsg">' .
1597 '<p>' . $redirectToText .
'</p>' .
1612 'namespace-' . $this->
getTitle()->getNamespace() .
'-helppage'
1616 if ( !$msg->isDisabled() ) {
1618 $out->addHelpLink( $helpUrl,
true );
1620 $out->addHelpLink( $to, $overrideBaseUrl );
1628 $this->
getContext()->getRequest()->response()->header(
'X-Robots-Tag: noindex' );
1629 $this->
getContext()->getOutput()->setArticleBodyOnly(
true );
1630 $this->
getContext()->getOutput()->enableSectionEditLinks(
false );
1652 public function delete() {
1653 # This code desperately needs to be totally rewritten
1661 $permissionErrors =
$title->getUserPermissionsErrors(
'delete',
$user );
1662 if ( count( $permissionErrors ) ) {
1666 # Read-only check...
1671 # Better double-check that it hasn't been deleted yet!
1672 $this->mPage->loadPageData(
1675 if ( !$this->mPage->exists() ) {
1676 $deleteLogPage =
new LogPage(
'delete' );
1677 $outputPage =
$context->getOutput();
1678 $outputPage->setPageTitle(
$context->msg(
'cannotdelete-title',
$title->getPrefixedText() ) );
1679 $outputPage->wrapWikiMsg(
"<div class=\"error mw-error-cannotdelete\">\n$1\n</div>",
1682 $outputPage->addHTML(
1683 Xml::element(
'h2',
null, $deleteLogPage->getName()->text() )
1694 $deleteReasonList =
$request->getText(
'wpDeleteReasonList',
'other' );
1695 $deleteReason =
$request->getText(
'wpReason' );
1697 if ( $deleteReasonList ==
'other' ) {
1698 $reason = $deleteReason;
1699 } elseif ( $deleteReason !=
'' ) {
1701 $colonseparator =
wfMessage(
'colon-separator' )->inContentLanguage()->text();
1702 $reason = $deleteReasonList . $colonseparator . $deleteReason;
1704 $reason = $deleteReasonList;
1708 [
'delete', $this->getTitle()->getPrefixedText() ] )
1710 # Flag to hide all contents of the archived revisions
1711 $suppress =
$request->getVal(
'wpSuppress' ) &&
$user->isAllowed(
'suppressrevision' );
1713 $this->
doDelete( $reason, $suppress );
1721 $hasHistory =
false;
1725 }
catch ( Exception
$e ) {
1726 # if a page is horribly broken, we still want to be able to
1727 # delete it. So be lenient about errors here.
1728 wfDebug(
"Error while building auto delete summary: $e" );
1734 if ( $hasHistory ) {
1743 $revisions = $edits = (int)
$dbr->selectField(
1746 [
'rev_page' =>
$title->getArticleID() ],
1752 '<strong class="mw-delete-warning-revisions">' .
1753 $context->msg(
'historywarning' )->numParams( $revisions )->parse() .
1755 $context->msg(
'history' )->escaped(),
1757 [
'action' =>
'history' ] ) .
1761 if (
$title->isBigDeletion() ) {
1763 $context->getOutput()->wrapWikiMsg(
"<div class='error'>\n$1\n</div>\n",
1765 'delete-warning-toobig',
1781 wfDebug(
"Article::confirmDelete\n" );
1785 $outputPage = $ctx->getOutput();
1786 $useMediaWikiUIEverywhere = $ctx->getConfig()->get(
'UseMediaWikiUIEverywhere' );
1787 $outputPage->setPageTitle(
wfMessage(
'delete-confirm',
$title->getPrefixedText() ) );
1788 $outputPage->addBacklinkSubtitle(
$title );
1789 $outputPage->setRobotPolicy(
'noindex,nofollow' );
1790 $backlinkCache =
$title->getBacklinkCache();
1791 if ( $backlinkCache->hasLinks(
'pagelinks' ) || $backlinkCache->hasLinks(
'templatelinks' ) ) {
1792 $outputPage->wrapWikiMsg(
"<div class='mw-warning plainlinks'>\n$1\n</div>\n",
1793 'deleting-backlinks-warning' );
1795 $outputPage->addWikiMsg(
'confirmdeletetext' );
1797 Hooks::run(
'ArticleConfirmDelete', [ $this, $outputPage, &$reason ] );
1801 if (
$user->isAllowed(
'suppressrevision' ) ) {
1804 'wpSuppress',
'wpSuppress',
false, [
'tabindex' =>
'4' ] ) .
1809 $checkWatch =
$user->getBoolOption(
'watchdeletion' ) ||
$user->isWatched(
$title );
1812 'action' =>
$title->getLocalURL(
'action=delete' ),
'id' =>
'deleteconfirm' ] ) .
1820 'wpDeleteReasonList',
1821 wfMessage(
'deletereason-dropdown' )->inContentLanguage()->
text(),
1822 wfMessage(
'deletereasonotherlist' )->inContentLanguage()->
text(),
1833 'maxlength' =>
'255',
1836 'class' =>
'mw-ui-input-inline',
1841 # Disallow watching if user is not logged in
1842 if (
$user->isLoggedIn() ) {
1845 'wpWatch',
'wpWatch', $checkWatch, [
'tabindex' =>
'3' ] );
1853 'name' =>
'wpConfirmB',
1854 'id' =>
'wpConfirmB',
1856 'class' => $useMediaWikiUIEverywhere ?
'mw-ui-button mw-ui-destructive' :
'',
1864 $user->getEditToken( [
'delete',
$title->getPrefixedText() ] )
1868 if (
$user->isAllowed(
'editinterface' ) ) {
1870 $ctx->msg(
'deletereason-dropdown' )->inContentLanguage()->getTitle(),
1871 wfMessage(
'delete-edit-reasonlist' )->escaped(),
1873 [
'action' =>
'edit' ]
1875 $form .=
'<p class="mw-delete-editreasons">' .
$link .
'</p>';
1878 $outputPage->addHTML( $form );
1880 $deleteLogPage =
new LogPage(
'delete' );
1881 $outputPage->addHTML(
Xml::element(
'h2',
null, $deleteLogPage->getName()->text() ) );
1890 public function doDelete( $reason, $suppress =
false ) {
1893 $outputPage =
$context->getOutput();
1895 $status = $this->mPage->doDeleteArticleReal( $reason, $suppress, 0,
true, $error,
$user );
1898 $deleted = $this->
getTitle()->getPrefixedText();
1900 $outputPage->setPageTitle(
wfMessage(
'actioncomplete' ) );
1901 $outputPage->setRobotPolicy(
'noindex,nofollow' );
1903 $loglink =
'[[Special:Log/delete|' .
wfMessage(
'deletionlog' )->text() .
']]';
1905 $outputPage->addWikiMsg(
'deletedtext',
wfEscapeWikiText( $deleted ), $loglink );
1907 Hooks::run(
'ArticleDeleteAfterSuccess', [ $this->
getTitle(), $outputPage ] );
1909 $outputPage->returnToMain(
false );
1911 $outputPage->setPageTitle(
1913 $this->
getTitle()->getPrefixedText() )
1916 if ( $error ==
'' ) {
1917 $outputPage->addWikiText(
1918 "<div class=\"error mw-error-cannotdelete\">\n" .
$status->getWikiText() .
"\n</div>"
1920 $deleteLogPage =
new LogPage(
'delete' );
1921 $outputPage->addHTML(
Xml::element(
'h2',
null, $deleteLogPage->getName()->text() ) );
1929 $outputPage->addHTML( $error );
1944 static $called =
false;
1947 wfDebug(
"Article::tryFileCache(): called twice!?\n" );
1954 if (
$cache->isCacheGood( $this->mPage->getTouched() ) ) {
1955 wfDebug(
"Article::tryFileCache(): about to load file\n" );
1959 wfDebug(
"Article::tryFileCache(): starting buffer\n" );
1960 ob_start( [ &
$cache,
'saveToFileCache' ] );
1963 wfDebug(
"Article::tryFileCache(): not cacheable\n" );
1977 $cacheable = $this->mPage->getId()
1978 && !$this->mRedirectedFrom && !$this->
getTitle()->isRedirect();
1982 $articlePage = $this;
1983 $cacheable = Hooks::run(
'IsFileCacheable', [ &$articlePage ] );
2006 if (
$user ===
null ) {
2009 $parserOptions = $this->mPage->makeParserOptions(
$user );
2012 return $this->mPage->getParserOutput( $parserOptions, $oldid );
2022 if ( $this->mParserOptions ) {
2023 throw new MWException(
"can't change parser options after they have already been set" );
2027 $this->mParserOptions = clone
$options;
2035 if ( !$this->mParserOptions ) {
2036 $this->mParserOptions = $this->mPage->makeParserOptions( $this->
getContext() );
2062 wfDebug( __METHOD__ .
" called and \$mContext is null. " .
2063 "Return RequestContext::getMain(); for sanity\n" );
2076 if ( property_exists( $this->mPage,
$fname ) ) {
2077 # wfWarn( "Access to raw $fname field " . __CLASS__ );
2078 return $this->mPage->$fname;
2080 trigger_error(
'Inaccessible property via __get(): ' .
$fname, E_USER_NOTICE );
2091 if ( property_exists( $this->mPage,
$fname ) ) {
2092 # wfWarn( "Access to raw $fname field of " . __CLASS__ );
2093 $this->mPage->$fname = $fvalue;
2095 } elseif ( !in_array(
$fname, [
'mContext',
'mPage' ] ) ) {
2096 $this->mPage->$fname = $fvalue;
2098 trigger_error(
'Inaccessible property via __set(): ' .
$fname, E_USER_NOTICE );
2107 return $this->mPage->checkFlags(
$flags );
2115 return $this->mPage->checkTouched();
2123 $this->mPage->clearPreparedEdit();
2131 $reason, $suppress =
false, $u1 =
null, $u2 =
null, &$error =
'',
User $user =
null
2133 return $this->mPage->doDeleteArticleReal(
2134 $reason, $suppress, $u1, $u2, $error,
$user
2143 return $this->mPage->doDeleteUpdates( $id,
$content );
2160 User $user =
null, $serialFormat =
null
2163 $user, $serialFormat
2172 return $this->mPage->doEditUpdates( $revision,
$user,
$options );
2180 return $this->mPage->doPurge();
2190 return $this->mPage->doQuickEditContent(
2200 $this->mPage->doViewUpdates(
$user, $oldid );
2208 return $this->mPage->exists();
2216 return $this->mPage->followRedirect();
2224 return $this->mPage->getActionOverrides();
2232 return $this->mPage->getAutoDeleteReason( $hasHistory );
2240 return $this->mPage->getCategories();
2248 return $this->mPage->getComment( $audience,
$user );
2256 return $this->mPage->getContentHandler();
2264 return $this->mPage->getContentModel();
2272 return $this->mPage->getContributors();
2280 return $this->mPage->getCreator( $audience,
$user );
2288 return $this->mPage->getDeletionUpdates(
$content );
2296 return $this->mPage->getHiddenCategories();
2304 return $this->mPage->getId();
2312 return $this->mPage->getLatest();
2320 return $this->mPage->getLinksTimestamp();
2328 return $this->mPage->getMinorEdit();
2336 return $this->mPage->getOldestRevision();
2344 return $this->mPage->getRedirectTarget();
2352 return $this->mPage->getRedirectURL( $rt );
2360 return $this->mPage->getRevision();
2369 return $this->mPage->getText( $audience,
$user );
2377 return $this->mPage->getTimestamp();
2385 return $this->mPage->getTouched();
2393 return $this->mPage->getUndoContent( $undo, $undoafter );
2401 return $this->mPage->getUser( $audience,
$user );
2409 return $this->mPage->getUserText( $audience,
$user );
2417 return $this->mPage->hasViewableContent();
2425 return $this->mPage->insertOn( $dbw, $pageId );
2433 array $expiry, $cascade, $reason, $user =
null
2435 return $this->mPage->insertProtectNullRevision( $revCommentMsg,
$limit,
2436 $expiry, $cascade, $reason,
$user
2445 return $this->mPage->insertRedirect();
2453 return $this->mPage->insertRedirectEntry( $rt, $oldLatest );
2461 return $this->mPage->isCountable( $editInfo );
2469 return $this->mPage->isRedirect();
2477 return $this->mPage->loadFromRow( $data,
$from );
2485 $this->mPage->loadPageData(
$from );
2493 return $this->mPage->lockAndGetLatest();
2501 return $this->mPage->makeParserOptions(
$context );
2509 return $this->mPage->pageDataFromId(
$dbr, $id,
$options );
2526 $serialFormat =
null, $useCache =
true
2528 return $this->mPage->prepareContentForEdit(
2530 $serialFormat, $useCache
2539 return $this->mPage->prepareTextForEdit( $text, $revid,
$user );
2547 return $this->mPage->protectDescription(
$limit, $expiry );
2555 return $this->mPage->protectDescriptionLog(
$limit, $expiry );
2563 $sectionTitle =
'', $baseRevId =
null
2565 return $this->mPage->replaceSectionAtRev( $sectionId,
$sectionContent,
2566 $sectionTitle, $baseRevId
2577 return $this->mPage->replaceSectionContent(
2587 return $this->mPage->setTimestamp( $ts );
2595 return $this->mPage->shouldCheckParserCache( $parserOptions, $oldId );
2603 return $this->mPage->supportsSections();
2611 return $this->mPage->triggerOpportunisticLinksUpdate(
$parserOutput );
2619 return $this->mPage->updateCategoryCounts( $added, $deleted );
2627 return $this->mPage->updateIfNewerOn( $dbw, $revision );
2635 return $this->mPage->updateRedirectOn( $dbw, $redirectTitle, $lastRevIsRedirect =
null );
2643 $lastRevIsRedirect =
null
2645 return $this->mPage->updateRevisionOn( $dbw, $revision, $lastRevision,
2661 return $this->mPage->doUpdateRestrictions(
$limit, $expiry, $cascade, $reason,
$user );
2672 &$cascade = 0, $expiry = []
2674 return $this->mPage->doUpdateRestrictions(
2692 $reason, $suppress =
false, $u1 =
null, $u2 =
null, &$error =
''
2694 return $this->mPage->doDeleteArticle( $reason, $suppress, $u1, $u2, $error );
2708 return $this->mPage->doRollback( $fromP,
$summary, $token, $bot, $resultDetails,
$user );
2720 $guser = is_null( $guser ) ? $this->
getContext()->getUser() : $guser;
2721 return $this->mPage->commitRollback( $fromP,
$summary, $bot, $resultDetails, $guser );
2729 $title = $this->mPage->getTitle();
$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 ...
$wgMaxRedirects
Max number of redirects to follow when resolving redirects.
$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...
$wgEnableWriteAPI
Allow the API to be used to perform write operations (page edits, rollback, etc.) when an authorised ...
$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.
$wgUseETag
Whether MediaWiki should send an ETag header.
$wgEnableAPI
Enable the MediaWiki API for convenient access to machine-readable data via api.php.
$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.
wfMemcKey()
Make a cache key for the local wiki.
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( 'MEDIAWIKI')) $fname
This file is not a valid entry point, perform no further processing unless MEDIAWIKI is defined.
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.
ParserOutput $mParserOutput
Title $mRedirectedFrom
Title from which we were redirected here.
updateRedirectOn( $dbw, $redirectTitle, $lastRevIsRedirect=null)
Call to WikiPage function for backwards compatibility.
generateReason(&$hasHistory)
checkFlags( $flags)
Call to WikiPage function for backwards compatibility.
checkTouched()
Call to WikiPage function for backwards compatibility.
doDelete( $reason, $suppress=false)
Perform a deletion and output success or failure messages.
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.
static getAutosummary( $oldtext, $newtext, $flags)
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.
doEditContent(Content $content, $summary, $flags=0, $baseRevId=false, User $user=null, $serialFormat=null)
Call to WikiPage function for backwards compatibility.
doDeleteArticleReal( $reason, $suppress=false, $u1=null, $u2=null, &$error='', User $user=null)
Call to WikiPage function for backwards compatibility.
getParserOutput( $oldid=null, User $user=null)
#-
doEdit( $text, $summary, $flags=0, $baseRevId=false, $user=null)
Call to WikiPage function for backwards compatibility.
insertProtectNullRevision( $revCommentMsg, array $limit, array $expiry, $cascade, $reason, $user=null)
Call to WikiPage function for backwards compatibility.
doPurge()
Call to WikiPage function for backwards compatibility.
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.
prepareTextForEdit( $text, $revid=null, User $user=null)
Call to WikiPage function for backwards compatibility.
IContextSource $mContext
The context this Article is executed in.
fetchContentObject()
Get text content object Does NOT follow redirects.
supportsSections()
Call to WikiPage function for backwards compatibility.
string $mContent
Text of the revision we are working on.
pageDataFromTitle( $dbr, $title, $options=[])
Call to WikiPage function for backwards compatibility.
getContentHandler()
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.
getRobotPolicy( $action, $pOutput=null)
Get the robot policy to be used for the current view.
doUpdateRestrictions(array $limit, array $expiry, &$cascade, $reason, User $user)
protectDescriptionLog(array $limit, array $expiry)
Call to WikiPage function for backwards compatibility.
clearPreparedEdit()
Call to WikiPage function for backwards compatibility.
__construct(Title $title, $oldId=null)
Constructor and clear the article.
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.
replaceSectionAtRev( $sectionId, Content $sectionContent, $sectionTitle='', $baseRevId=null)
Call to WikiPage function for backwards compatibility.
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.
isFileCacheable()
Check if the page can be cached.
static onArticleEdit( $title)
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.
doDeleteUpdates( $id, Content $content=null)
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.
Content $mContentObject
Content of the revision we are working on.
getContentModel()
Call to WikiPage function for backwards compatibility.
static getRedirectHeaderHtml(Language $lang, $target, $forceKnown=false)
Return the HTML for the top of a redirect page.
protect()
action=protect handler
getText( $audience=Revision::FOR_PUBLIC, User $user=null)
Call to WikiPage function for backwards compatibility.
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.
doDeleteArticle( $reason, $suppress=false, $u1=null, $u2=null, &$error='')
getId()
Call to WikiPage function for backwards compatibility.
unprotect()
action=unprotect handler (alias)
int $mRevIdFetched
Revision ID of revision we are working on.
isRedirect()
Call to WikiPage function for backwards compatibility.
static onArticleCreate( $title)
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.
updateCategoryCounts(array $added, array $deleted)
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 is 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 ...
Revision $mRevision
Revision we are working 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.
static onArticleDelete( $title)
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:...
ParserOptions $mParserOptions
ParserOptions object for $wgUser articles.
showViewFooter()
Show the footer section of an ordinary page view.
WikiPage $mPage
The WikiPage object of this instance.
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.
getContent()
Note that getContent does not follow redirects anymore.
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.
doQuickEditContent(Content $content, User $user, $comment='', $minor=false, $serialFormat=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.
static newFromTitle( $title, IContextSource $context)
Create an Article object of the appropriate class for the given page.
showCssOrJsPage( $showCacheHint=true)
Show a page view for a page formatted as CSS or JavaScript.
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.
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 content ($mContent) already loaded?
getDeletionUpdates(Content $content=null)
Call to WikiPage function for backwards compatibility.
doRollback( $fromP, $summary, $token, $bot, &$resultDetails, User $user=null)
fetchContent()
Get text of an article from database Does NOT follow redirects.
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...
static makeContent( $text, Title $title=null, $modelId=null, $format=null)
Convenience function for creating a Content object from a given textual representation.
static getForTitle(Title $title)
Returns the appropriate ContentHandler singleton for the given title.
static runLegacyHooks( $event, $args=[], $warn=null)
Call a legacy hook that uses text instead of Content objects.
static getContentText(Content $content=null)
Convenience function for getting flat text from a Content object.
static deprecated( $func, $version, $component=false)
Logs a deprecation warning, visible if $wgDevelopmentWarnings, but only if self::$enableDeprecationWa...
getRequest()
Get the WebRequest object.
Page view caching in the file system.
static useFileCache(IContextSource $context)
Check if pages can be cached for this request/user.
static label( $label, $id, array $attribs=[])
Convenience function for generating a label for inputs.
static element( $element, $attribs=[], $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
static input( $name, $value='', $type='text', array $attribs=[])
Convenience function to produce an "<input>" element.
static openElement( $element, $attribs=[])
Identical to rawElement(), but has no third parameter and omits the end tag (and the self-closing '/'...
static closeElement( $element)
Returns "</$element>".
static hidden( $name, $value, array $attribs=[])
Convenience function to produce an input element with type=hidden.
static isValid( $ip)
Validate an IP address.
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 revComment(Revision $rev, $local=false, $isPublic=false)
Wrap and format the given revision's comment block, if the current user is allowed to view it.
static revUserTools( $rev, $isPublic=false)
Generate a user tool link cluster if the current user is allowed to view it.
static linkKnown( $target, $html=null, $customAttribs=[], $query=[], $options=[ 'known', 'noclasses'])
Identical to link(), except $options defaults to 'known'.
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.
static getCanonicalName( $index)
Returns the canonical (English) name for a given index.
Wrapper allowing us to handle a system message as a Content object.
static getMainWANInstance()
Get the main WAN cache object.
static getMainStashInstance()
Get the cache object for the main stash.
static singleton()
Get an instance of this 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 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 newFromConds( $conds, $fname=__METHOD__, $dbType=DB_SLAVE)
Find the first recent change matching some specific conditions.
static getMain()
Static methods.
static newFromTitle(LinkTarget $linkTarget, $id=0, $flags=0)
Load either the current, or a specified, revision that's attached to a given link target.
static newFromId( $id, $flags=0)
Load a page revision from a given revision ID number.
static makeUrl( $name, $urlaction='')
Represents a title within MediaWiki.
static newFromID( $id, $flags=0)
Create a new Title from an article ID.
getFullURL( $query='', $query2=false, $proto=PROTO_RELATIVE)
Get a real URL referring to this title, with interwiki link and fragment.
static & makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
static compare( $a, $b)
Callback for usort() to do title sorts by (namespace, title)
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
static doWatchOrUnwatch( $watch, Title $title, User $user)
Watch or unwatch a page.
Class representing a MediaWiki article and history.
static onArticleEdit(Title $title, Revision $revision=null)
Purge caches on page update etc.
static getAutosummary( $oldtext, $newtext, $flags)
Return an applicable autosummary if one exists for the given edit.
static onArticleDelete(Title $title)
Clears caches when article is deleted.
static selectFields()
Return the list of revision fields that should be selected to create a new page.
static onArticleCreate(Title $title)
The onArticle*() functions are supposed to be a kind of hooks which should be called whenever any of ...
static closeElement( $element)
Shortcut to close an XML element.
static openElement( $element, $attribs=null)
This opens an XML element.
static submitButton( $value, $attribs=[])
Convenience function to build an HTML submit button When $wgUseMediaWikiUIEverywhere is true it will ...
static checkLabel( $label, $name, $id, $checked=false, $attribs=[])
Convenience function to build an HTML checkbox with a label.
static element( $element, $attribs=null, $contents='', $allowShortTag=true)
Format an XML element with given attributes and, optionally, text content.
static listDropDown( $name='', $list='', $other='', $selected='', $class='', $tabindex=null)
Build a drop-down box from a textual list.
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
when a variable name is used in a it is silently declared as a new local masking the global
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
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
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
the array() calling protocol came about after MediaWiki 1.4rc1.
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
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
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
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 after processing 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 unset offset - wrap String Wrap the message in html(usually something like "<div ...>$1</div>"). - flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException':Called before an exception(or PHP error) is logged. This is meant for integration with external error aggregation services
this hook is for auditing only 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
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
namespace and then decline to actually register it file or subcat img or subcat $title
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
null for the local wiki Added in
it s the revision text itself In either if gzip is the revision text is gzipped $flags
error also a ContextSource you ll probably need to make sure the header is varied on $request
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
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output $out
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses & $html
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
Using a hook running we can avoid having all this option specific stuff in our mainline code Using the function array $article
the value to return A Title object or null for latest to be modified or replaced by the hook handler or if authentication is not possible after cache objects are set for highlighting & $link
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output modifiable modifiable after all normalizations have been except for the $wgMaxImageArea check set to true or false to override the $wgMaxImageArea check result gives extension the possibility to transform it themselves $handler
null for the local wiki Added should default to null in handler for backwards compatibility add a value to it if you want to add a cookie that have to vary cache options can modify $query
presenting them properly to the user as errors is done by the caller return true use this to change the list i e etc $rev
returning false will NOT prevent logging $e
if(count( $args)==0) $dir
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
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)
linkcache txt The LinkCache class maintains a list of article titles and the information about whether or not the article exists in the database This is used to mark up links when displaying a page If the same link appears more than once on any page then it only has to be looked up once In most cases link lookups are done in batches with the LinkBatch class or the equivalent in so the link cache is mostly useful for short snippets of parsed and for links in the navigation areas of the skin The link cache was formerly used to track links used in a document for the purposes of updating the link tables This application is now deprecated To create a you can use the following $titles
if(!isset( $args[0])) $lang