Go to the documentation of this file.
84 $this->mOldId = $oldId;
85 $this->mPage = $this->
newPage( $title );
103 return $t ==
null ? null :
new static(
$t );
122 switch (
$title->getNamespace() ) {
166 $this->mRedirectedFrom = $from;
175 return $this->mPage->getTitle();
192 $this->mContentLoaded =
false;
194 $this->mRedirectedFrom =
null; #
Title object if set
195 $this->mRevIdFetched = 0;
196 $this->mRedirectUrl =
false;
198 $this->mPage->clear();
218 if ( $this->mPage->getId() === 0 ) {
219 # If this is a MediaWiki:x message, then load the messages
220 # and return the message value for x.
222 $text = $this->
getTitle()->getDefaultMessageText();
223 if ( $text ===
false ) {
229 $message = $this->
getContext()->getUser()->isLoggedIn() ?
'noarticletext' :
'noarticletextanon';
244 if ( is_null( $this->mOldId ) ) {
257 $this->mRedirectUrl =
false;
260 $oldid =
$request->getIntOrNull(
'oldid' );
262 if ( $oldid ===
null ) {
266 if ( $oldid !== 0 ) {
267 # Load the given revision and check whether the page is another one.
268 # In that case, update this instance to reflect the change.
269 if ( $oldid === $this->mPage->getLatest() ) {
270 $this->mRevision = $this->mPage->getRevision();
273 if ( $this->mRevision !==
null ) {
275 if ( $this->mPage->getId() != $this->mRevision->getPage() ) {
276 $function = [ get_class( $this->mPage ),
'newFromID' ];
277 $this->mPage = call_user_func( $function, $this->mRevision->getPage() );
283 if (
$request->getVal(
'direction' ) ==
'next' ) {
284 $nextid = $this->
getTitle()->getNextRevisionID( $oldid );
287 $this->mRevision =
null;
289 $this->mRedirectUrl = $this->
getTitle()->getFullURL(
'redirect=no' );
291 } elseif (
$request->getVal(
'direction' ) ==
'prev' ) {
292 $previd = $this->
getTitle()->getPreviousRevisionID( $oldid );
295 $this->mRevision =
null;
315 if ( $this->mContentLoaded ) {
319 $this->mContentLoaded =
true;
320 $this->mContent =
null;
324 # Pre-fill content with error message so that if something
325 # fails we'll have something telling us what we intended.
327 $this->mContentObject =
new MessageContent(
'missing-revision', [ $oldid ] );
330 # $this->mRevision might already be fetched by getOldIDFromRequest()
331 if ( !$this->mRevision ) {
333 if ( !$this->mRevision ) {
334 wfDebug( __METHOD__ .
" failed to retrieve specified revision, id $oldid\n" );
339 $oldid = $this->mPage->getLatest();
341 wfDebug( __METHOD__ .
" failed to find page data for title " .
342 $this->
getTitle()->getPrefixedText() .
"\n" );
346 # Update error message with correct oldid
347 $this->mContentObject =
new MessageContent(
'missing-revision', [ $oldid ] );
349 $this->mRevision = $this->mPage->getRevision();
351 if ( !$this->mRevision ) {
352 wfDebug( __METHOD__ .
" failed to retrieve current page, rev_id $oldid\n" );
360 $content = $this->mRevision->getContent(
366 wfDebug( __METHOD__ .
" failed to retrieve content of revision " .
367 $this->mRevision->getId() .
"\n" );
372 $this->mRevIdFetched = $this->mRevision->getId();
375 $articlePage = $this;
378 'ArticleAfterFetchContentObject',
379 [ &$articlePage, &$this->mContentObject ]
391 # If no oldid, this is the current version.
396 return $this->mPage->exists() && $this->mRevision && $this->mRevision->isCurrent();
418 if ( $this->mRevIdFetched ) {
421 return $this->mPage->getLatest();
432 # Get variables from query string
433 # As side effect this will load the revision and update the title
434 # in a revision ID is passed in the request, so this should remain
435 # the first call of this method even if $oldid is used way below.
439 # Another whitelist check in case getOldID() is altering the title
440 $permErrors = $this->
getTitle()->getUserPermissionsErrors(
'read',
$user );
441 if (
count( $permErrors ) ) {
442 wfDebug( __METHOD__ .
": denied on secondary read check\n" );
446 $outputPage = $this->
getContext()->getOutput();
447 # getOldID() may as well want us to redirect somewhere else
448 if ( $this->mRedirectUrl ) {
449 $outputPage->redirect( $this->mRedirectUrl );
450 wfDebug( __METHOD__ .
": redirecting due to oldid\n" );
455 # If we got diff in the query, we want to see a diff page instead of the article.
456 if ( $this->
getContext()->getRequest()->getCheck(
'diff' ) ) {
457 wfDebug( __METHOD__ .
": showing diff page\n" );
463 # Set page title (may be overridden by DISPLAYTITLE)
464 $outputPage->setPageTitle( $this->
getTitle()->getPrefixedText() );
466 $outputPage->setArticleFlag(
true );
467 # Allow frames by default
468 $outputPage->allowClickjacking();
473 # Render printable version, use printable version cache
474 if ( $outputPage->isPrintable() ) {
475 $parserOptions->setIsPrintable(
true );
476 $parserOptions->setEditSection(
false );
478 $parserOptions->setEditSection(
false );
481 # Try client and file cache
482 if ( !$wgDebugToolbar && $oldid === 0 && $this->mPage->checkTouched() ) {
483 # Try to stream the output from file cache
485 wfDebug( __METHOD__ .
": done file cache\n" );
486 # tell wgOut that output is taken care of
487 $outputPage->disable();
488 $this->mPage->doViewUpdates(
$user, $oldid );
494 # Should the parser cache be used?
495 $useParserCache = $this->mPage->shouldCheckParserCache( $parserOptions, $oldid );
496 wfDebug(
'Article::view using parser cache: ' . ( $useParserCache ?
'yes' :
'no' ) .
"\n" );
497 if (
$user->getStubThreshold() ) {
498 MediaWikiServices::getInstance()->getStatsdDataFactory()->increment(
'pcache_miss_stub' );
504 # Iterate through the possible ways of constructing the output text.
505 # Keep going until $outputDone is set, or we run out of things to do.
508 $this->mParserOutput =
false;
510 while ( !$outputDone && ++$pass ) {
514 $articlePage = $this;
515 Hooks::run(
'ArticleViewHeader', [ &$articlePage, &$outputDone, &$useParserCache ] );
518 # Early abort if the page doesn't exist
519 if ( !$this->mPage->exists() ) {
520 wfDebug( __METHOD__ .
": showing missing article\n" );
522 $this->mPage->doViewUpdates(
$user );
526 # Try the parser cache
527 if ( $useParserCache ) {
528 $this->mParserOutput = $parserCache->get( $this->mPage, $parserOptions );
530 if ( $this->mParserOutput !==
false ) {
532 wfDebug( __METHOD__ .
": showing parser cache contents for current rev permalink\n" );
535 wfDebug( __METHOD__ .
": showing parser cache contents\n" );
537 $outputPage->addParserOutput( $this->mParserOutput );
538 # Ensure that UI elements requiring revision ID have
539 # the correct version information.
540 $outputPage->setRevisionId( $this->mPage->getLatest() );
541 # Preload timestamp to avoid a DB hit
542 $cachedTimestamp = $this->mParserOutput->getTimestamp();
543 if ( $cachedTimestamp !==
null ) {
544 $outputPage->setRevisionTimestamp( $cachedTimestamp );
545 $this->mPage->setTimestamp( $cachedTimestamp );
552 # This will set $this->mRevision if needed
555 # Are we looking at an old revision
556 if ( $oldid && $this->mRevision ) {
560 wfDebug( __METHOD__ .
": cannot view deleted revision\n" );
565 # Ensure that UI elements requiring revision ID have
566 # the correct version information.
568 # Preload timestamp to avoid a DB hit
569 $outputPage->setRevisionTimestamp( $this->mPage->getTimestamp() );
574 # Allow extensions do their own custom view for certain pages
579 # Run the parse, protected by a pool counter
580 wfDebug( __METHOD__ .
": doing uncached parse\n" );
586 if ( !$poolArticleView->execute() ) {
587 $error = $poolArticleView->getError();
589 $outputPage->clearHTML();
590 $outputPage->enableClientCache(
false );
591 $outputPage->setRobotPolicy(
'noindex,nofollow' );
593 $errortext = $error->getWikiText(
false,
'view-pool-error' );
594 $outputPage->addWikiText(
'<div class="errorbox">' . $errortext .
'</div>' );
596 # Connection or timeout error
600 $this->mParserOutput = $poolArticleView->getParserOutput();
601 $outputPage->addParserOutput( $this->mParserOutput );
602 if (
$content->getRedirectTarget() ) {
603 $outputPage->addSubtitle(
"<span id=\"redirectsub\">" .
604 $this->
getContext()->msg(
'redirectpagesub' )->parse() .
"</span>" );
607 # Don't cache a dirty ParserOutput object
608 if ( $poolArticleView->getIsDirty() ) {
609 $outputPage->setCdnMaxage( 0 );
610 $outputPage->addHTML(
"<!-- parser cache is expired, " .
611 "sending anyway due to pool overload-->\n" );
616 # Should be unreachable, but just in case...
622 # Get the ParserOutput actually *displayed* here.
623 # Note that $this->mParserOutput is the *current*/oldid version output.
626 : $this->mParserOutput;
628 # Adjust title for main page & pages with displaytitle
633 # For the main page, overwrite the <title> element with the con-
634 # tents of 'pagetitle-view-mainpage' instead of the default (if
636 # This message always exists because it is in the i18n files
637 if ( $this->
getTitle()->isMainPage() ) {
638 $msg =
wfMessage(
'pagetitle-view-mainpage' )->inContentLanguage();
639 if ( !$msg->isDisabled() ) {
640 $outputPage->setHTMLTitle( $msg->title( $this->getTitle() )->
text() );
644 # Use adaptive TTLs for CDN so delayed/failed purges are noticed less often.
645 # This could use getTouched(), but that could be scary for major template edits.
648 # Check for any __NOINDEX__ tags on the page using $pOutput
650 $outputPage->setIndexPolicy( $policy[
'index'] );
651 $outputPage->setFollowPolicy( $policy[
'follow'] );
654 $this->mPage->doViewUpdates(
$user, $oldid );
656 $outputPage->addModules(
'mediawiki.action.view.postEdit' );
664 # Adjust the title if it was set by displaytitle, -{T|}- or language conversion
666 if ( strval( $titleText ) !==
'' ) {
667 $this->
getContext()->getOutput()->setPageTitle( $titleText );
680 $diffOnly =
$request->getBool(
'diffonly',
$user->getOption(
'diffonly' ) );
681 $purge =
$request->getVal(
'action' ) ==
'purge';
689 $msg = $this->
getContext()->msg(
'difference-missing-revision' )
693 $this->
getContext()->getOutput()->addHTML( $msg );
697 $contentHandler =
$rev->getContentHandler();
698 $de = $contentHandler->createDifferenceEngine(
708 $this->mRevIdFetched = $de->mNewid;
709 $de->showDiffPage( $diffOnly );
713 list( $old, $new ) = $de->mapDiffPrevNext( $oldid, $diff );
715 $this->mPage->doViewUpdates(
$user, (
int)$new );
726 global $wgArticleRobotPolicies, $wgNamespaceRobotPolicies, $wgDefaultRobotPolicy;
728 $ns = $this->
getTitle()->getNamespace();
730 # Don't index user and user talk pages for blocked users (T13443)
732 $specificTarget =
null;
734 $titleText = $this->
getTitle()->getText();
736 $vagueTarget = $titleText;
738 $specificTarget = $titleText;
742 'index' =>
'noindex',
743 'follow' =>
'nofollow'
748 if ( $this->mPage->getId() === 0 || $this->
getOldID() ) {
749 # Non-articles (special pages etc), and old revisions
751 'index' =>
'noindex',
752 'follow' =>
'nofollow'
754 } elseif ( $this->
getContext()->getOutput()->isPrintable() ) {
755 # Discourage indexing of printable versions, but encourage following
757 'index' =>
'noindex',
760 } elseif ( $this->
getContext()->getRequest()->getInt(
'curid' ) ) {
761 # For ?curid=x urls, disallow indexing
763 'index' =>
'noindex',
768 # Otherwise, construct the policy based on the various config variables.
771 if ( isset( $wgNamespaceRobotPolicies[$ns] ) ) {
772 # Honour customised robot policies for this namespace
773 $policy = array_merge(
775 self::formatRobotPolicy( $wgNamespaceRobotPolicies[$ns] )
778 if ( $this->
getTitle()->canUseNoindex() && is_object( $pOutput ) && $pOutput->getIndexPolicy() ) {
779 # __INDEX__ and __NOINDEX__ magic words, if allowed. Incorporates
780 # a final sanity check that we have really got the parser output.
781 $policy = array_merge(
783 [
'index' => $pOutput->getIndexPolicy() ]
787 if ( isset( $wgArticleRobotPolicies[$this->
getTitle()->getPrefixedText()] ) ) {
788 # (T16900) site config can override user-defined __INDEX__ or __NOINDEX__
789 $policy = array_merge(
791 self::formatRobotPolicy( $wgArticleRobotPolicies[$this->
getTitle()->getPrefixedText()] )
806 if ( is_array( $policy ) ) {
808 } elseif ( !$policy ) {
812 $policy = explode(
',', $policy );
813 $policy = array_map(
'trim', $policy );
816 foreach ( $policy
as $var ) {
817 if ( in_array( $var, [
'index',
'noindex' ] ) ) {
818 $arr[
'index'] = $var;
819 } elseif ( in_array( $var, [
'follow',
'nofollow' ] ) ) {
820 $arr[
'follow'] = $var;
835 global $wgRedirectSources;
840 $rdfrom =
$request->getVal(
'rdfrom' );
844 unset(
$query[
'rdfrom'] );
848 $query[
'redirect'] =
'no';
852 if ( isset( $this->mRedirectedFrom ) ) {
854 $articlePage = $this;
858 if (
Hooks::run(
'ArticleViewRedirect', [ &$articlePage ] ) ) {
860 $this->mRedirectedFrom,
863 [
'redirect' =>
'no' ]
866 $outputPage->addSubtitle(
"<span class=\"mw-redirectedfrom\">" .
867 $context->
msg(
'redirectedfrom' )->rawParams( $redir )->parse()
872 $outputPage->addJsConfigVars( [
873 'wgInternalRedirectTargetUrl' => $redirectTargetUrl,
875 $outputPage->addModules(
'mediawiki.action.view.redirect' );
878 $outputPage->setCanonicalUrl( $this->
getTitle()->getCanonicalURL() );
881 $outputPage->setRedirectedFrom( $this->mRedirectedFrom );
885 } elseif ( $rdfrom ) {
888 if ( $wgRedirectSources && preg_match( $wgRedirectSources, $rdfrom ) ) {
890 $outputPage->addSubtitle(
"<span class=\"mw-redirectedfrom\">" .
891 $context->
msg(
'redirectedfrom' )->rawParams( $redir )->parse()
895 $outputPage->addJsConfigVars( [
896 'wgInternalRedirectTargetUrl' => $redirectTargetUrl,
898 $outputPage->addModules(
'mediawiki.action.view.redirect' );
912 if ( $this->
getTitle()->isTalkPage() ) {
913 if ( !
wfMessage(
'talkpageheader' )->isDisabled() ) {
914 $this->
getContext()->getOutput()->wrapWikiMsg(
915 "<div class=\"mw-talkpageheader\">\n$1\n</div>",
926 # check if we're displaying a [[User talk:x.x.x.x]] anonymous talk page
930 $this->
getContext()->getOutput()->addWikiMsg(
'anontalkpagetext' );
936 Hooks::run(
'ArticleViewFooter', [ $this, $patrolFooterShown ] );
949 global $wgUseNPPatrol, $wgUseRCPatrol, $wgUseFilePatrol, $wgEnableAPI, $wgEnableWriteAPI;
951 $outputPage = $this->
getContext()->getOutput();
957 || !( $wgUseRCPatrol || $wgUseNPPatrol
964 if ( $this->mRevision
975 if (
$cache->get( $key ) ) {
980 $oldestRevisionTimestamp =
$dbr->selectField(
982 'MIN( rev_timestamp )',
983 [
'rev_page' =>
$title->getArticleID() ],
992 $recentPageCreation =
false;
993 if ( $oldestRevisionTimestamp
997 $recentPageCreation =
true;
1001 'rc_timestamp' => $oldestRevisionTimestamp,
1002 'rc_namespace' =>
$title->getNamespace(),
1003 'rc_cur_id' =>
$title->getArticleID()
1009 $markPatrolledMsg =
wfMessage(
'markaspatrolledtext' );
1017 $recentFileUpload =
false;
1018 if ( ( !$rc || $rc->getAttribute(
'rc_patrolled' ) ) && $wgUseFilePatrol
1021 $newestUploadTimestamp =
$dbr->selectField(
1023 'MAX( img_timestamp )',
1024 [
'img_name' =>
$title->getDBkey() ],
1027 if ( $newestUploadTimestamp
1031 $recentFileUpload =
true;
1035 'rc_log_type' =>
'upload',
1036 'rc_timestamp' => $newestUploadTimestamp,
1038 'rc_cur_id' =>
$title->getArticleID()
1041 [
'USE INDEX' =>
'rc_timestamp' ]
1045 $markPatrolledMsg =
wfMessage(
'markaspatrolledtext-file' );
1050 if ( !$recentPageCreation && !$recentFileUpload ) {
1055 $cache->set( $key,
'1' );
1067 if ( $rc->getAttribute(
'rc_patrolled' ) ) {
1072 $cache->set( $key,
'1' );
1077 if ( $rc->getPerformer()->equals(
$user ) ) {
1083 $outputPage->preventClickjacking();
1084 if ( $wgEnableAPI && $wgEnableWriteAPI &&
$user->isAllowed(
'writeapi' ) ) {
1085 $outputPage->addModules(
'mediawiki.page.patrol.ajax' );
1090 $markPatrolledMsg->escaped(),
1093 'action' =>
'markpatrolled',
1094 'rcid' => $rc->getAttribute(
'rc_id' ),
1098 $outputPage->addHTML(
1099 "<div class='patrollink' data-mw='interface'>" .
1100 wfMessage(
'markaspatrolledlink' )->rawParams(
$link )->escaped() .
1125 $outputPage = $this->
getContext()->getOutput();
1127 $validUserPage =
false;
1131 # Show info in user (talk) namespace. Does the user exist? Is he blocked?
1135 $rootPart = explode(
'/',
$title->getText() )[0];
1141 $outputPage->wrapWikiMsg(
"<div class=\"mw-userpage-userdoesnotexist error\">\n\$1\n</div>",
1144 # Show log extract if the user is currently blocked
1152 'showIfEmpty' =>
false,
1154 'blocked-notice-logextract',
1155 $user->getName() # Support GENDER
in notice
1159 $validUserPage = !
$title->isSubpage();
1161 $validUserPage = !
$title->isSubpage();
1165 Hooks::run(
'ShowMissingArticle', [ $this ] );
1167 # Show delete and move logs if there were any such events.
1168 # The logging query can DOS the site when bots/crawlers cause 404 floods,
1169 # so be careful showing this. 404 pages must be cheap as they are hard to cache.
1171 $key =
wfMemcKey(
'page-recent-delete', md5(
$title->getPrefixedText() ) );
1172 $loggedIn = $this->
getContext()->getUser()->isLoggedIn();
1173 if ( $loggedIn ||
$cache->get( $key ) ) {
1174 $logTypes = [
'delete',
'move' ];
1178 $conds = [
'log_action != ' .
$dbr->addQuotes(
'revision' ) ];
1180 Hooks::run(
'Article::MissingArticleConditions', [ &$conds, $logTypes ] );
1189 'showIfEmpty' =>
false,
1190 'msgKey' => [ $loggedIn
1191 ?
'moveddeleted-notice'
1192 :
'moveddeleted-notice-recent'
1198 if ( !$this->mPage->hasViewableContent() && $wgSend404Code && !$validUserPage ) {
1201 $this->
getContext()->getRequest()->response()->statusHeader( 404 );
1206 $outputPage->setIndexPolicy( $policy[
'index'] );
1207 $outputPage->setFollowPolicy( $policy[
'follow'] );
1209 $hookResult =
Hooks::run(
'BeforeDisplayNoArticleText', [ $this ] );
1211 if ( !$hookResult ) {
1215 # Show error message
1221 $text =
wfMessage(
'missing-revision', $oldid )->plain();
1222 } elseif (
$title->quickUserCan(
'create', $this->getContext()->getUser() )
1223 &&
$title->quickUserCan(
'edit', $this->getContext()->getUser() )
1225 $message = $this->
getContext()->getUser()->isLoggedIn() ?
'noarticletext' :
'noarticletextanon';
1228 $text =
wfMessage(
'noarticletext-nopermission' )->plain();
1234 'class' =>
"noarticletext mw-content-$dir",
1237 ] ) .
"\n$text\n</div>" );
1253 $outputPage = $this->
getContext()->getOutput();
1257 $outputPage->wrapWikiMsg(
"<div class='mw-warning plainlinks'>\n$1\n</div>\n",
1258 'rev-deleted-text-permission' );
1262 } elseif ( $this->
getContext()->getRequest()->getInt(
'unhide' ) != 1 ) {
1263 # Give explanation and add a link to view the revision...
1264 $oldid = intval( $this->
getOldID() );
1265 $link = $this->
getTitle()->getFullURL(
"oldid={$oldid}&unhide=1" );
1267 'rev-suppressed-text-unhide' :
'rev-deleted-text-unhide';
1268 $outputPage->wrapWikiMsg(
"<div class='mw-warning plainlinks'>\n$1\n</div>\n",
1275 'rev-suppressed-text-view' :
'rev-deleted-text-view';
1276 $outputPage->wrapWikiMsg(
"<div class='mw-warning plainlinks'>\n$1\n</div>\n", $msg );
1292 $articlePage = $this;
1294 if ( !
Hooks::run(
'DisplayOldSubtitle', [ &$articlePage, &$oldid ] ) ) {
1301 # Cascade unhide param in links for easy deletion browsing
1304 $extraParams[
'unhide'] = 1;
1307 if ( $this->mRevision && $this->mRevision->getId() === $oldid ) {
1313 $timestamp = $revision->getTimestamp();
1315 $current = ( $oldid == $this->mPage->getLatest() );
1319 $td = $language->userTimeAndDate( $timestamp,
$user );
1320 $tddate = $language->userDate( $timestamp,
$user );
1321 $tdtime = $language->userTime( $timestamp,
$user );
1323 # Show user links if allowed to see them. If hidden, then show them only if requested...
1326 $infomsg = $current && !
$context->
msg(
'revision-info-current' )->isDisabled()
1327 ?
'revision-info-current'
1331 $revisionInfo =
"<div id=\"mw-{$infomsg}\">" .
1333 ->rawParams( $userlinks )
1334 ->params( $revision->getId(), $tddate, $tdtime, $revision->getUserText() )
1340 ?
$context->
msg(
'currentrevisionlink' )->escaped()
1343 $context->
msg(
'currentrevisionlink' )->escaped(),
1358 $prev = $this->
getTitle()->getPreviousRevisionID( $oldid );
1365 'direction' =>
'prev',
1381 $nextlink = $current
1388 'direction' =>
'next',
1392 $nextdiff = $current
1405 if ( $cdel !==
'' ) {
1410 $outputPage->addSubtitle(
"<div class=\"mw-revision\">" . $revisionInfo .
1411 "<div id=\"mw-revision-nav\">" . $cdel .
1413 $prevdiff, $prevlink, $lnk, $curdiff, $nextlink, $nextdiff
1414 )->escaped() .
"</div></div>" );
1428 public function viewRedirect( $target, $appendSubtitle =
true, $forceKnown =
false ) {
1431 if ( $appendSubtitle ) {
1434 $out->addModuleStyles(
'mediawiki.action.view.redirectPage' );
1435 return static::getRedirectHeaderHtml(
$lang, $target, $forceKnown );
1451 if ( !is_array( $target ) ) {
1452 $target = [ $target ];
1455 $html =
'<ul class="redirectText">';
1460 htmlspecialchars(
$title->getFullText() ),
1463 $title->isRedirect() ? [
'redirect' =>
'no' ] : [],
1464 ( $forceKnown ? [
'known',
'noclasses' ] : [] )
1469 $redirectToText =
wfMessage(
'redirectto' )->inLanguage(
$lang )->escaped();
1471 return '<div class="redirectMsg">' .
1472 '<p>' . $redirectToText .
'</p>' .
1487 'namespace-' . $this->
getTitle()->getNamespace() .
'-helppage'
1491 if ( !$msg->isDisabled() ) {
1493 $out->addHelpLink( $helpUrl,
true );
1495 $out->addHelpLink( $to, $overrideBaseUrl );
1503 $this->
getContext()->getRequest()->response()->header(
'X-Robots-Tag: noindex' );
1504 $this->
getContext()->getOutput()->setArticleBodyOnly(
true );
1505 $this->
getContext()->getOutput()->enableSectionEditLinks(
false );
1527 public function delete() {
1528 # This code desperately needs to be totally rewritten
1536 $permissionErrors =
$title->getUserPermissionsErrors(
'delete',
$user );
1537 if (
count( $permissionErrors ) ) {
1541 # Read-only check...
1546 # Better double-check that it hasn't been deleted yet!
1547 $this->mPage->loadPageData(
1548 $request->wasPosted() ? WikiPage::READ_LATEST : WikiPage::READ_NORMAL
1550 if ( !$this->mPage->exists() ) {
1551 $deleteLogPage =
new LogPage(
'delete' );
1553 $outputPage->setPageTitle(
$context->
msg(
'cannotdelete-title',
$title->getPrefixedText() ) );
1554 $outputPage->wrapWikiMsg(
"<div class=\"error mw-error-cannotdelete\">\n$1\n</div>",
1557 $outputPage->addHTML(
1558 Xml::element(
'h2',
null, $deleteLogPage->getName()->text() )
1569 $deleteReasonList =
$request->getText(
'wpDeleteReasonList',
'other' );
1570 $deleteReason =
$request->getText(
'wpReason' );
1572 if ( $deleteReasonList ==
'other' ) {
1573 $reason = $deleteReason;
1574 } elseif ( $deleteReason !=
'' ) {
1576 $colonseparator =
wfMessage(
'colon-separator' )->inContentLanguage()->text();
1577 $reason = $deleteReasonList . $colonseparator . $deleteReason;
1579 $reason = $deleteReasonList;
1583 [
'delete', $this->
getTitle()->getPrefixedText() ] )
1585 # Flag to hide all contents of the archived revisions
1586 $suppress =
$request->getVal(
'wpSuppress' ) &&
$user->isAllowed(
'suppressrevision' );
1588 $this->
doDelete( $reason, $suppress );
1596 $hasHistory =
false;
1600 }
catch ( Exception
$e ) {
1601 # if a page is horribly broken, we still want to be able to
1602 # delete it. So be lenient about errors here.
1603 wfDebug(
"Error while building auto delete summary: $e" );
1609 if ( $hasHistory ) {
1618 $revisions = $edits = (int)
$dbr->selectField(
1621 [
'rev_page' =>
$title->getArticleID() ],
1627 '<strong class="mw-delete-warning-revisions">' .
1628 $context->
msg(
'historywarning' )->numParams( $revisions )->parse() .
1632 [
'action' =>
'history' ] ) .
1636 if (
$title->isBigDeletion() ) {
1637 global $wgDeleteRevisionsLimit;
1640 'delete-warning-toobig',
1656 wfDebug(
"Article::confirmDelete\n" );
1660 $outputPage = $ctx->getOutput();
1661 $useMediaWikiUIEverywhere = $ctx->getConfig()->get(
'UseMediaWikiUIEverywhere' );
1662 $outputPage->setPageTitle(
wfMessage(
'delete-confirm',
$title->getPrefixedText() ) );
1663 $outputPage->addBacklinkSubtitle(
$title );
1664 $outputPage->setRobotPolicy(
'noindex,nofollow' );
1665 $backlinkCache =
$title->getBacklinkCache();
1666 if ( $backlinkCache->hasLinks(
'pagelinks' ) || $backlinkCache->hasLinks(
'templatelinks' ) ) {
1667 $outputPage->wrapWikiMsg(
"<div class='mw-warning plainlinks'>\n$1\n</div>\n",
1668 'deleting-backlinks-warning' );
1670 $outputPage->addWikiMsg(
'confirmdeletetext' );
1672 Hooks::run(
'ArticleConfirmDelete', [ $this, $outputPage, &$reason ] );
1675 if (
$user->isAllowed(
'suppressrevision' ) ) {
1678 'wpSuppress',
'wpSuppress',
false, [
'tabindex' =>
'4' ] ) .
1683 $checkWatch =
$user->getBoolOption(
'watchdeletion' ) ||
$user->isWatched(
$title );
1685 'action' =>
$title->getLocalURL(
'action=delete' ),
'id' =>
'deleteconfirm' ] ) .
1693 'wpDeleteReasonList',
1694 wfMessage(
'deletereason-dropdown' )->inContentLanguage()->
text(),
1695 wfMessage(
'deletereasonotherlist' )->inContentLanguage()->
text(),
1706 'maxlength' =>
'255',
1709 'class' =>
'mw-ui-input-inline',
1714 # Disallow watching if user is not logged in
1715 if (
$user->isLoggedIn() ) {
1718 'wpWatch',
'wpWatch', $checkWatch, [
'tabindex' =>
'3' ] );
1726 'name' =>
'wpConfirmB',
1727 'id' =>
'wpConfirmB',
1729 'class' => $useMediaWikiUIEverywhere ?
'mw-ui-button mw-ui-destructive' :
'',
1737 $user->getEditToken( [
'delete',
$title->getPrefixedText() ] )
1741 if (
$user->isAllowed(
'editinterface' ) ) {
1743 $ctx->msg(
'deletereason-dropdown' )->inContentLanguage()->getTitle(),
1744 wfMessage(
'delete-edit-reasonlist' )->escaped(),
1746 [
'action' =>
'edit' ]
1748 $form .=
'<p class="mw-delete-editreasons">' .
$link .
'</p>';
1751 $outputPage->addHTML( $form );
1753 $deleteLogPage =
new LogPage(
'delete' );
1754 $outputPage->addHTML(
Xml::element(
'h2',
null, $deleteLogPage->getName()->text() ) );
1763 public function doDelete( $reason, $suppress =
false ) {
1768 $status = $this->mPage->doDeleteArticleReal( $reason, $suppress, 0,
true, $error,
$user );
1771 $deleted = $this->
getTitle()->getPrefixedText();
1773 $outputPage->setPageTitle(
wfMessage(
'actioncomplete' ) );
1774 $outputPage->setRobotPolicy(
'noindex,nofollow' );
1776 $loglink =
'[[Special:Log/delete|' .
wfMessage(
'deletionlog' )->text() .
']]';
1778 $outputPage->addWikiMsg(
'deletedtext',
wfEscapeWikiText( $deleted ), $loglink );
1782 $outputPage->returnToMain(
false );
1784 $outputPage->setPageTitle(
1786 $this->
getTitle()->getPrefixedText() )
1789 if ( $error ==
'' ) {
1790 $outputPage->addWikiText(
1791 "<div class=\"error mw-error-cannotdelete\">\n" .
$status->getWikiText() .
"\n</div>"
1793 $deleteLogPage =
new LogPage(
'delete' );
1794 $outputPage->addHTML(
Xml::element(
'h2',
null, $deleteLogPage->getName()->text() ) );
1802 $outputPage->addHTML( $error );
1817 static $called =
false;
1820 wfDebug(
"Article::tryFileCache(): called twice!?\n" );
1827 if (
$cache->isCacheGood( $this->mPage->getTouched() ) ) {
1828 wfDebug(
"Article::tryFileCache(): about to load file\n" );
1832 wfDebug(
"Article::tryFileCache(): starting buffer\n" );
1833 ob_start( [ &
$cache,
'saveToFileCache' ] );
1836 wfDebug(
"Article::tryFileCache(): not cacheable\n" );
1851 $cacheable = $this->mPage->getId()
1852 && !$this->mRedirectedFrom && !$this->
getTitle()->isRedirect();
1856 $articlePage = $this;
1857 $cacheable =
Hooks::run(
'IsFileCacheable', [ &$articlePage ] );
1880 if (
$user ===
null ) {
1883 $parserOptions = $this->mPage->makeParserOptions(
$user );
1886 return $this->mPage->getParserOutput( $parserOptions, $oldid );
1896 if ( $this->mParserOptions ) {
1897 throw new MWException(
"can't change parser options after they have already been set" );
1901 $this->mParserOptions = clone
$options;
1909 if ( !$this->mParserOptions ) {
1910 $this->mParserOptions = $this->mPage->makeParserOptions( $this->
getContext() );
1936 wfDebug( __METHOD__ .
" called and \$mContext is null. " .
1937 "Return RequestContext::getMain(); for sanity\n" );
1950 if ( property_exists( $this->mPage,
$fname ) ) {
1951 # wfWarn( "Access to raw $fname field " . __CLASS__ );
1952 return $this->mPage->$fname;
1954 trigger_error(
'Inaccessible property via __get(): ' .
$fname, E_USER_NOTICE );
1965 if ( property_exists( $this->mPage,
$fname ) ) {
1966 # wfWarn( "Access to raw $fname field of " . __CLASS__ );
1967 $this->mPage->$fname = $fvalue;
1969 } elseif ( !in_array(
$fname, [
'mContext',
'mPage' ] ) ) {
1970 $this->mPage->$fname = $fvalue;
1972 trigger_error(
'Inaccessible property via __set(): ' .
$fname, E_USER_NOTICE );
1981 return $this->mPage->checkFlags(
$flags );
1989 return $this->mPage->checkTouched();
1997 $this->mPage->clearPreparedEdit();
2005 $reason, $suppress =
false, $u1 =
null, $u2 =
null, &$error =
'',
User $user =
null,
2008 return $this->mPage->doDeleteArticleReal(
2009 $reason, $suppress, $u1, $u2, $error,
$user, $tags
2018 return $this->mPage->doDeleteUpdates( $id,
$content );
2030 return $this->mPage->doEditContent(
$content, $summary,
$flags, $baseRevId,
2031 $user, $serialFormat
2040 return $this->mPage->doEditUpdates( $revision,
$user,
$options );
2050 return $this->mPage->doPurge();
2060 return $this->mPage->getLastPurgeTimestamp();
2068 $this->mPage->doViewUpdates(
$user, $oldid );
2076 return $this->mPage->exists();
2084 return $this->mPage->followRedirect();
2092 return $this->mPage->getActionOverrides();
2100 return $this->mPage->getAutoDeleteReason( $hasHistory );
2108 return $this->mPage->getCategories();
2116 return $this->mPage->getComment( $audience,
$user );
2124 return $this->mPage->getContentHandler();
2132 return $this->mPage->getContentModel();
2140 return $this->mPage->getContributors();
2148 return $this->mPage->getCreator( $audience,
$user );
2156 return $this->mPage->getDeletionUpdates(
$content );
2164 return $this->mPage->getHiddenCategories();
2172 return $this->mPage->getId();
2180 return $this->mPage->getLatest();
2188 return $this->mPage->getLinksTimestamp();
2196 return $this->mPage->getMinorEdit();
2204 return $this->mPage->getOldestRevision();
2212 return $this->mPage->getRedirectTarget();
2220 return $this->mPage->getRedirectURL( $rt );
2228 return $this->mPage->getRevision();
2236 return $this->mPage->getTimestamp();
2244 return $this->mPage->getTouched();
2252 return $this->mPage->getUndoContent( $undo, $undoafter );
2260 return $this->mPage->getUser( $audience,
$user );
2268 return $this->mPage->getUserText( $audience,
$user );
2276 return $this->mPage->hasViewableContent();
2284 return $this->mPage->insertOn( $dbw, $pageId );
2292 array $expiry, $cascade, $reason,
$user =
null
2294 return $this->mPage->insertProtectNullRevision( $revCommentMsg,
$limit,
2295 $expiry, $cascade, $reason,
$user
2304 return $this->mPage->insertRedirect();
2312 return $this->mPage->insertRedirectEntry( $rt, $oldLatest );
2320 return $this->mPage->isCountable( $editInfo );
2328 return $this->mPage->isRedirect();
2336 return $this->mPage->loadFromRow( $data, $from );
2344 $this->mPage->loadPageData( $from );
2352 return $this->mPage->lockAndGetLatest();
2360 return $this->mPage->makeParserOptions(
$context );
2368 return $this->mPage->pageDataFromId(
$dbr, $id,
$options );
2385 $serialFormat =
null, $useCache =
true
2387 return $this->mPage->prepareContentForEdit(
2389 $serialFormat, $useCache
2398 return $this->mPage->protectDescription(
$limit, $expiry );
2406 return $this->mPage->protectDescriptionLog(
$limit, $expiry );
2414 $sectionTitle =
'', $baseRevId =
null
2416 return $this->mPage->replaceSectionAtRev( $sectionId,
$sectionContent,
2417 $sectionTitle, $baseRevId
2428 return $this->mPage->replaceSectionContent(
2438 return $this->mPage->setTimestamp( $ts );
2446 return $this->mPage->shouldCheckParserCache( $parserOptions, $oldId );
2454 return $this->mPage->supportsSections();
2462 return $this->mPage->triggerOpportunisticLinksUpdate(
$parserOutput );
2470 return $this->mPage->updateCategoryCounts( $added, $deleted, $id );
2478 return $this->mPage->updateIfNewerOn( $dbw, $revision );
2486 return $this->mPage->updateRedirectOn( $dbw, $redirectTitle, $lastRevIsRedirect =
null );
2494 $lastRevIsRedirect =
null
2496 return $this->mPage->updateRevisionOn( $dbw, $revision, $lastRevision,
2512 return $this->mPage->doUpdateRestrictions(
$limit, $expiry, $cascade, $reason,
$user );
2523 &$cascade = 0, $expiry = []
2525 return $this->mPage->doUpdateRestrictions(
2543 $reason, $suppress =
false, $u1 =
null, $u2 =
null, &$error =
''
2545 return $this->mPage->doDeleteArticle( $reason, $suppress, $u1, $u2, $error );
2559 return $this->mPage->doRollback( $fromP, $summary, $token, $bot, $resultDetails,
$user );
2571 $guser = is_null( $guser ) ? $this->
getContext()->getUser() : $guser;
2572 return $this->mPage->commitRollback( $fromP, $summary, $bot, $resultDetails, $guser );
2580 $title = $this->mPage->getTitle();
Show an error when the wiki is locked/read-only and the user tries to do something that requires writ...
showMissingArticle()
Show the error text for a missing article.
checkFlags( $flags)
Call to WikiPage function for backwards compatibility.
Set options of the Parser.
static useFileCache(IContextSource $context, $mode=self::MODE_NORMAL)
Check if pages can be cached for this request/user.
Interface for type hinting (accepts WikiPage, Article, ImagePage, CategoryPage)
error also a ContextSource you ll probably need to make sure the header is varied on and they can depend only on the ResourceLoaderContext $context
static onArticleCreate(Title $title)
The onArticle*() functions are supposed to be a kind of hooks which should be called whenever any of ...
isRedirect()
Call to WikiPage function for backwards compatibility.
getCategories()
Call to WikiPage function for backwards compatibility.
error also a ContextSource you ll probably need to make sure the header is varied on $request
static formatRobotPolicy( $policy)
Converts a String robot policy into an associative array, to allow merging of several policies using ...
getRedirectTarget()
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.
static newFromId( $id, $flags=0)
Load a page revision from a given revision ID number.
doDeleteUpdates( $id, Content $content=null)
Call to WikiPage function for backwards compatibility.
msg()
Get a Message object with context set Parameters are the same as wfMessage()
getContentModel()
Call to WikiPage function for backwards compatibility.
getUserText( $audience=Revision::FOR_PUBLIC, User $user=null)
Call to WikiPage function for backwards compatibility.
getLinksTimestamp()
Call to WikiPage function for backwards compatibility.
static onArticleCreate( $title)
getOldIDFromRequest()
Sets $this->mRedirectUrl to a correct URL if the query parameters are incorrect.
showPatrolFooter()
If patrol is possible, output a patrol UI box.
if(!isset( $args[0])) $lang
static newFromConds( $conds, $fname=__METHOD__, $dbType=DB_REPLICA)
Find the first recent change matching some specific conditions.
tryFileCache()
checkLastModified returns true if it has taken care of all output to the client that is necessary for...
getContentHandler()
Call to WikiPage function for backwards compatibility.
clearPreparedEdit()
Call to WikiPage function for backwards compatibility.
Page view caching in the file system.
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
lockAndGetLatest()
Call to WikiPage function for backwards compatibility.
ParserOutput $mParserOutput
supportsSections()
Call to WikiPage function for backwards compatibility.
getOldestRevision()
Call to WikiPage function for backwards compatibility.
getDeletionUpdates(Content $content=null)
Call to WikiPage function for backwards compatibility.
checkTouched()
Call to WikiPage function for backwards compatibility.
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty & $sectionContent
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist and Watchlist you will want to construct new ChangesListBooleanFilter or ChangesListStringOptionsFilter objects When constructing you specify which group they belong to You can reuse existing or create your you must register them with $special registerFilterGroup 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
getRevision()
Call to WikiPage function for backwards compatibility.
Special handling for category description pages, showing pages, subcategories and file that belong to...
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
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 account $user
Class representing a MediaWiki article and history.
if(!defined( 'MEDIAWIKI')) $fname
This file is not a valid entry point, perform no further processing unless MEDIAWIKI is defined.
getRobotPolicy( $action, $pOutput=null)
Get the robot policy to be used for the current view.
doDeleteArticle( $reason, $suppress=false, $u1=null, $u2=null, &$error='')
getCreator( $audience=Revision::FOR_PUBLIC, User $user=null)
Call to WikiPage function for backwards compatibility.
static newFromTarget( $specificTarget, $vagueTarget=null, $fromMaster=false)
Given a target and the target's type, get an existing Block object if possible.
wfReadOnly()
Check whether the wiki is in read-only mode.
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
static linkKnown( $target, $html=null, $customAttribs=[], $query=[], $options=[ 'known'])
Identical to link(), except $options defaults to 'known'.
showDiffPage()
Show a diff page according to current request variables.
static getForTitle(Title $title)
Returns the appropriate ContentHandler singleton for the given title.
Class for viewing MediaWiki file description pages.
getRequest()
Get the WebRequest object.
Show an error when a user tries to do something they do not have the necessary permissions for.
confirmDelete( $reason)
Output deletion confirmation dialog.
IContextSource $mContext
The context this Article is executed in.
updateCategoryCounts(array $added, array $deleted, $id=0)
Call to WikiPage function for backwards compatibility.
getUser()
Get the User object.
static onArticleEdit(Title $title, Revision $revision=null)
Purge caches on page update etc.
adjustDisplayTitle(ParserOutput $pOutput)
Adjust title for pages with displaytitle, -{T|}- or language conversion.
showNamespaceHeader()
Show a header specific to the namespace currently being viewed, like [[MediaWiki:Talkpagetext]].
shouldCheckParserCache(ParserOptions $parserOptions, $oldId)
Call to WikiPage function for backwards compatibility.
static openElement( $element, $attribs=null)
This opens an XML element.
Content $mContentObject
Content of the revision we are working on.
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
protectDescriptionLog(array $limit, array $expiry)
Call to WikiPage function for backwards compatibility.
static input( $name, $value='', $type='text', array $attribs=[])
Convenience function to produce an "<input>" element.
getLanguage()
Get the Language object.
static closeElement( $element)
Returns "</$element>".
unprotect()
action=unprotect handler (alias)
insertRedirect()
Call to WikiPage function for backwards compatibility.
null for the 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
getRedirectedFrom()
Get the page this view was redirected from.
fetchContentObject()
Get text content object Does NOT follow redirects.
getLastPurgeTimestamp()
Call to WikiPage function for backwards compatibility.
updateRedirectOn( $dbw, $redirectTitle, $lastRevIsRedirect=null)
Call to WikiPage function for backwards compatibility.
static newFromWikiPage(WikiPage $page, IContextSource $context)
Create an Article object of the appropriate class for the given page.
getTouched()
Call to WikiPage function for backwards compatibility.
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
static onArticleDelete( $title)
wfMemcKey()
Make a cache key for the local wiki.
namespace and then decline to actually register it file or subcat img or subcat $title
getTitle()
Get the title object of the article.
updateRevisionOn( $dbw, $revision, $lastRevision=null, $lastRevIsRedirect=null)
Call to WikiPage function for backwards compatibility.
render()
Handle action=render.
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
static getMainStashInstance()
Get the cache object for the main stash.
insertProtectNullRevision( $revCommentMsg, array $limit, array $expiry, $cascade, $reason, $user=null)
Call to WikiPage function for backwards compatibility.
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
exists()
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.
$wgUseFileCache
This will cache static pages for non-logged-in users to reduce database traffic on public sites.
static selectFields()
Return the list of revision fields that should be selected to create a new page.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist and Watchlist you will want to construct new ChangesListBooleanFilter or ChangesListStringOptionsFilter objects When constructing you specify which group they belong to You can reuse existing or create your you must register them with $special registerFilterGroup 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
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
static revUserTools( $rev, $isPublic=false)
Generate a user tool link cluster if the current user is allowed to view it.
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
__construct(Title $title, $oldId=null)
Constructor and clear the article.
getOutput()
Get the OutputPage object.
null for the wiki Added in
showDeletedRevisionHeader()
If the revision requested for view is deleted, check permissions.
isFileCacheable( $mode=HTMLFileCache::MODE_NORMAL)
Check if the page can be cached.
doRollback( $fromP, $summary, $token, $bot, &$resultDetails, User $user=null)
Class to simplify the use of log pages.
setOldSubtitle( $oldid=0)
Generate the navigation links when browsing through an article revisions It shows the information as:...
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist and Watchlist you will want to construct new ChangesListBooleanFilter or ChangesListStringOptionsFilter objects When constructing you specify which group they belong to You can reuse existing or create your you must register them with $special registerFilterGroup 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 please use GetContentModels hook to make them known to core 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
static onArticleDelete(Title $title)
Clears caches when article is deleted.
static element( $element, $attribs=null, $contents='', $allowShortTag=true)
Format an XML element with given attributes and, optionally, text content.
getPage()
Get the WikiPage object of this instance.
getContext()
Gets the context this Article is executed in.
static isIP( $name)
Does the string match an anonymous IP address?
static doWatchOrUnwatch( $watch, Title $title, User $user)
Watch or unwatch a page.
getComment( $audience=Revision::FOR_PUBLIC, User $user=null)
Call to WikiPage function for backwards compatibility.
pageDataFromId( $dbr, $id, $options=[])
Call to WikiPage function for backwards compatibility.
insertOn( $dbw, $pageId=null)
Call to WikiPage function for backwards compatibility.
static makeExternalLink( $url, $text, $escape=true, $linktype='', $attribs=[], $title=null)
Make an external link.
static makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
when a variable name is used in a it is silently declared as a new masking the global
getRedirectURL( $rt)
Call to WikiPage function for backwards compatibility.
static showLogExtract(&$out, $types=[], $page='', $user='', $param=[])
Show log extract.
static newFromID( $id)
Constructor from a page id.
getUndoContent(Revision $undo, Revision $undoafter=null)
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.
static label( $label, $id, array $attribs=[])
Convenience function for generating a label for inputs.
int $mRevIdFetched
Revision ID of revision we are working on.
doEditContent(Content $content, $summary, $flags=0, $baseRevId=false, User $user=null, $serialFormat=null)
Call to WikiPage function for backwards compatibility.
getLatest()
Call to WikiPage function for backwards compatibility.
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
isCurrent()
Returns true if the currently-referenced revision is the current edit to this page (and it exists).
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
static makeContent( $text, Title $title=null, $modelId=null, $format=null)
Convenience function for creating a Content object from a given textual representation.
getAutoDeleteReason(&$hasHistory)
Call to WikiPage function for backwards compatibility.
bool $mContentLoaded
Is the content ($mContent) already loaded?
setParserOptions(ParserOptions $options)
Override the ParserOptions used to render the primary article wikitext.
isCountable( $editInfo=false)
Call to WikiPage function for backwards compatibility.
Title $mRedirectedFrom
Title from which we were redirected here.
doDelete( $reason, $suppress=false)
Perform a deletion and output success or failure messages.
static hidden( $name, $value, array $attribs=[])
Convenience function to produce an input element with type=hidden.
doPurge()
Call to WikiPage function for backwards compatibility.
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.
div flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException' returning false will NOT prevent logging $e
static singleton()
Get an instance of this object.
hasViewableContent()
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.
getContributors()
Call to WikiPage function for backwards compatibility.
loadFromRow( $data, $from)
Call to WikiPage function for backwards compatibility.
static getRevDeleteLink(User $user, Revision $rev, Title $title)
Get a revision-deletion link, or disabled link, or nothing, depending on user permissions & the setti...
static onArticleEdit( $title)
protect()
action=protect handler
getTimestamp()
Call to WikiPage function for backwards compatibility.
static link( $target, $html=null, $customAttribs=[], $query=[], $options=[])
This function returns an HTML link to the given target.
wfEscapeWikiText( $text)
Escapes the given text so that it may be output using addWikiText() without any linking,...
getMinorEdit()
Call to WikiPage function for backwards compatibility.
commitRollback( $fromP, $summary, $bot, &$resultDetails, User $guser=null)
getParserOutput( $oldid=null, User $user=null)
#-
ParserOptions $mParserOptions
ParserOptions object for $wgUser articles.
getUser( $audience=Revision::FOR_PUBLIC, User $user=null)
Call to WikiPage function for backwards compatibility.
getContentObject()
Returns a Content object representing the pages effective display content, not necessarily the revisi...
followRedirect()
Call to WikiPage function for backwards compatibility.
getHiddenCategories()
Call to WikiPage function for backwards compatibility.
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
static getMain()
Static methods.
static isValid( $ip)
Validate an IP address.
setTimestamp( $ts)
Call to WikiPage function for backwards compatibility.
Interface for objects which can provide a MediaWiki context on request.
__get( $fname)
Use PHP's magic __get handler to handle accessing of raw WikiPage fields for backwards compatibility.
Base interface for content objects.
replaceSectionAtRev( $sectionId, Content $sectionContent, $sectionTitle='', $baseRevId=null)
Call to WikiPage function for backwards compatibility.
null for the wiki Added should default to null in handler for backwards compatibility add a value to it if you want to add a cookie that have to vary cache options can modify as strings Extensions should add to this list prev or next refreshes the diff cache $unhide
Represents a title within MediaWiki.
static makeUrl( $name, $urlaction='')
static closeElement( $element)
Shortcut to close an XML element.
static listDropDown( $name='', $list='', $other='', $selected='', $class='', $tabindex=null)
Build a drop-down box from a textual list.
replaceSectionContent( $sectionId, Content $sectionContent, $sectionTitle='', $edittime=null)
Call to WikiPage function for backwards compatibility.
static getMainWANInstance()
Get the main WAN cache object.
getRevIdFetched()
Use this to fetch the rev ID used on page views.
Wrapper allowing us to handle a system message as a Content object.
makeParserOptions( $context)
Call to WikiPage function for backwards compatibility.
showRedirectedFromHeader()
If this request is a redirect view, send "redirected from" subtitle to the output.
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
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
static openElement( $element, $attribs=[])
Identical to rawElement(), but has no third parameter and omits the end tag (and the self-closing '/'...
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...
Using a hook running we can avoid having all this option specific stuff in our mainline code Using the function array $article
usually copyright or history_copyright This message must be in HTML not wikitext & $link
getId()
Call to WikiPage function for backwards compatibility.
getActionOverrides()
Call to WikiPage function for backwards compatibility.
string bool $mRedirectUrl
URL to redirect to or false if none.
doUpdateRestrictions(array $limit, array $expiry, &$cascade, $reason, User $user)
updateRestrictions( $limit=[], $reason='', &$cascade=0, $expiry=[])
Revision $mRevision
Revision we are working on.
protectDescription(array $limit, array $expiry)
Call to WikiPage function for backwards compatibility.
getParserOptions()
Get parser options suitable for rendering the primary article wikitext.
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 "<
updateIfNewerOn( $dbw, $revision)
Call to WikiPage function for backwards compatibility.
Class for viewing MediaWiki article and history.
pageDataFromTitle( $dbr, $title, $options=[])
Call to WikiPage function for backwards compatibility.
static element( $element, $attribs=[], $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
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 MediaWikiServices
triggerOpportunisticLinksUpdate(ParserOutput $parserOutput)
Call to WikiPage function for backwards compatibility.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
setContext( $context)
Sets the context this Article is executed in.
static newFromID( $id, $flags=0)
Create a new Title from an article ID.
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
insertRedirectEntry(Title $rt, $oldLatest=null)
Call to WikiPage function for backwards compatibility.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist and Watchlist you will want to construct new ChangesListBooleanFilter or ChangesListStringOptionsFilter objects When constructing you specify which group they belong to You can reuse existing or create your you must register them with $special registerFilterGroup 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
getRevisionFetched()
Get the fetched Revision object depending on request parameters or null on failure.
static getCanonicalName( $index)
Returns the canonical (English) name for a given index.
viewRedirect( $target, $appendSubtitle=true, $forceKnown=false)
Return the HTML for the top of a redirect page.
loadPageData( $from='fromdb')
Call to WikiPage function for backwards compatibility.
Internationalisation code.
doEditUpdates(Revision $revision, User $user, array $options=[])
Call to WikiPage function for backwards compatibility.
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 Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist and Watchlist you will want to construct new ChangesListBooleanFilter or ChangesListStringOptionsFilter objects When constructing you specify which group they belong to You can reuse existing or create your you must register them with $special registerFilterGroup 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
string $mContent
Text of the revision we are working on.
__set( $fname, $fvalue)
Use PHP's magic __set handler to handle setting of raw WikiPage fields for backwards compatibility.
showViewFooter()
Show the footer section of an ordinary page view.
WikiPage $mPage
The WikiPage object of this instance.
the array() calling protocol came about after MediaWiki 1.4rc1.
static getRedirectHeaderHtml(Language $lang, $target, $forceKnown=false)
Return the HTML for the top of a redirect page.
doDeleteArticleReal( $reason, $suppress=false, $u1=null, $u2=null, &$error='', User $user=null, $tags=[])
Call to WikiPage function for backwards compatibility.
static submitButton( $value, $attribs=[])
Convenience function to build an HTML submit button When $wgUseMediaWikiUIEverywhere is true it will ...
static checkLabel( $label, $name, $id, $checked=false, $attribs=[])
Convenience function to build an HTML checkbox with a label.
static newFromTitle( $title, IContextSource $context)
Create an Article object of the appropriate class for the given page.
generateReason(&$hasHistory)
static purgePatrolFooterCache( $articleID)
Purge the cache used to check if it is worth showing the patrol footer For example,...
doViewUpdates(User $user, $oldid=0)
Call to WikiPage function for backwards compatibility.
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