83 $this->mOldId = $oldId;
84 $this->mPage = $this->
newPage( $title );
101 $t = Title::newFromID( $id );
102 return $t ==
null ? null :
new static(
$t );
121 switch (
$title->getNamespace() ) {
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 ]
445 # If no oldid, this is the current version.
450 return $this->mPage->exists() && $this->mRevision && $this->mRevision->isCurrent();
472 if ( $this->mRevIdFetched ) {
475 return $this->mPage->getLatest();
486 # Get variables from query string
487 # As side effect this will load the revision and update the title
488 # in a revision ID is passed in the request, so this should remain
489 # the first call of this method even if $oldid is used way below.
493 # Another whitelist check in case getOldID() is altering the title
494 $permErrors = $this->
getTitle()->getUserPermissionsErrors(
'read',
$user );
495 if ( count( $permErrors ) ) {
496 wfDebug( __METHOD__ .
": denied on secondary read check\n" );
500 $outputPage = $this->
getContext()->getOutput();
501 # getOldID() may as well want us to redirect somewhere else
502 if ( $this->mRedirectUrl ) {
503 $outputPage->redirect( $this->mRedirectUrl );
504 wfDebug( __METHOD__ .
": redirecting due to oldid\n" );
509 # If we got diff in the query, we want to see a diff page instead of the article.
510 if ( $this->
getContext()->getRequest()->getCheck(
'diff' ) ) {
511 wfDebug( __METHOD__ .
": showing diff page\n" );
517 # Set page title (may be overridden by DISPLAYTITLE)
518 $outputPage->setPageTitle( $this->
getTitle()->getPrefixedText() );
520 $outputPage->setArticleFlag(
true );
521 # Allow frames by default
522 $outputPage->allowClickjacking();
527 # Render printable version, use printable version cache
528 if ( $outputPage->isPrintable() ) {
529 $parserOptions->setIsPrintable(
true );
530 $parserOptions->setEditSection(
false );
532 $parserOptions->setEditSection(
false );
535 # Try client and file cache
536 if ( !
$wgDebugToolbar && $oldid === 0 && $this->mPage->checkTouched() ) {
537 # Try to stream the output from file cache
539 wfDebug( __METHOD__ .
": done file cache\n" );
540 # tell wgOut that output is taken care of
541 $outputPage->disable();
542 $this->mPage->doViewUpdates(
$user, $oldid );
548 # Should the parser cache be used?
549 $useParserCache = $this->mPage->shouldCheckParserCache( $parserOptions, $oldid );
550 wfDebug(
'Article::view using parser cache: ' . ( $useParserCache ?
'yes' :
'no' ) .
"\n" );
551 if (
$user->getStubThreshold() ) {
552 $this->
getContext()->getStats()->increment(
'pcache_miss_stub' );
558 # Iterate through the possible ways of constructing the output text.
559 # Keep going until $outputDone is set, or we run out of things to do.
562 $this->mParserOutput =
false;
564 while ( !$outputDone && ++$pass ) {
567 Hooks::run(
'ArticleViewHeader', [ &$this, &$outputDone, &$useParserCache ] );
570 # Early abort if the page doesn't exist
571 if ( !$this->mPage->exists() ) {
572 wfDebug( __METHOD__ .
": showing missing article\n" );
574 $this->mPage->doViewUpdates(
$user );
578 # Try the parser cache
579 if ( $useParserCache ) {
580 $this->mParserOutput = $parserCache->get( $this->mPage, $parserOptions );
582 if ( $this->mParserOutput !==
false ) {
584 wfDebug( __METHOD__ .
": showing parser cache contents for current rev permalink\n" );
587 wfDebug( __METHOD__ .
": showing parser cache contents\n" );
589 $outputPage->addParserOutput( $this->mParserOutput );
590 # Ensure that UI elements requiring revision ID have
591 # the correct version information.
592 $outputPage->setRevisionId( $this->mPage->getLatest() );
593 # Preload timestamp to avoid a DB hit
594 $cachedTimestamp = $this->mParserOutput->getTimestamp();
595 if ( $cachedTimestamp !==
null ) {
596 $outputPage->setRevisionTimestamp( $cachedTimestamp );
597 $this->mPage->setTimestamp( $cachedTimestamp );
604 # This will set $this->mRevision if needed
607 # Are we looking at an old revision
608 if ( $oldid && $this->mRevision ) {
612 wfDebug( __METHOD__ .
": cannot view deleted revision\n" );
617 # Ensure that UI elements requiring revision ID have
618 # the correct version information.
620 # Preload timestamp to avoid a DB hit
621 $outputPage->setRevisionTimestamp( $this->mPage->getTimestamp() );
623 # Pages containing custom CSS or JavaScript get special treatment
624 if ( $this->
getTitle()->isCssOrJsPage() || $this->
getTitle()->isCssJsSubpage() ) {
625 wfDebug( __METHOD__ .
": showing CSS/JS source\n" );
628 } elseif ( !Hooks::run(
'ArticleContentViewCustom',
631 # Allow extensions do their own custom view for certain pages
638 # Allow extensions do their own custom view for certain pages
643 # Run the parse, protected by a pool counter
644 wfDebug( __METHOD__ .
": doing uncached parse\n" );
650 if ( !$poolArticleView->execute() ) {
651 $error = $poolArticleView->getError();
653 $outputPage->clearHTML();
654 $outputPage->enableClientCache(
false );
655 $outputPage->setRobotPolicy(
'noindex,nofollow' );
657 $errortext = $error->getWikiText(
false,
'view-pool-error' );
658 $outputPage->addWikiText(
'<div class="errorbox">' . $errortext .
'</div>' );
660 # Connection or timeout error
664 $this->mParserOutput = $poolArticleView->getParserOutput();
665 $outputPage->addParserOutput( $this->mParserOutput );
666 if (
$content->getRedirectTarget() ) {
667 $outputPage->addSubtitle(
"<span id=\"redirectsub\">" .
668 $this->
getContext()->msg(
'redirectpagesub' )->parse() .
"</span>" );
671 # Don't cache a dirty ParserOutput object
672 if ( $poolArticleView->getIsDirty() ) {
673 $outputPage->setCdnMaxage( 0 );
674 $outputPage->addHTML(
"<!-- parser cache is expired, " .
675 "sending anyway due to pool overload-->\n" );
680 # Should be unreachable, but just in case...
686 # Get the ParserOutput actually *displayed* here.
687 # Note that $this->mParserOutput is the *current*/oldid version output.
692 # Adjust title for main page & pages with displaytitle
697 # For the main page, overwrite the <title> element with the con-
698 # tents of 'pagetitle-view-mainpage' instead of the default (if
700 # This message always exists because it is in the i18n files
701 if ( $this->
getTitle()->isMainPage() ) {
702 $msg =
wfMessage(
'pagetitle-view-mainpage' )->inContentLanguage();
703 if ( !$msg->isDisabled() ) {
704 $outputPage->setHTMLTitle( $msg->title( $this->getTitle() )->text() );
708 # Use adaptive TTLs for CDN so delayed/failed purges are noticed less often.
709 # This could use getTouched(), but that could be scary for major template edits.
712 # Check for any __NOINDEX__ tags on the page using $pOutput
714 $outputPage->setIndexPolicy( $policy[
'index'] );
715 $outputPage->setFollowPolicy( $policy[
'follow'] );
718 $this->mPage->doViewUpdates(
$user, $oldid );
720 $outputPage->addModules(
'mediawiki.action.view.postEdit' );
728 # Adjust the title if it was set by displaytitle, -{T|}- or language conversion
730 if ( strval( $titleText ) !==
'' ) {
731 $this->
getContext()->getOutput()->setPageTitle( $titleText );
745 $diffOnly =
$request->getBool(
'diffonly',
$user->getOption(
'diffonly' ) );
746 $purge =
$request->getVal(
'action' ) ==
'purge';
754 $msg = $this->
getContext()->msg(
'difference-missing-revision' )
758 $this->
getContext()->getOutput()->addHTML( $msg );
762 $contentHandler =
$rev->getContentHandler();
763 $de = $contentHandler->createDifferenceEngine(
773 $this->mRevIdFetched = $de->mNewid;
774 $de->showDiffPage( $diffOnly );
778 list( $old, $new ) = $de->mapDiffPrevNext( $oldid, $diff );
780 $this->mPage->doViewUpdates(
$user, (
int)$new );
795 $outputPage = $this->
getContext()->getOutput();
797 if ( $showCacheHint ) {
801 $outputPage->wrapWikiMsg(
802 "<div id='mw-clearyourcache' lang='$lang' dir='$dir' class='mw-content-$dir'>\n$1\n</div>",
809 if ( $this->mContentObject ) {
813 [ $this->mContentObject, $this->
getTitle(), $outputPage ],
818 $po = $this->mContentObject->getParserOutput( $this->
getTitle() );
819 $outputPage->addParserOutputContent( $po );
834 $ns = $this->
getTitle()->getNamespace();
836 # Don't index user and user talk pages for blocked users (bug 11443)
838 $specificTarget =
null;
840 $titleText = $this->
getTitle()->getText();
842 $vagueTarget = $titleText;
844 $specificTarget = $titleText;
848 'index' =>
'noindex',
849 'follow' =>
'nofollow'
854 if ( $this->mPage->getId() === 0 || $this->getOldID() ) {
855 # Non-articles (special pages etc), and old revisions
857 'index' =>
'noindex',
858 'follow' =>
'nofollow'
860 } elseif ( $this->
getContext()->getOutput()->isPrintable() ) {
861 # Discourage indexing of printable versions, but encourage following
863 'index' =>
'noindex',
866 } elseif ( $this->
getContext()->getRequest()->getInt(
'curid' ) ) {
867 # For ?curid=x urls, disallow indexing
869 'index' =>
'noindex',
874 # Otherwise, construct the policy based on the various config variables.
878 # Honour customised robot policies for this namespace
879 $policy = array_merge(
884 if ( $this->
getTitle()->canUseNoindex() && is_object( $pOutput ) && $pOutput->getIndexPolicy() ) {
885 # __INDEX__ and __NOINDEX__ magic words, if allowed. Incorporates
886 # a final sanity check that we have really got the parser output.
887 $policy = array_merge(
889 [
'index' => $pOutput->getIndexPolicy() ]
894 # (bug 14900) site config can override user-defined __INDEX__ or __NOINDEX__
895 $policy = array_merge(
912 if ( is_array( $policy ) ) {
914 } elseif ( !$policy ) {
918 $policy = explode(
',', $policy );
919 $policy = array_map(
'trim', $policy );
922 foreach ( $policy
as $var ) {
923 if ( in_array( $var, [
'index',
'noindex' ] ) ) {
924 $arr[
'index'] = $var;
925 } elseif ( in_array( $var, [
'follow',
'nofollow' ] ) ) {
926 $arr[
'follow'] = $var;
944 $outputPage =
$context->getOutput();
946 $rdfrom =
$request->getVal(
'rdfrom' );
950 unset(
$query[
'rdfrom'] );
954 $query[
'redirect'] =
'no';
958 if ( isset( $this->mRedirectedFrom ) ) {
961 if ( Hooks::run(
'ArticleViewRedirect', [ &$this ] ) ) {
963 $this->mRedirectedFrom,
966 [
'redirect' =>
'no' ]
969 $outputPage->addSubtitle(
"<span class=\"mw-redirectedfrom\">" .
970 $context->msg(
'redirectedfrom' )->rawParams( $redir )->parse()
975 $outputPage->addJsConfigVars( [
976 'wgInternalRedirectTargetUrl' => $redirectTargetUrl,
978 $outputPage->addModules(
'mediawiki.action.view.redirect' );
981 $outputPage->setCanonicalUrl( $this->
getTitle()->getCanonicalURL() );
984 $outputPage->setRedirectedFrom( $this->mRedirectedFrom );
988 } elseif ( $rdfrom ) {
993 $outputPage->addSubtitle(
"<span class=\"mw-redirectedfrom\">" .
994 $context->msg(
'redirectedfrom' )->rawParams( $redir )->parse()
998 $outputPage->addJsConfigVars( [
999 'wgInternalRedirectTargetUrl' => $redirectTargetUrl,
1001 $outputPage->addModules(
'mediawiki.action.view.redirect' );
1015 if ( $this->
getTitle()->isTalkPage() ) {
1016 if ( !
wfMessage(
'talkpageheader' )->isDisabled() ) {
1017 $this->
getContext()->getOutput()->wrapWikiMsg(
1018 "<div class=\"mw-talkpageheader\">\n$1\n</div>",
1019 [
'talkpageheader' ]
1029 # check if we're displaying a [[User talk:x.x.x.x]] anonymous talk page
1033 $this->
getContext()->getOutput()->addWikiMsg(
'anontalkpagetext' );
1039 Hooks::run(
'ArticleViewFooter', [ $this, $patrolFooterShown ] );
1054 $outputPage = $this->
getContext()->getOutput();
1067 if ( $this->mRevision
1077 $cache = ObjectCache::getMainWANInstance();
1078 if (
$cache->get( $key ) ) {
1083 $oldestRevisionTimestamp =
$dbr->selectField(
1085 'MIN( rev_timestamp )',
1086 [
'rev_page' =>
$title->getArticleID() ],
1095 $recentPageCreation =
false;
1096 if ( $oldestRevisionTimestamp
1100 $recentPageCreation =
true;
1104 'rc_timestamp' => $oldestRevisionTimestamp,
1105 'rc_namespace' =>
$title->getNamespace(),
1106 'rc_cur_id' =>
$title->getArticleID()
1112 $markPatrolledMsg =
wfMessage(
'markaspatrolledtext' );
1120 $recentFileUpload =
false;
1124 $newestUploadTimestamp =
$dbr->selectField(
1126 'MAX( img_timestamp )',
1127 [
'img_name' =>
$title->getDBkey() ],
1130 if ( $newestUploadTimestamp
1134 $recentFileUpload =
true;
1138 'rc_log_type' =>
'upload',
1139 'rc_timestamp' => $newestUploadTimestamp,
1141 'rc_cur_id' =>
$title->getArticleID()
1144 [
'USE INDEX' =>
'rc_timestamp' ]
1148 $markPatrolledMsg =
wfMessage(
'markaspatrolledtext-file' );
1153 if ( !$recentPageCreation && !$recentFileUpload ) {
1158 $cache->set( $key,
'1' );
1170 if ( $rc->getAttribute(
'rc_patrolled' ) ) {
1175 $cache->set( $key,
'1' );
1180 if ( $rc->getPerformer()->equals(
$user ) ) {
1186 $rcid = $rc->getAttribute(
'rc_id' );
1188 $token =
$user->getEditToken( $rcid );
1190 $outputPage->preventClickjacking();
1192 $outputPage->addModules(
'mediawiki.page.patrol.ajax' );
1197 $markPatrolledMsg->escaped(),
1200 'action' =>
'markpatrolled',
1206 $outputPage->addHTML(
1207 "<div class='patrollink' data-mw='interface'>" .
1208 wfMessage(
'markaspatrolledlink' )->rawParams(
$link )->escaped() .
1222 $cache = ObjectCache::getMainWANInstance();
1233 $outputPage = $this->
getContext()->getOutput();
1235 $validUserPage =
false;
1239 # Show info in user (talk) namespace. Does the user exist? Is he blocked?
1243 $rootPart = explode(
'/',
$title->getText() )[0];
1244 $user = User::newFromName( $rootPart,
false );
1245 $ip = User::isIP( $rootPart );
1249 $outputPage->wrapWikiMsg(
"<div class=\"mw-userpage-userdoesnotexist error\">\n\$1\n</div>",
1252 # Show log extract if the user is currently blocked
1256 MWNamespace::getCanonicalName(
NS_USER ) .
':' . $block->getTarget(),
1260 'showIfEmpty' =>
false,
1262 'blocked-notice-logextract',
1263 $user->getName() # Support GENDER
in notice
1267 $validUserPage = !
$title->isSubpage();
1269 $validUserPage = !
$title->isSubpage();
1273 Hooks::run(
'ShowMissingArticle', [ $this ] );
1275 # Show delete and move logs if there were any such events.
1276 # The logging query can DOS the site when bots/crawlers cause 404 floods,
1277 # so be careful showing this. 404 pages must be cheap as they are hard to cache.
1278 $cache = ObjectCache::getMainStashInstance();
1279 $key =
wfMemcKey(
'page-recent-delete', md5(
$title->getPrefixedText() ) );
1280 $loggedIn = $this->
getContext()->getUser()->isLoggedIn();
1281 if ( $loggedIn ||
$cache->get( $key ) ) {
1282 $logTypes = [
'delete',
'move' ];
1283 $conds = [
"log_action != 'revision'" ];
1285 Hooks::run(
'Article::MissingArticleConditions', [ &$conds, $logTypes ] );
1294 'showIfEmpty' =>
false,
1295 'msgKey' => [ $loggedIn
1296 ?
'moveddeleted-notice'
1297 :
'moveddeleted-notice-recent'
1303 if ( !$this->mPage->hasViewableContent() &&
$wgSend404Code && !$validUserPage ) {
1306 $this->
getContext()->getRequest()->response()->statusHeader( 404 );
1311 $outputPage->setIndexPolicy( $policy[
'index'] );
1312 $outputPage->setFollowPolicy( $policy[
'follow'] );
1314 $hookResult = Hooks::run(
'BeforeDisplayNoArticleText', [ $this ] );
1316 if ( !$hookResult ) {
1320 # Show error message
1326 $text =
wfMessage(
'missing-revision', $oldid )->plain();
1327 } elseif (
$title->quickUserCan(
'create', $this->getContext()->getUser() )
1328 &&
$title->quickUserCan(
'edit', $this->getContext()->getUser() )
1330 $message = $this->
getContext()->getUser()->isLoggedIn() ?
'noarticletext' :
'noarticletextanon';
1333 $text =
wfMessage(
'noarticletext-nopermission' )->plain();
1339 'class' =>
"noarticletext mw-content-$dir",
1342 ] ) .
"\n$text\n</div>" );
1358 $outputPage = $this->
getContext()->getOutput();
1362 $outputPage->wrapWikiMsg(
"<div class='mw-warning plainlinks'>\n$1\n</div>\n",
1363 'rev-deleted-text-permission' );
1367 } elseif ( $this->
getContext()->getRequest()->getInt(
'unhide' ) != 1 ) {
1368 # Give explanation and add a link to view the revision...
1369 $oldid = intval( $this->
getOldID() );
1370 $link = $this->
getTitle()->getFullURL(
"oldid={$oldid}&unhide=1" );
1372 'rev-suppressed-text-unhide' :
'rev-deleted-text-unhide';
1373 $outputPage->wrapWikiMsg(
"<div class='mw-warning plainlinks'>\n$1\n</div>\n",
1380 'rev-suppressed-text-view' :
'rev-deleted-text-view';
1381 $outputPage->wrapWikiMsg(
"<div class='mw-warning plainlinks'>\n$1\n</div>\n", $msg );
1396 if ( !Hooks::run(
'DisplayOldSubtitle', [ &$this, &$oldid ] ) ) {
1403 # Cascade unhide param in links for easy deletion browsing
1406 $extraParams[
'unhide'] = 1;
1409 if ( $this->mRevision && $this->mRevision->getId() === $oldid ) {
1417 $current = ( $oldid == $this->mPage->getLatest() );
1418 $language =
$context->getLanguage();
1425 # Show user links if allowed to see them. If hidden, then show them only if requested...
1428 $infomsg = $current && !
$context->msg(
'revision-info-current' )->isDisabled()
1429 ?
'revision-info-current'
1432 $outputPage =
$context->getOutput();
1433 $revisionInfo =
"<div id=\"mw-{$infomsg}\">" .
1435 ->rawParams( $userlinks )
1436 ->params( $revision->getId(), $tddate, $tdtime, $revision->getUserText() )
1442 ?
$context->msg(
'currentrevisionlink' )->escaped()
1445 $context->msg(
'currentrevisionlink' )->escaped(),
1450 ?
$context->msg(
'diff' )->escaped()
1453 $context->msg(
'diff' )->escaped(),
1460 $prev = $this->
getTitle()->getPreviousRevisionID( $oldid );
1464 $context->msg(
'previousrevision' )->escaped(),
1467 'direction' =>
'prev',
1471 :
$context->msg(
'previousrevision' )->escaped();
1475 $context->msg(
'diff' )->escaped(),
1482 :
$context->msg(
'diff' )->escaped();
1484 ?
$context->msg(
'nextrevision' )->escaped()
1487 $context->msg(
'nextrevision' )->escaped(),
1490 'direction' =>
'next',
1494 $nextdiff = $current
1495 ?
$context->msg(
'diff' )->escaped()
1498 $context->msg(
'diff' )->escaped(),
1507 if ( $cdel !==
'' ) {
1512 $outputPage->addSubtitle(
"<div class=\"mw-revision\">" . $revisionInfo .
1513 "<div id=\"mw-revision-nav\">" . $cdel .
1514 $context->msg(
'revision-nav' )->rawParams(
1515 $prevdiff, $prevlink, $lnk, $curdiff,
$nextlink, $nextdiff
1516 )->escaped() .
"</div></div>" );
1530 public function viewRedirect( $target, $appendSubtitle =
true, $forceKnown =
false ) {
1533 if ( $appendSubtitle ) {
1536 $out->addModuleStyles(
'mediawiki.action.view.redirectPage' );
1537 return static::getRedirectHeaderHtml(
$lang, $target, $forceKnown );
1553 if ( !is_array( $target ) ) {
1554 $target = [ $target ];
1557 $html =
'<ul class="redirectText">';
1562 htmlspecialchars(
$title->getFullText() ),
1565 $title->isRedirect() ? [
'redirect' =>
'no' ] : [],
1566 ( $forceKnown ? [
'known',
'noclasses' ] : [] )
1571 $redirectToText =
wfMessage(
'redirectto' )->inLanguage(
$lang )->escaped();
1573 return '<div class="redirectMsg">' .
1574 '<p>' . $redirectToText .
'</p>' .
1589 'namespace-' . $this->
getTitle()->getNamespace() .
'-helppage'
1593 if ( !$msg->isDisabled() ) {
1595 $out->addHelpLink( $helpUrl,
true );
1597 $out->addHelpLink( $to, $overrideBaseUrl );
1605 $this->
getContext()->getRequest()->response()->header(
'X-Robots-Tag: noindex' );
1606 $this->
getContext()->getOutput()->setArticleBodyOnly(
true );
1607 $this->
getContext()->getOutput()->enableSectionEditLinks(
false );
1629 public function delete() {
1630 # This code desperately needs to be totally rewritten
1638 $permissionErrors =
$title->getUserPermissionsErrors(
'delete',
$user );
1639 if ( count( $permissionErrors ) ) {
1643 # Read-only check...
1648 # Better double-check that it hasn't been deleted yet!
1649 $this->mPage->loadPageData(
1650 $request->wasPosted() ? WikiPage::READ_LATEST : WikiPage::READ_NORMAL
1652 if ( !$this->mPage->exists() ) {
1653 $deleteLogPage =
new LogPage(
'delete' );
1654 $outputPage =
$context->getOutput();
1655 $outputPage->setPageTitle(
$context->msg(
'cannotdelete-title',
$title->getPrefixedText() ) );
1656 $outputPage->wrapWikiMsg(
"<div class=\"error mw-error-cannotdelete\">\n$1\n</div>",
1659 $outputPage->addHTML(
1660 Xml::element(
'h2',
null, $deleteLogPage->getName()->text() )
1671 $deleteReasonList =
$request->getText(
'wpDeleteReasonList',
'other' );
1672 $deleteReason =
$request->getText(
'wpReason' );
1674 if ( $deleteReasonList ==
'other' ) {
1675 $reason = $deleteReason;
1676 } elseif ( $deleteReason !=
'' ) {
1678 $colonseparator =
wfMessage(
'colon-separator' )->inContentLanguage()->text();
1679 $reason = $deleteReasonList . $colonseparator . $deleteReason;
1681 $reason = $deleteReasonList;
1685 [
'delete', $this->getTitle()->getPrefixedText() ] )
1687 # Flag to hide all contents of the archived revisions
1688 $suppress =
$request->getVal(
'wpSuppress' ) &&
$user->isAllowed(
'suppressrevision' );
1690 $this->
doDelete( $reason, $suppress );
1698 $hasHistory =
false;
1702 }
catch ( Exception
$e ) {
1703 # if a page is horribly broken, we still want to be able to
1704 # delete it. So be lenient about errors here.
1705 wfDebug(
"Error while building auto delete summary: $e" );
1711 if ( $hasHistory ) {
1720 $revisions = $edits = (int)
$dbr->selectField(
1723 [
'rev_page' =>
$title->getArticleID() ],
1729 '<strong class="mw-delete-warning-revisions">' .
1730 $context->msg(
'historywarning' )->numParams( $revisions )->parse() .
1732 $context->msg(
'history' )->escaped(),
1734 [
'action' =>
'history' ] ) .
1738 if (
$title->isBigDeletion() ) {
1740 $context->getOutput()->wrapWikiMsg(
"<div class='error'>\n$1\n</div>\n",
1742 'delete-warning-toobig',
1758 wfDebug(
"Article::confirmDelete\n" );
1762 $outputPage = $ctx->getOutput();
1763 $useMediaWikiUIEverywhere = $ctx->getConfig()->get(
'UseMediaWikiUIEverywhere' );
1764 $outputPage->setPageTitle(
wfMessage(
'delete-confirm',
$title->getPrefixedText() ) );
1765 $outputPage->addBacklinkSubtitle(
$title );
1766 $outputPage->setRobotPolicy(
'noindex,nofollow' );
1767 $backlinkCache =
$title->getBacklinkCache();
1768 if ( $backlinkCache->hasLinks(
'pagelinks' ) || $backlinkCache->hasLinks(
'templatelinks' ) ) {
1769 $outputPage->wrapWikiMsg(
"<div class='mw-warning plainlinks'>\n$1\n</div>\n",
1770 'deleting-backlinks-warning' );
1772 $outputPage->addWikiMsg(
'confirmdeletetext' );
1774 Hooks::run(
'ArticleConfirmDelete', [ $this, $outputPage, &$reason ] );
1778 if (
$user->isAllowed(
'suppressrevision' ) ) {
1779 $suppress = Html::openElement(
'div', [
'id' =>
'wpDeleteSuppressRow' ] ) .
1781 'wpSuppress',
'wpSuppress',
false, [
'tabindex' =>
'4' ] ) .
1782 Html::closeElement(
'div' );
1786 $checkWatch =
$user->getBoolOption(
'watchdeletion' ) ||
$user->isWatched(
$title );
1788 $form = Html::openElement(
'form', [
'method' =>
'post',
1789 'action' =>
$title->getLocalURL(
'action=delete' ),
'id' =>
'deleteconfirm' ] ) .
1790 Html::openElement(
'fieldset', [
'id' =>
'mw-delete-table' ] ) .
1791 Html::element(
'legend',
null,
wfMessage(
'delete-legend' )->
text() ) .
1792 Html::openElement(
'div', [
'id' =>
'mw-deleteconfirm-table' ] ) .
1793 Html::openElement(
'div', [
'id' =>
'wpDeleteReasonListRow' ] ) .
1794 Html::label(
wfMessage(
'deletecomment' )->
text(),
'wpDeleteReasonList' ) .
1797 'wpDeleteReasonList',
1798 wfMessage(
'deletereason-dropdown' )->inContentLanguage()->
text(),
1799 wfMessage(
'deletereasonotherlist' )->inContentLanguage()->
text(),
1804 Html::closeElement(
'div' ) .
1805 Html::openElement(
'div', [
'id' =>
'wpDeleteReasonRow' ] ) .
1806 Html::label(
wfMessage(
'deleteotherreason' )->
text(),
'wpReason' ) .
1808 Html::input(
'wpReason', $reason,
'text', [
1810 'maxlength' =>
'255',
1813 'class' =>
'mw-ui-input-inline',
1816 Html::closeElement(
'div' );
1818 # Disallow watching if user is not logged in
1819 if (
$user->isLoggedIn() ) {
1822 'wpWatch',
'wpWatch', $checkWatch, [
'tabindex' =>
'3' ] );
1826 Html::openElement(
'div' ) .
1830 'name' =>
'wpConfirmB',
1831 'id' =>
'wpConfirmB',
1833 'class' => $useMediaWikiUIEverywhere ?
'mw-ui-button mw-ui-destructive' :
'',
1836 Html::closeElement(
'div' ) .
1837 Html::closeElement(
'div' ) .
1841 $user->getEditToken( [
'delete',
$title->getPrefixedText() ] )
1845 if (
$user->isAllowed(
'editinterface' ) ) {
1847 $ctx->msg(
'deletereason-dropdown' )->inContentLanguage()->getTitle(),
1848 wfMessage(
'delete-edit-reasonlist' )->escaped(),
1850 [
'action' =>
'edit' ]
1852 $form .=
'<p class="mw-delete-editreasons">' .
$link .
'</p>';
1855 $outputPage->addHTML( $form );
1857 $deleteLogPage =
new LogPage(
'delete' );
1858 $outputPage->addHTML(
Xml::element(
'h2',
null, $deleteLogPage->getName()->text() ) );
1867 public function doDelete( $reason, $suppress =
false ) {
1870 $outputPage =
$context->getOutput();
1872 $status = $this->mPage->doDeleteArticleReal( $reason, $suppress, 0,
true, $error,
$user );
1875 $deleted = $this->
getTitle()->getPrefixedText();
1877 $outputPage->setPageTitle(
wfMessage(
'actioncomplete' ) );
1878 $outputPage->setRobotPolicy(
'noindex,nofollow' );
1880 $loglink =
'[[Special:Log/delete|' .
wfMessage(
'deletionlog' )->text() .
']]';
1882 $outputPage->addWikiMsg(
'deletedtext',
wfEscapeWikiText( $deleted ), $loglink );
1884 Hooks::run(
'ArticleDeleteAfterSuccess', [ $this->
getTitle(), $outputPage ] );
1886 $outputPage->returnToMain(
false );
1888 $outputPage->setPageTitle(
1890 $this->
getTitle()->getPrefixedText() )
1893 if ( $error ==
'' ) {
1894 $outputPage->addWikiText(
1895 "<div class=\"error mw-error-cannotdelete\">\n" .
$status->getWikiText() .
"\n</div>"
1897 $deleteLogPage =
new LogPage(
'delete' );
1898 $outputPage->addHTML(
Xml::element(
'h2',
null, $deleteLogPage->getName()->text() ) );
1906 $outputPage->addHTML( $error );
1921 static $called =
false;
1924 wfDebug(
"Article::tryFileCache(): called twice!?\n" );
1931 if (
$cache->isCacheGood( $this->mPage->getTouched() ) ) {
1932 wfDebug(
"Article::tryFileCache(): about to load file\n" );
1936 wfDebug(
"Article::tryFileCache(): starting buffer\n" );
1937 ob_start( [ &
$cache,
'saveToFileCache' ] );
1940 wfDebug(
"Article::tryFileCache(): not cacheable\n" );
1955 $cacheable = $this->mPage->getId()
1956 && !$this->mRedirectedFrom && !$this->
getTitle()->isRedirect();
1959 $cacheable = Hooks::run(
'IsFileCacheable', [ &$this ] );
1982 if (
$user ===
null ) {
1985 $parserOptions = $this->mPage->makeParserOptions(
$user );
1988 return $this->mPage->getParserOutput( $parserOptions, $oldid );
1998 if ( $this->mParserOptions ) {
1999 throw new MWException(
"can't change parser options after they have already been set" );
2003 $this->mParserOptions = clone
$options;
2011 if ( !$this->mParserOptions ) {
2012 $this->mParserOptions = $this->mPage->makeParserOptions( $this->
getContext() );
2038 wfDebug( __METHOD__ .
" called and \$mContext is null. " .
2039 "Return RequestContext::getMain(); for sanity\n" );
2052 if ( property_exists( $this->mPage,
$fname ) ) {
2053 # wfWarn( "Access to raw $fname field " . __CLASS__ );
2054 return $this->mPage->$fname;
2056 trigger_error(
'Inaccessible property via __get(): ' .
$fname, E_USER_NOTICE );
2067 if ( property_exists( $this->mPage,
$fname ) ) {
2068 # wfWarn( "Access to raw $fname field of " . __CLASS__ );
2069 $this->mPage->$fname = $fvalue;
2071 } elseif ( !in_array(
$fname, [
'mContext',
'mPage' ] ) ) {
2072 $this->mPage->$fname = $fvalue;
2074 trigger_error(
'Inaccessible property via __set(): ' .
$fname, E_USER_NOTICE );
2083 return $this->mPage->checkFlags(
$flags );
2091 return $this->mPage->checkTouched();
2099 $this->mPage->clearPreparedEdit();
2107 $reason, $suppress =
false, $u1 =
null, $u2 =
null, &$error =
'',
User $user =
null,
2110 return $this->mPage->doDeleteArticleReal(
2111 $reason, $suppress, $u1, $u2, $error,
$user, $tags
2120 return $this->mPage->doDeleteUpdates( $id,
$content );
2139 User $user =
null, $serialFormat =
null
2142 $user, $serialFormat
2151 return $this->mPage->doEditUpdates( $revision,
$user,
$options );
2159 return $this->mPage->doPurge(
$flags );
2167 return $this->mPage->getLastPurgeTimestamp();
2175 $this->mPage->doViewUpdates(
$user, $oldid );
2183 return $this->mPage->exists();
2191 return $this->mPage->followRedirect();
2199 return $this->mPage->getActionOverrides();
2207 return $this->mPage->getAutoDeleteReason( $hasHistory );
2215 return $this->mPage->getCategories();
2223 return $this->mPage->getComment( $audience,
$user );
2231 return $this->mPage->getContentHandler();
2239 return $this->mPage->getContentModel();
2247 return $this->mPage->getContributors();
2255 return $this->mPage->getCreator( $audience,
$user );
2263 return $this->mPage->getDeletionUpdates(
$content );
2271 return $this->mPage->getHiddenCategories();
2279 return $this->mPage->getId();
2287 return $this->mPage->getLatest();
2295 return $this->mPage->getLinksTimestamp();
2303 return $this->mPage->getMinorEdit();
2311 return $this->mPage->getOldestRevision();
2319 return $this->mPage->getRedirectTarget();
2327 return $this->mPage->getRedirectURL( $rt );
2335 return $this->mPage->getRevision();
2345 return $this->mPage->getText( $audience,
$user );
2353 return $this->mPage->getTimestamp();
2361 return $this->mPage->getTouched();
2369 return $this->mPage->getUndoContent( $undo, $undoafter );
2377 return $this->mPage->getUser( $audience,
$user );
2385 return $this->mPage->getUserText( $audience,
$user );
2393 return $this->mPage->hasViewableContent();
2401 return $this->mPage->insertOn( $dbw, $pageId );
2409 array $expiry, $cascade, $reason, $user =
null
2411 return $this->mPage->insertProtectNullRevision( $revCommentMsg,
$limit,
2412 $expiry, $cascade, $reason,
$user
2421 return $this->mPage->insertRedirect();
2429 return $this->mPage->insertRedirectEntry( $rt, $oldLatest );
2437 return $this->mPage->isCountable( $editInfo );
2445 return $this->mPage->isRedirect();
2453 return $this->mPage->loadFromRow( $data,
$from );
2461 $this->mPage->loadPageData(
$from );
2469 return $this->mPage->lockAndGetLatest();
2477 return $this->mPage->makeParserOptions(
$context );
2485 return $this->mPage->pageDataFromId(
$dbr, $id,
$options );
2502 $serialFormat =
null, $useCache =
true
2504 return $this->mPage->prepareContentForEdit(
2506 $serialFormat, $useCache
2516 return $this->mPage->prepareTextForEdit( $text, $revid,
$user );
2524 return $this->mPage->protectDescription(
$limit, $expiry );
2532 return $this->mPage->protectDescriptionLog(
$limit, $expiry );
2540 $sectionTitle =
'', $baseRevId =
null
2542 return $this->mPage->replaceSectionAtRev( $sectionId,
$sectionContent,
2543 $sectionTitle, $baseRevId
2554 return $this->mPage->replaceSectionContent(
2564 return $this->mPage->setTimestamp( $ts );
2572 return $this->mPage->shouldCheckParserCache( $parserOptions, $oldId );
2580 return $this->mPage->supportsSections();
2588 return $this->mPage->triggerOpportunisticLinksUpdate(
$parserOutput );
2596 return $this->mPage->updateCategoryCounts( $added, $deleted, $id );
2604 return $this->mPage->updateIfNewerOn( $dbw, $revision );
2612 return $this->mPage->updateRedirectOn( $dbw, $redirectTitle, $lastRevIsRedirect =
null );
2620 $lastRevIsRedirect =
null
2622 return $this->mPage->updateRevisionOn( $dbw, $revision, $lastRevision,
2638 return $this->mPage->doUpdateRestrictions(
$limit, $expiry, $cascade, $reason,
$user );
2649 &$cascade = 0, $expiry = []
2651 return $this->mPage->doUpdateRestrictions(
2669 $reason, $suppress =
false, $u1 =
null, $u2 =
null, &$error =
''
2671 return $this->mPage->doDeleteArticle( $reason, $suppress, $u1, $u2, $error );
2685 return $this->mPage->doRollback( $fromP,
$summary, $token, $bot, $resultDetails,
$user );
2697 $guser = is_null( $guser ) ? $this->
getContext()->getUser() : $guser;
2698 return $this->mPage->commitRollback( $fromP,
$summary, $bot, $resultDetails, $guser );
2706 $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 ...
$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.
$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.
doDeleteArticleReal( $reason, $suppress=false, $u1=null, $u2=null, &$error='', User $user=null, $tags=[])
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.
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.
getRedirectedFrom()
Get the page this view was redirected from.
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.
updateCategoryCounts(array $added, array $deleted, $id=0)
Call to WikiPage function for backwards compatibility.
view()
This is the default action of the index.php entry point: just view the page of the given title.
loadPageData( $from='fromdb')
Call to WikiPage function for backwards compatibility.
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.
doPurge( $flags=WikiPage::PURGE_ALL)
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.
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.
getLastPurgeTimestamp()
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.
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.
isFileCacheable( $mode=HTMLFileCache::MODE_NORMAL)
Check if the page can be cached.
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.
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 getContentText(Content $content=null)
Convenience function for getting flat text from a Content object.
static runLegacyHooks( $event, $args=[], $deprecatedVersion=null)
Call a legacy hook that uses text instead of Content objects.
getRequest()
Get the WebRequest object.
Page view caching in the file system.
static useFileCache(IContextSource $context, $mode=self::MODE_NORMAL)
Check if pages can be cached for this request/user.
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 linkKnown( $target, $html=null, $customAttribs=[], $query=[], $options=[ 'known'])
Identical to link(), except $options defaults to 'known'.
static revComment(Revision $rev, $local=false, $isPublic=false)
Wrap and format the given revision's comment block, if the current user is allowed to view it.
static revUserTools( $rev, $isPublic=false)
Generate a user tool link cluster if the current user is allowed to view it.
static makeExternalLink( $url, $text, $escape=true, $linktype='', $attribs=[], $title=null)
Make an external link.
static getRevDeleteLink(User $user, Revision $rev, Title $title)
Get a revision-deletion link, or disabled link, or nothing, depending on user permissions & the setti...
static showLogExtract(&$out, $types=[], $page='', $user='', $param=[])
Show log extract.
Class to simplify the use of log pages.
Wrapper allowing us to handle a system message as a Content object.
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_REPLICA)
Find the first recent change matching some specific conditions.
static getMain()
Static methods.
static newFromId( $id, $flags=0)
Load a page revision from a given revision ID number.
static makeUrl( $name, $urlaction='')
Represents a title within MediaWiki.
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
namespace and then decline to actually register it file or subcat img or subcat $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 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
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 unset offset - wrap String Wrap the message in html(usually something like "<div ...>$1</div>"). - flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException':Called before an exception(or PHP error) is logged. This is meant for integration with external error aggregation services
null for the local wiki Added in
it s the revision text itself In either if gzip is the revision text is gzipped $flags
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
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
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
usually copyright or history_copyright This message must be in HTML not wikitext & $link
namespace are movable Hooks may change this value to override the return value of MWNamespace::isMovable(). 'NewDifferenceEngine' 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 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
namespace are movable Hooks may change this value to override the return value of MWNamespace::isMovable(). 'NewDifferenceEngine' 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
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)
if(!isset( $args[0])) $lang