Go to the documentation of this file.
123 $this->mOldId = $oldId;
124 $this->mPage = $this->
newPage( $title );
140 public static function newFromID( $id ) {
142 # @todo FIXME: Doesn't inherit right
143 return $t ==
null ? null :
new self(
$t );
144 # return $t == null ? null : new static( $t ); // PHP 5.3
163 switch (
$title->getNamespace() ) {
174 $page->setContext( $context );
198 $this->mRedirectedFrom =
$from;
207 return $this->mPage->getTitle();
223 public function clear() {
224 $this->mContentLoaded =
false;
226 $this->mRedirectedFrom =
null; #
Title object if set
227 $this->mRevIdFetched = 0;
228 $this->mRedirectUrl =
false;
230 $this->mPage->clear();
269 if ( $this->mPage->getID() === 0 ) {
270 # If this is a MediaWiki:x message, then load the messages
271 # and return the message value for x.
273 $text = $this->
getTitle()->getDefaultMessageText();
274 if ( $text ===
false ) {
280 $message = $this->
getContext()->getUser()->isLoggedIn() ?
'noarticletext' :
'noarticletextanon';
297 if ( is_null( $this->mOldId ) ) {
310 $this->mRedirectUrl =
false;
313 $oldid = $request->getIntOrNull(
'oldid' );
315 if ( $oldid ===
null ) {
319 if ( $oldid !== 0 ) {
320 # Load the given revision and check whether the page is another one.
321 # In that case, update this instance to reflect the change.
322 if ( $oldid === $this->mPage->getLatest() ) {
323 $this->mRevision = $this->mPage->getRevision();
326 if ( $this->mRevision !==
null ) {
328 if ( $this->mPage->getID() != $this->mRevision->getPage() ) {
329 $function =
array( get_class( $this->mPage ),
'newFromID' );
330 $this->mPage = call_user_func( $function, $this->mRevision->getPage() );
336 if ( $request->getVal(
'direction' ) ==
'next' ) {
337 $nextid = $this->
getTitle()->getNextRevisionID( $oldid );
340 $this->mRevision =
null;
342 $this->mRedirectUrl = $this->
getTitle()->getFullURL(
'redirect=no' );
344 } elseif ( $request->getVal(
'direction' ) ==
'prev' ) {
345 $previd = $this->
getTitle()->getPreviousRevisionID( $oldid );
348 $this->mRevision =
null;
382 if ( $this->mContentLoaded && $this->mContent ) {
412 if ( $this->mContentLoaded ) {
418 $this->mContentLoaded =
true;
419 $this->mContent =
null;
423 # Pre-fill content with error message so that if something
424 # fails we'll have something telling us what we intended.
429 # $this->mRevision might already be fetched by getOldIDFromRequest()
430 if ( !$this->mRevision ) {
432 if ( !$this->mRevision ) {
433 wfDebug( __METHOD__ .
" failed to retrieve specified revision, id $oldid\n" );
439 if ( !$this->mPage->getLatest() ) {
440 wfDebug( __METHOD__ .
" failed to find page data for title " .
441 $this->
getTitle()->getPrefixedText() .
"\n" );
446 $this->mRevision = $this->mPage->getRevision();
448 if ( !$this->mRevision ) {
449 wfDebug( __METHOD__ .
" failed to retrieve current page, rev_id " .
450 $this->mPage->getLatest() .
"\n" );
459 $this->mContentObject = $this->mRevision->getContent(
463 $this->mRevIdFetched = $this->mRevision->getId();
465 wfRunHooks(
'ArticleAfterFetchContentObject',
array( &$this, &$this->mContentObject ) );
478 # If no oldid, this is the current version.
483 return $this->mPage->exists() && $this->mRevision && $this->mRevision->isCurrent();
505 if ( $this->mRevIdFetched ) {
508 return $this->mPage->getLatest();
516 public function view() {
517 global $wgUseFileCache, $wgUseETag, $wgDebugToolbar;
521 # Get variables from query string
522 # As side effect this will load the revision and update the title
523 # in a revision ID is passed in the request, so this should remain
524 # the first call of this method even if $oldid is used way below.
528 # Another whitelist check in case getOldID() is altering the title
529 $permErrors = $this->
getTitle()->getUserPermissionsErrors(
'read',
$user );
530 if ( count( $permErrors ) ) {
531 wfDebug( __METHOD__ .
": denied on secondary read check\n" );
536 $outputPage = $this->
getContext()->getOutput();
537 # getOldID() may as well want us to redirect somewhere else
538 if ( $this->mRedirectUrl ) {
539 $outputPage->redirect( $this->mRedirectUrl );
540 wfDebug( __METHOD__ .
": redirecting due to oldid\n" );
546 # If we got diff in the query, we want to see a diff page instead of the article.
547 if ( $this->
getContext()->getRequest()->getCheck(
'diff' ) ) {
548 wfDebug( __METHOD__ .
": showing diff page\n" );
555 # Set page title (may be overridden by DISPLAYTITLE)
556 $outputPage->setPageTitle( $this->
getTitle()->getPrefixedText() );
558 $outputPage->setArticleFlag(
true );
559 # Allow frames by default
560 $outputPage->allowClickjacking();
565 # Render printable version, use printable version cache
566 if ( $outputPage->isPrintable() ) {
567 $parserOptions->setIsPrintable(
true );
568 $parserOptions->setEditSection(
false );
570 $parserOptions->setEditSection(
false );
573 # Try client and file cache
574 if ( !$wgDebugToolbar && $oldid === 0 && $this->mPage->checkTouched() ) {
576 $outputPage->setETag( $parserCache->getETag( $this, $parserOptions ) );
579 # Is it client cached?
580 if ( $outputPage->checkLastModified( $this->mPage->getTouched() ) ) {
581 wfDebug( __METHOD__ .
": done 304\n" );
587 wfDebug( __METHOD__ .
": done file cache\n" );
588 # tell wgOut that output is taken care of
589 $outputPage->disable();
590 $this->mPage->doViewUpdates(
$user, $oldid );
597 # Should the parser cache be used?
598 $useParserCache = $this->mPage->isParserCacheUsed( $parserOptions, $oldid );
599 wfDebug(
'Article::view using parser cache: ' . ( $useParserCache ?
'yes' :
'no' ) .
"\n" );
600 if (
$user->getStubThreshold() ) {
607 # Iterate through the possible ways of constructing the output text.
608 # Keep going until $outputDone is set, or we run out of things to do.
611 $this->mParserOutput =
false;
613 while ( !$outputDone && ++
$pass ) {
616 wfRunHooks(
'ArticleViewHeader',
array( &$this, &$outputDone, &$useParserCache ) );
619 # Early abort if the page doesn't exist
620 if ( !$this->mPage->exists() ) {
621 wfDebug( __METHOD__ .
": showing missing article\n" );
623 $this->mPage->doViewUpdates(
$user );
628 # Try the parser cache
629 if ( $useParserCache ) {
630 $this->mParserOutput = $parserCache->get( $this, $parserOptions );
632 if ( $this->mParserOutput !==
false ) {
634 wfDebug( __METHOD__ .
": showing parser cache contents for current rev permalink\n" );
637 wfDebug( __METHOD__ .
": showing parser cache contents\n" );
639 $outputPage->addParserOutput( $this->mParserOutput );
640 # Ensure that UI elements requiring revision ID have
641 # the correct version information.
642 $outputPage->setRevisionId( $this->mPage->getLatest() );
643 # Preload timestamp to avoid a DB hit
644 $cachedTimestamp = $this->mParserOutput->getTimestamp();
645 if ( $cachedTimestamp !==
null ) {
646 $outputPage->setRevisionTimestamp( $cachedTimestamp );
647 $this->mPage->setTimestamp( $cachedTimestamp );
654 # This will set $this->mRevision if needed
657 # Are we looking at an old revision
658 if ( $oldid && $this->mRevision ) {
662 wfDebug( __METHOD__ .
": cannot view deleted revision\n" );
668 # Ensure that UI elements requiring revision ID have
669 # the correct version information.
671 # Preload timestamp to avoid a DB hit
672 $outputPage->setRevisionTimestamp( $this->getTimestamp() );
674 # Pages containing custom CSS or JavaScript get special treatment
675 if ( $this->
getTitle()->isCssOrJsPage() || $this->
getTitle()->isCssJsSubpage() ) {
676 wfDebug( __METHOD__ .
": showing CSS/JS source\n" );
679 } elseif ( !
wfRunHooks(
'ArticleContentViewCustom',
682 # Allow extensions do their own custom view for certain pages
687 # Allow extensions do their own custom view for certain pages
691 $rt = $content ? $content->getRedirectChain() :
null;
693 wfDebug( __METHOD__ .
": showing redirect=no page\n" );
694 # Viewing a redirect page (e.g. with parameter redirect=no)
696 # Parse just to get categories, displaytitle, etc.
697 $this->mParserOutput = $content->getParserOutput( $this->
getTitle(), $oldid, $parserOptions,
false );
698 $outputPage->addParserOutputNoText( $this->mParserOutput );
704 # Run the parse, protected by a pool counter
705 wfDebug( __METHOD__ .
": doing uncached parse\n" );
710 if ( !$poolArticleView->execute() ) {
711 $error = $poolArticleView->getError();
713 $outputPage->clearHTML();
714 $outputPage->enableClientCache(
false );
715 $outputPage->setRobotPolicy(
'noindex,nofollow' );
717 $errortext =
$error->getWikiText(
false,
'view-pool-error' );
718 $outputPage->addWikiText(
'<div class="errorbox">' . $errortext .
'</div>' );
720 # Connection or timeout error
725 $this->mParserOutput = $poolArticleView->getParserOutput();
726 $outputPage->addParserOutput( $this->mParserOutput );
728 # Don't cache a dirty ParserOutput object
729 if ( $poolArticleView->getIsDirty() ) {
730 $outputPage->setSquidMaxage( 0 );
731 $outputPage->addHTML(
"<!-- parser cache is expired, " .
732 "sending anyway due to pool overload-->\n" );
737 # Should be unreachable, but just in case...
743 # Get the ParserOutput actually *displayed* here.
744 # Note that $this->mParserOutput is the *current* version output.
747 : $this->mParserOutput;
749 # Adjust title for main page & pages with displaytitle
754 # For the main page, overwrite the <title> element with the con-
755 # tents of 'pagetitle-view-mainpage' instead of the default (if
757 # This message always exists because it is in the i18n files
758 if ( $this->
getTitle()->isMainPage() ) {
759 $msg =
wfMessage(
'pagetitle-view-mainpage' )->inContentLanguage();
760 if ( !$msg->isDisabled() ) {
761 $outputPage->setHTMLTitle( $msg->title( $this->getTitle() )->
text() );
765 # Check for any __NOINDEX__ tags on the page using $pOutput
767 $outputPage->setIndexPolicy( $policy[
'index'] );
768 $outputPage->setFollowPolicy( $policy[
'follow'] );
771 $this->mPage->doViewUpdates(
$user, $oldid );
773 $outputPage->addModules(
'mediawiki.action.view.postEdit' );
783 # Adjust the title if it was set by displaytitle, -{T|}- or language conversion
785 if ( strval( $titleText ) !==
'' ) {
786 $this->
getContext()->getOutput()->setPageTitle( $titleText );
799 $diff = $request->getVal(
'diff' );
800 $rcid = $request->getVal(
'rcid' );
801 $diffOnly = $request->getBool(
'diffonly',
$user->getOption(
'diffonly' ) );
802 $purge = $request->getVal(
'action' ) ==
'purge';
803 $unhide = $request->getInt(
'unhide' ) == 1;
810 $this->
getContext()->getOutput()->addWikiMsg(
'difference-missing-revision', $oldid, 1 );
814 $contentHandler =
$rev->getContentHandler();
815 $de = $contentHandler->createDifferenceEngine(
825 $this->mRevIdFetched = $de->mNewid;
826 $de->showDiffPage( $diffOnly );
830 list( $old, $new ) = $de->mapDiffPrevNext( $oldid, $diff );
832 $this->mPage->doViewUpdates(
$user, (
int)$new );
846 $outputPage = $this->
getContext()->getOutput();
848 if ( $showCacheHint ) {
850 $lang = $this->
getContext()->getLanguage()->getCode();
852 $outputPage->wrapWikiMsg(
853 "<div id='mw-clearyourcache' lang='$lang' dir='$dir' class='mw-content-$dir'>\n$1\n</div>",
860 if ( $this->mContentObject ) {
864 array( $this->mContentObject, $this->
getTitle(), $outputPage ) )
866 $po = $this->mContentObject->getParserOutput( $this->
getTitle() );
867 $outputPage->addHTML( $po->getText() );
880 global $wgArticleRobotPolicies, $wgNamespaceRobotPolicies, $wgDefaultRobotPolicy;
882 $ns = $this->
getTitle()->getNamespace();
884 # Don't index user and user talk pages for blocked users (bug 11443)
886 $specificTarget =
null;
888 $titleText = $this->
getTitle()->getText();
890 $vagueTarget = $titleText;
892 $specificTarget = $titleText;
896 'index' =>
'noindex',
897 'follow' =>
'nofollow'
902 if ( $this->mPage->getID() === 0 || $this->
getOldID() ) {
903 # Non-articles (special pages etc), and old revisions
905 'index' =>
'noindex',
906 'follow' =>
'nofollow'
908 } elseif ( $this->
getContext()->getOutput()->isPrintable() ) {
909 # Discourage indexing of printable versions, but encourage following
911 'index' =>
'noindex',
914 } elseif ( $this->
getContext()->getRequest()->getInt(
'curid' ) ) {
915 # For ?curid=x urls, disallow indexing
917 'index' =>
'noindex',
922 # Otherwise, construct the policy based on the various config variables.
925 if ( isset( $wgNamespaceRobotPolicies[$ns] ) ) {
926 # Honour customised robot policies for this namespace
927 $policy = array_merge(
929 self::formatRobotPolicy( $wgNamespaceRobotPolicies[$ns] )
933 # __INDEX__ and __NOINDEX__ magic words, if allowed. Incorporates
934 # a final sanity check that we have really got the parser output.
935 $policy = array_merge(
941 if ( isset( $wgArticleRobotPolicies[$this->
getTitle()->getPrefixedText()] ) ) {
942 # (bug 14900) site config can override user-defined __INDEX__ or __NOINDEX__
943 $policy = array_merge(
945 self::formatRobotPolicy( $wgArticleRobotPolicies[$this->
getTitle()->getPrefixedText()] )
960 if ( is_array( $policy ) ) {
962 } elseif ( !$policy ) {
966 $policy = explode(
',', $policy );
967 $policy = array_map(
'trim', $policy );
970 foreach ( $policy
as $var ) {
971 if ( in_array( $var,
array(
'index',
'noindex' ) ) ) {
972 $arr[
'index'] = $var;
973 } elseif ( in_array( $var,
array(
'follow',
'nofollow' ) ) ) {
974 $arr[
'follow'] = $var;
989 global $wgRedirectSources;
990 $outputPage = $this->
getContext()->getOutput();
992 $rdfrom = $this->
getContext()->getRequest()->getVal(
'rdfrom' );
994 if ( isset( $this->mRedirectedFrom ) ) {
999 $this->mRedirectedFrom,
1002 array(
'redirect' =>
'no' )
1005 $outputPage->addSubtitle(
wfMessage(
'redirectedfrom' )->rawParams( $redir ) );
1008 if ( $this->
getTitle()->hasFragment() ) {
1009 $outputPage->addJsConfigVars(
'wgRedirectToFragment', $this->
getTitle()->getFragmentForURL() );
1010 $outputPage->addModules(
'mediawiki.action.view.redirectToFragment' );
1014 $outputPage->setCanonicalUrl( $this->
getTitle()->getLocalURL() );
1017 $outputPage->setRedirectedFrom( $this->mRedirectedFrom );
1021 } elseif ( $rdfrom ) {
1024 if ( $wgRedirectSources && preg_match( $wgRedirectSources, $rdfrom ) ) {
1026 $outputPage->addSubtitle(
wfMessage(
'redirectedfrom' )->rawParams( $redir ) );
1040 if ( $this->
getTitle()->isTalkPage() ) {
1042 $this->
getContext()->getOutput()->wrapWikiMsg(
1043 "<div class=\"mw-talkpageheader\">\n$1\n</div>",
1044 array(
'talkpageheader' )
1054 # check if we're displaying a [[User talk:x.x.x.x]] anonymous talk page
1058 $this->
getContext()->getOutput()->addWikiMsg(
'anontalkpagetext' );
1077 global $wgUseNPPatrol, $wgUseRCPatrol, $wgEnableAPI, $wgEnableWriteAPI;
1079 $outputPage = $this->
getContext()->getOutput();
1085 || !( $wgUseRCPatrol || $wgUseNPPatrol )
1105 if ( $this->mRevision
1115 $oldestRevisionTimestamp =
$dbr->selectField(
1117 'MIN( rev_timestamp )',
1122 if ( $oldestRevisionTimestamp
1129 'rc_timestamp' => $oldestRevisionTimestamp,
1130 'rc_namespace' => $this->
getTitle()->getNamespace(),
1131 'rc_cur_id' => $this->
getTitle()->getArticleID(),
1135 array(
'USE INDEX' =>
'new_name_timestamp' )
1150 if ( $rc->getPerformer()->getName() ==
$user->getName() ) {
1157 $rcid = $rc->getAttribute(
'rc_id' );
1159 $token =
$user->getEditToken( $rcid );
1161 $outputPage->preventClickjacking();
1162 if ( $wgEnableAPI && $wgEnableWriteAPI &&
$user->isAllowed(
'writeapi' ) ) {
1163 $outputPage->addModules(
'mediawiki.page.patrol.ajax' );
1168 wfMessage(
'markaspatrolledtext' )->escaped(),
1171 'action' =>
'markpatrolled',
1177 $outputPage->addHTML(
1178 "<div class='patrollink'>" .
1193 $outputPage = $this->
getContext()->getOutput();
1195 $validUserPage =
false;
1197 # Show info in user (talk) namespace. Does the user exist? Is he blocked?
1201 $parts = explode(
'/', $this->
getTitle()->getText() );
1202 $rootPart = $parts[0];
1206 if ( !(
$user &&
$user->isLoggedIn() ) && !$ip ) { #
User does not exist
1207 $outputPage->wrapWikiMsg(
"<div class=\"mw-userpage-userdoesnotexist error\">\n\$1\n</div>",
1209 } elseif (
$user->isBlocked() ) { # Show log extract
if the
user is currently blocked
1213 $user->getUserPage(),
1217 'showIfEmpty' =>
false,
1219 'blocked-notice-logextract',
1220 $user->getName() # Support GENDER
in notice
1224 $validUserPage = !$this->
getTitle()->isSubpage();
1226 $validUserPage = !$this->
getTitle()->isSubpage();
1233 $logTypes =
array(
'delete',
'move' );
1234 $conds =
array(
"log_action != 'revision'" );
1235 wfRunHooks(
'Article::MissingArticleConditions',
array( &$conds, $logTypes ) );
1237 # Show delete and move logs
1241 'showIfEmpty' =>
false,
1242 'msgKey' =>
array(
'moveddeleted-notice' ) )
1245 if ( !$this->mPage->hasViewableContent() && $wgSend404Code && !$validUserPage ) {
1248 $this->
getContext()->getRequest()->response()->header(
"HTTP/1.1 404 Not Found" );
1251 if ( $validUserPage ) {
1254 $outputPage->setIndexPolicy( $policy[
'index'] );
1255 $outputPage->setFollowPolicy( $policy[
'follow'] );
1258 $hookResult =
wfRunHooks(
'BeforeDisplayNoArticleText',
array( $this ) );
1260 if ( ! $hookResult ) {
1264 # Show error message
1267 $text =
wfMessage(
'missing-revision', $oldid )->plain();
1270 $text = $this->
getTitle()->getDefaultMessageText();
1271 } elseif ( $this->
getTitle()->quickUserCan(
'create', $this->
getContext()->getUser() )
1274 $message = $this->
getContext()->getUser()->isLoggedIn() ?
'noarticletext' :
'noarticletextanon';
1277 $text =
wfMessage(
'noarticletext-nopermission' )->plain();
1279 $text =
"<div class='noarticletext'>\n$text\n</div>";
1281 $outputPage->addWikiText( $text );
1296 $outputPage = $this->
getContext()->getOutput();
1300 $outputPage->wrapWikiMsg(
"<div class='mw-warning plainlinks'>\n$1\n</div>\n",
1301 'rev-deleted-text-permission' );
1305 } elseif ( $this->
getContext()->getRequest()->getInt(
'unhide' ) != 1 ) {
1306 # Give explanation and add a link to view the revision...
1307 $oldid = intval( $this->
getOldID() );
1308 $link = $this->
getTitle()->getFullURL(
"oldid={$oldid}&unhide=1" );
1310 'rev-suppressed-text-unhide' :
'rev-deleted-text-unhide';
1311 $outputPage->wrapWikiMsg(
"<div class='mw-warning plainlinks'>\n$1\n</div>\n",
1318 'rev-suppressed-text-view' :
'rev-deleted-text-view';
1319 $outputPage->wrapWikiMsg(
"<div class='mw-warning plainlinks'>\n$1\n</div>\n", $msg );
1334 if ( !
wfRunHooks(
'DisplayOldSubtitle',
array( &$this, &$oldid ) ) ) {
1338 $unhide = $this->
getContext()->getRequest()->getInt(
'unhide' ) == 1;
1340 # Cascade unhide param in links for easy deletion browsing
1341 $extraParams =
array();
1343 $extraParams[
'unhide'] = 1;
1346 if ( $this->mRevision && $this->mRevision->getId() === $oldid ) {
1354 $current = ( $oldid == $this->mPage->getLatest() );
1355 $language = $this->
getContext()->getLanguage();
1362 # Show user links if allowed to see them. If hidden, then show them only if requested...
1365 $infomsg = $current && !
wfMessage(
'revision-info-current' )->isDisabled()
1366 ?
'revision-info-current'
1369 $outputPage = $this->
getContext()->getOutput();
1370 $outputPage->addSubtitle(
"<div id=\"mw-{$infomsg}\">" .
wfMessage( $infomsg,
1371 $td )->rawParams( $userlinks )->params( $revision->getID(), $tddate,
1372 $tdtime, $revision->getUser() )->parse() .
"</div>" );
1375 ?
wfMessage(
'currentrevisionlink' )->escaped()
1378 wfMessage(
'currentrevisionlink' )->escaped(),
1393 $prev = $this->
getTitle()->getPreviousRevisionID( $oldid );
1397 wfMessage(
'previousrevision' )->escaped(),
1400 'direction' =>
'prev',
1404 :
wfMessage(
'previousrevision' )->escaped();
1416 $nextlink = $current
1417 ?
wfMessage(
'nextrevision' )->escaped()
1423 'direction' =>
'next',
1427 $nextdiff = $current
1440 if ( $cdel !==
'' ) {
1444 $outputPage->addSubtitle(
"<div id=\"mw-revision-nav\">" . $cdel .
1446 $prevdiff, $prevlink, $lnk, $curdiff, $nextlink, $nextdiff
1447 )->escaped() .
"</div>" );
1458 public function viewRedirect( $target, $appendSubtitle =
true, $forceKnown =
false ) {
1461 if ( !is_array( $target ) ) {
1462 $target =
array( $target );
1465 $lang = $this->
getTitle()->getPageLanguage();
1466 $imageDir = $lang->getDir();
1468 if ( $appendSubtitle ) {
1470 $out->addSubtitle(
wfMessage(
'redirectpagesub' )->parse() );
1476 $title = array_shift( $target );
1478 if ( $forceKnown ) {
1484 $nextRedirect = $wgStylePath .
'/common/images/nextredirect' . $imageDir .
'.png';
1485 $alt = $lang->isRTL() ?
'←' :
'→';
1490 foreach ( $target
as $rt ) {
1492 if ( $forceKnown ) {
1495 htmlspecialchars( $rt->getFullText(),
1497 array(
'redirect' =>
'no' )
1503 htmlspecialchars( $rt->getFullText() ),
1505 array(
'redirect' =>
'no' )
1510 $imageUrl = $wgStylePath .
'/common/images/redirect' . $imageDir .
'.png';
1511 return '<div class="redirectMsg">' .
1513 '<span class="redirectText">' .
$link .
'</span></div>';
1519 public function render() {
1520 $this->
getContext()->getOutput()->setArticleBodyOnly(
true );
1521 $this->
getContext()->getOutput()->enableSectionEditLinks(
false );
1543 public function delete() {
1544 # This code desperately needs to be totally rewritten
1550 $permission_errors =
$title->getUserPermissionsErrors(
'delete',
$user );
1551 if ( count( $permission_errors ) ) {
1555 # Read-only check...
1560 # Better double-check that it hasn't been deleted yet!
1561 $this->mPage->loadPageData(
'fromdbmaster' );
1562 if ( !$this->mPage->exists() ) {
1563 $deleteLogPage =
new LogPage(
'delete' );
1564 $outputPage = $this->
getContext()->getOutput();
1565 $outputPage->setPageTitle(
wfMessage(
'cannotdelete-title',
$title->getPrefixedText() ) );
1566 $outputPage->wrapWikiMsg(
"<div class=\"error mw-error-cannotdelete\">\n$1\n</div>",
1569 $outputPage->addHTML(
1570 Xml::element(
'h2',
null, $deleteLogPage->getName()->text() )
1581 $request = $this->
getContext()->getRequest();
1582 $deleteReasonList = $request->getText(
'wpDeleteReasonList',
'other' );
1583 $deleteReason = $request->getText(
'wpReason' );
1585 if ( $deleteReasonList ==
'other' ) {
1586 $reason = $deleteReason;
1587 } elseif ( $deleteReason !=
'' ) {
1589 $colonseparator =
wfMessage(
'colon-separator' )->inContentLanguage()->text();
1590 $reason = $deleteReasonList . $colonseparator . $deleteReason;
1592 $reason = $deleteReasonList;
1595 if ( $request->wasPosted() &&
$user->matchEditToken( $request->getVal(
'wpEditToken' ),
1598 # Flag to hide all contents of the archived revisions
1599 $suppress = $request->getVal(
'wpSuppress' ) &&
$user->isAllowed(
'suppressrevision' );
1601 $this->
doDelete( $reason, $suppress );
1609 $hasHistory =
false;
1614 # if a page is horribly broken, we still want to be able to
1615 # delete it. So be lenient about errors here.
1616 wfDebug(
"Error while building auto delete summary: $e" );
1622 if ( $hasHistory ) {
1623 $revisions = $this->mTitle->estimateRevisionCount();
1625 $this->
getContext()->getOutput()->addHTML(
'<strong class="mw-delete-warning-revisions">' .
1626 wfMessage(
'historywarning' )->numParams( $revisions )->parse() .
1629 array(
'rel' =>
'archives' ),
1630 array(
'action' =>
'history' ) ) .
1634 if ( $this->mTitle->isBigDeletion() ) {
1635 global $wgDeleteRevisionsLimit;
1636 $this->
getContext()->getOutput()->wrapWikiMsg(
"<div class='error'>\n$1\n</div>\n",
1638 'delete-warning-toobig',
1639 $this->
getContext()->getLanguage()->formatNum( $wgDeleteRevisionsLimit )
1654 wfDebug(
"Article::confirmDelete\n" );
1656 $outputPage = $this->
getContext()->getOutput();
1657 $outputPage->setPageTitle(
wfMessage(
'delete-confirm', $this->
getTitle()->getPrefixedText() ) );
1658 $outputPage->addBacklinkSubtitle( $this->
getTitle() );
1659 $outputPage->setRobotPolicy(
'noindex,nofollow' );
1660 $backlinkCache = $this->
getTitle()->getBacklinkCache();
1661 if ( $backlinkCache->hasLinks(
'pagelinks' ) || $backlinkCache->hasLinks(
'templatelinks' ) ) {
1662 $outputPage->wrapWikiMsg(
"<div class='mw-warning plainlinks'>\n$1\n</div>\n",
1663 'deleting-backlinks-warning' );
1665 $outputPage->addWikiMsg(
'confirmdeletetext' );
1667 wfRunHooks(
'ArticleConfirmDelete',
array( $this, $outputPage, &$reason ) );
1671 if (
$user->isAllowed(
'suppressrevision' ) ) {
1672 $suppress =
"<tr id=\"wpDeleteSuppressRow\">
1674 <td class='mw-input'><strong>" .
1676 'wpSuppress',
'wpSuppress',
false,
array(
'tabindex' =>
'4' ) ) .
1682 $checkWatch =
$user->getBoolOption(
'watchdeletion' ) ||
$user->isWatched( $this->
getTitle() );
1685 'action' => $this->
getTitle()->getLocalURL(
'action=delete' ),
'id' =>
'deleteconfirm' ) ) .
1689 "<tr id=\"wpDeleteReasonListRow\">
1690 <td class='mw-label'>" .
1693 <td class='mw-input'>" .
1695 'wpDeleteReasonList',
1696 wfMessage(
'deletereason-dropdown' )->inContentLanguage()->
text(),
1697 wfMessage(
'deletereasonotherlist' )->inContentLanguage()->
text(),
1704 <tr id=\"wpDeleteReasonRow\">
1705 <td class='mw-label'>" .
1708 <td class='mw-input'>" .
1711 'maxlength' =>
'255',
1719 # Disallow watching if user is not logged in
1720 if (
$user->isLoggedIn() ) {
1724 <td class='mw-input'>" .
1726 'wpWatch',
'wpWatch', $checkWatch,
array(
'tabindex' =>
'3' ) ) .
1735 <td class='mw-submit'>" .
1737 array(
'name' =>
'wpConfirmB',
'id' =>
'wpConfirmB',
'tabindex' =>
'5' ) ) .
1748 if (
$user->isAllowed(
'editinterface' ) ) {
1752 wfMessage(
'delete-edit-reasonlist' )->escaped(),
1754 array(
'action' =>
'edit' )
1756 $form .=
'<p class="mw-delete-editreasons">' .
$link .
'</p>';
1759 $outputPage->addHTML(
$form );
1762 $outputPage->addHTML(
Xml::element(
'h2',
null, $deleteLogPage->getName()->text() ) );
1773 public function doDelete( $reason, $suppress =
false ) {
1775 $outputPage = $this->
getContext()->getOutput();
1776 $status = $this->mPage->doDeleteArticleReal( $reason, $suppress, 0,
true,
$error );
1778 if ( $status->isGood() ) {
1779 $deleted = $this->
getTitle()->getPrefixedText();
1781 $outputPage->setPageTitle(
wfMessage(
'actioncomplete' ) );
1782 $outputPage->setRobotPolicy(
'noindex,nofollow' );
1784 $loglink =
'[[Special:Log/delete|' .
wfMessage(
'deletionlog' )->text() .
']]';
1786 $outputPage->addWikiMsg(
'deletedtext',
wfEscapeWikiText( $deleted ), $loglink );
1787 $outputPage->returnToMain(
false );
1789 $outputPage->setPageTitle(
1791 $this->
getTitle()->getPrefixedText() )
1795 $outputPage->addWikiText(
1796 "<div class=\"error mw-error-cannotdelete\">\n" . $status->getWikiText() .
"\n</div>"
1798 $deleteLogPage =
new LogPage(
'delete' );
1799 $outputPage->addHTML(
Xml::element(
'h2',
null, $deleteLogPage->getName()->text() ) );
1807 $outputPage->addHTML(
$error );
1822 static $called =
false;
1825 wfDebug(
"Article::tryFileCache(): called twice!?\n" );
1832 if (
$cache->isCacheGood( $this->mPage->getTouched() ) ) {
1833 wfDebug(
"Article::tryFileCache(): about to load file\n" );
1837 wfDebug(
"Article::tryFileCache(): starting buffer\n" );
1841 wfDebug(
"Article::tryFileCache(): not cacheable\n" );
1855 $cacheable = $this->mPage->getID()
1856 && !$this->mRedirectedFrom && !$this->
getTitle()->isRedirect();
1882 if (
$user ===
null ) {
1885 $parserOptions = $this->mPage->makeParserOptions(
$user );
1888 return $this->mPage->getParserOutput( $parserOptions, $oldid );
1898 if ( $this->mParserOptions ) {
1899 throw new MWException(
"can't change parser options after they have already been set" );
1903 $this->mParserOptions = clone
$options;
1911 if ( !$this->mParserOptions ) {
1912 $this->mParserOptions = $this->mPage->makeParserOptions( $this->
getContext() );
1925 $this->mContext = $context;
1938 wfDebug( __METHOD__ .
" called and \$mContext is null. " .
1939 "Return RequestContext::getMain(); for sanity\n" );
1948 public function info() {
1958 public function purge() {
1966 public function revert() {
1987 if ( property_exists( $this->mPage,
$fname ) ) {
1988 #wfWarn( "Access to raw $fname field " . __CLASS__ );
1989 return $this->mPage->$fname;
1991 trigger_error(
'Inaccessible property via __get(): ' .
$fname, E_USER_NOTICE );
2002 if ( property_exists( $this->mPage,
$fname ) ) {
2003 #wfWarn( "Access to raw $fname field of " . __CLASS__ );
2004 $this->mPage->$fname = $fvalue;
2006 } elseif ( !in_array(
$fname,
array(
'mContext',
'mPage' ) ) ) {
2007 $this->mPage->$fname = $fvalue;
2009 trigger_error(
'Inaccessible property via __set(): ' .
$fname, E_USER_NOTICE );
2022 if ( is_callable(
array( $this->mPage,
$fname ) ) ) {
2023 #wfWarn( "Call to " . __CLASS__ . "::$fname; please use WikiPage instead" );
2026 trigger_error(
'Inaccessible function via __call(): ' .
$fname, E_USER_ERROR );
2042 return $this->mPage->doUpdateRestrictions(
$limit, $expiry, $cascade, $reason,
$user );
2053 &$cascade = 0, $expiry =
array()
2055 return $this->mPage->doUpdateRestrictions(
2073 $commit =
true, &
$error =
''
2075 return $this->mPage->doDeleteArticle( $reason, $suppress, $id, $commit,
$error );
2089 return $this->mPage->doRollback( $fromP,
$summary, $token, $bot, $resultDetails,
$user );
2101 $guser = is_null( $guser ) ? $this->
getContext()->getUser() : $guser;
2102 return $this->mPage->commitRollback( $fromP,
$summary, $bot, $resultDetails, $guser );
2110 $title = $this->mPage->getTitle();
2112 return $handler->getAutoDeleteReason(
$title, $hasHistory );
Show an error when the wiki is locked/read-only and the user tries to do something that requires writ...
__call( $fname, $args)
Use PHP's magic __call handler to transform instance calls to WikiPage functions for backwards compat...
static checkLabel( $label, $name, $id, $checked=false, $attribs=array())
Convenience function to build an HTML checkbox with a label.
showMissingArticle()
Show the error text for a missing article.
static deprecated( $func, $version, $component=false)
Logs a deprecation warning, visible if $wgDevelopmentWarnings, but only if self::$enableDeprecationWa...
Set options of the Parser.
static & makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Abstract class for type hinting (accepts WikiPage, Article, ImagePage, CategoryPage)
static onArticleCreate( $title)
The onArticle*() functions are supposed to be a kind of hooks which should be called whenever any of ...
showCssOrJsPage( $showCacheHint=true)
Show a page view for a page formatted as CSS or JavaScript.
static formatRobotPolicy( $policy)
Converts a String robot policy into an associative array, to allow merging of several policies using ...
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
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.
purge()
Handle action=purge.
static tags( $element, $attribs=null, $contents)
Same as Xml::element(), but does not escape contents.
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.
We use the convention $dbr for read and $dbw for write to help you keep track of whether the database object is a the world will explode Or to be a subsequent write query which succeeded on the master may fail when replicated to the slave due to a unique key collision Replication on the slave will stop and it may take hours to repair the database and get it back online Setting read_only in my cnf on the slave will avoid this but given the dire we prefer to have as many checks as possible We provide a but the wrapper functions like please read the documentation for except in special pages derived from QueryPage It s a common pitfall for new developers to submit code containing SQL queries which examine huge numbers of rows Remember that COUNT * is(N), counting rows in atable is like counting beans in a bucket.------------------------------------------------------------------------ Replication------------------------------------------------------------------------The largest installation of MediaWiki, Wikimedia, uses a large set ofslave MySQL servers replicating writes made to a master MySQL server. Itis important to understand the issues associated with this setup if youwant to write code destined for Wikipedia.It 's often the case that the best algorithm to use for a given taskdepends on whether or not replication is in use. Due to our unabashedWikipedia-centrism, we often just use the replication-friendly version, but if you like, you can use wfGetLB() ->getServerCount() > 1 tocheck to see if replication is in use.===Lag===Lag primarily occurs when large write queries are sent to the master.Writes on the master are executed in parallel, but they are executed inserial when they are replicated to the slaves. The master writes thequery to the binlog when the transaction is committed. The slaves pollthe binlog and start executing the query as soon as it appears. They canservice reads while they are performing a write query, but will not readanything more from the binlog and thus will perform no more writes. Thismeans that if the write query runs for a long time, the slaves will lagbehind the master for the time it takes for the write query to complete.Lag can be exacerbated by high read load. MediaWiki 's load balancer willstop sending reads to a slave when it is lagged by more than 30 seconds.If the load ratios are set incorrectly, or if there is too much loadgenerally, this may lead to a slave permanently hovering around 30seconds lag.If all slaves are lagged by more than 30 seconds, MediaWiki will stopwriting to the database. All edits and other write operations will berefused, with an error returned to the user. This gives the slaves achance to catch up. Before we had this mechanism, the slaves wouldregularly lag by several minutes, making review of recent editsdifficult.In addition to this, MediaWiki attempts to ensure that the user seesevents occurring on the wiki in chronological order. A few seconds of lagcan be tolerated, as long as the user sees a consistent picture fromsubsequent requests. This is done by saving the master binlog positionin the session, and then at the start of each request, waiting for theslave to catch up to that position before doing any reads from it. Ifthis wait times out, reads are allowed anyway, but the request isconsidered to be in "lagged slave mode". Lagged slave mode can bechecked by calling wfGetLB() ->getLaggedSlaveMode(). The onlypractical consequence at present is a warning displayed in the pagefooter.===Lag avoidance===To avoid excessive lag, queries which write large numbers of rows shouldbe split up, generally to write one row at a time. Multi-row INSERT ...SELECT queries are the worst offenders should be avoided altogether.Instead do the select first and then the insert.===Working with lag===Despite our best efforts, it 's not practical to guarantee a low-lagenvironment. Lag will usually be less than one second, but mayoccasionally be up to 30 seconds. For scalability, it 's very importantto keep load on the master low, so simply sending all your queries tothe master is not the answer. So when you have a genuine need forup-to-date data, the following approach is advised:1) Do a quick query to the master for a sequence number or timestamp 2) Run the full query on the slave and check if it matches the data you gotfrom the master 3) If it doesn 't, run the full query on the masterTo avoid swamping the master every time the slaves lag, use of thisapproach should be kept to a minimum. In most cases you should just readfrom the slave and let the user deal with the delay.------------------------------------------------------------------------ Lock contention------------------------------------------------------------------------Due to the high write rate on Wikipedia(and some other wikis), MediaWiki developers need to be very careful to structure their writesto avoid long-lasting locks. By default, MediaWiki opens a transactionat the first query, and commits it before the output is sent. Locks willbe held from the time when the query is done until the commit. So youcan reduce lock time by doing as much processing as possible before youdo your write queries.Often this approach is not good enough, and it becomes necessary toenclose small groups of queries in their own transaction. Use thefollowing syntax:$dbw=wfGetDB(DB_MASTER
tryFileCache()
checkLastModified returns true if it has taken care of all output to the client that is necessary for...
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
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
usually copyright or history_copyright This message must be in HTML not wikitext $subpages will be ignored and the rest of subPageSubtitle() will run. 'SkinTemplateBuildNavUrlsNav_urlsAfterPermalink' whether MediaWiki currently thinks this is a CSS JS page Hooks may change this value to override the return value of Title::isCssOrJsPage(). 'TitleIsAlwaysKnown' whether MediaWiki currently thinks this page is known isMovable() always returns false. $title whether MediaWiki currently thinks this page is movable Hooks may change this value to override the return value of Title::isMovable(). 'TitleIsWikitextPage' whether MediaWiki currently thinks this is a wikitext page Hooks may change this value to override the return value of Title::isWikitextPage() 'TitleMove' use UploadVerification and UploadVerifyFile instead $form
static getAutosummary( $oldtext, $newtext, $flags)
Return an applicable autosummary if one exists for the given edit.
ParserOutput $mParserOutput
ParserOutput object $mParserOutput.
wfProfileIn( $functionname)
Begin profiling of a function.
static getAutosummary( $oldtext, $newtext, $flags)
Special handling for category description pages, showing pages, subcategories and file that belong to...
static onArticleEdit( $title)
Purge caches on page update etc.
Class representing a MediaWiki article and history.
static newFromConds( $conds, $fname=__METHOD__, $options=array())
Find the first recent change matching some specific conditions.
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.
updateRestrictions( $limit=array(), $reason='', &$cascade=0, $expiry=array())
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.
showDiffPage()
Show a diff page according to current request variables.
static getForTitle(Title $title)
Returns the appropriate ContentHandler singleton for the given title.
static hidden( $name, $value, $attribs=array())
Convenience function to produce an input element with type=hidden.
Class for viewing MediaWiki file description pages.
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 $mContext.
it s the revision text itself In either if gzip is the revision text is gzipped $flags
set to $title object and return false for a match for latest after cache objects are set use the ContentHandler facility to handle CSS and JavaScript for highlighting & $link
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]].
static openElement( $element, $attribs=null)
This opens an XML element.
Content $mContentObject
Content of the revision we are working on.
static linkKnown( $target, $html=null, $customAttribs=array(), $query=array(), $options=array( 'known', 'noclasses'))
Identical to link(), except $options defaults to 'known'.
static makeExternalLink( $url, $text, $escape=true, $linktype='', $attribs=array(), $title=null)
Make an external link.
info()
Info about this page.
static runLegacyHooks( $event, $args=array(), $warn=null)
Call a legacy hook that uses text instead of Content objects.
isFileCacheable()
Check if the page can be cached.
static link( $target, $html=null, $customAttribs=array(), $query=array(), $options=array())
This function returns an HTML link to the given target.
unprotect()
action=unprotect handler (alias)
fetchContentObject()
Get text content object Does NOT follow redirects.
fetchContent()
Get text of an article from database Does NOT follow redirects.
static newFromWikiPage(WikiPage $page, IContextSource $context)
Create an Article object of the appropriate class for the given page.
wfGetMainCache()
Get the main cache object.
static onArticleDelete( $title)
wfMemcKey()
Get a cache key.
getTitle()
Get the title object of the article.
revert()
Handle action=revert.
render()
Handle action=render.
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
static element( $element, $attribs=array(), $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
wfIncrStats( $key, $count=1)
Increment a statistics counter.
setRedirectedFrom(Title $from)
Tell the page view functions that this view was redirected from another page on the wiki.
static useFileCache(IContextSource $context)
Check if pages can be cached for this request/user.
static selectFields()
Return the list of revision fields that should be selected to create a new page.
static revUserTools( $rev, $isPublic=false)
Generate a user tool link cluster if the current user is allowed to view it.
__construct(Title $title, $oldId=null)
Constructor and clear the article.
showDeletedRevisionHeader()
If the revision requested for view is deleted, check permissions.
static onArticleDelete( $title)
Clears caches when article is deleted.
doRollback( $fromP, $summary, $token, $bot, &$resultDetails, User $user=null)
getTitle()
Get the title object of the article.
wfProfileOut( $functionname='missing')
Stop profiling of a function.
Class to simplify the use of log pages.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses after processing after in associative array form externallinks including delete and has completed for all link tables 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 "<
setOldSubtitle( $oldid=0)
Generate the navigation links when browsing through an article revisions It shows the information as:...
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.
wfRunHooks( $event, array $args=array(), $deprecatedVersion=null)
Call hook functions defined in $wgHooks.
static isIP( $name)
Does the string match an anonymous IPv4 address?
static doWatchOrUnwatch( $watch, Title $title, User $user)
Watch or unwatch a page.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
when a variable name is used in a it is silently declared as a new masking the global
static newFromID( $id)
Constructor from a page id.
int $mRevIdFetched
Revision ID of revision we are working on $mRevIdFetched.
static input( $name, $value='', $type='text', $attribs=array())
Convenience function to produce an "<input>" element.
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.
bool $mContentLoaded
Is the content ($mContent) already loaded? $mContentLoaded.
setParserOptions(ParserOptions $options)
Override the ParserOptions used to render the primary article wikitext.
Title $mRedirectedFrom
Title from which we were redirected here $mRedirectedFrom.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped & $options
loadContent()
Load the revision (including text) into this object.
doDelete( $reason, $suppress=false)
Perform a deletion and output success or failure messages.
wfDebug( $text, $dest='all')
Sends a line to the debug log if enabled or, optionally, to a comment in output.
presenting them properly to the user as errors is done by the caller $title
getContent()
Note that getContent/loadContent do not follow redirects anymore.
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 and we might be restricted by PHP settings such as safe mode or open_basedir We cannot assume that the software even has read access anywhere useful Many shared hosts run all users web applications under the same user
static singleton()
Get an instance of this object.
int null $mOldId
The oldid of the article that is to be shown, 0 for the current revision $mOldId.
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
static newFromTitle( $title, $action)
Construct an ObjectFileCache from a Title and an action.
wfEscapeWikiText( $text)
Escapes the given text so that it may be output using addWikiText() without any linking,...
commitRollback( $fromP, $summary, $bot, &$resultDetails, User $guser=null)
rollback()
Handle action=rollback.
getParserOutput( $oldid=null, User $user=null)
#-
ParserOptions $mParserOptions
ParserOptions object for $wgUser articles $mParserOptions.
getContentObject()
Returns a Content object representing the pages effective display content, not necessarily the revisi...
static getMain()
Static methods.
static isValid( $ip)
Validate an IP address.
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
string false $mRedirectUrl
URL to redirect to or false if none $mRedirectUrl.
Interface for objects which can provide a 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.
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
doDeleteArticle( $reason, $suppress=false, $id=0, $commit=true, &$error='')
Represents a title within MediaWiki.
static getContentText(Content $content=null)
Convenience function for getting flat text from a Content object.
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.
if(count( $args)==0) $dir
getRevIdFetched()
Use this to fetch the rev ID used on page views.
Wrapper allowing us to handle a system message as a Content object.
Prior to maintenance scripts were a hodgepodge of code that had no cohesion or formal method of action Beginning in
showRedirectedFromHeader()
If this request is a redirect view, send "redirected from" subtitle to the output.
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 isInRCLifespan( $timestamp, $tolerance=0)
Check whether the given timestamp is new enough to have a RC row with a given tolerance as the recent...
doUpdateRestrictions(array $limit, array $expiry, &$cascade, $reason, User $user)
static submitButton( $value, $attribs=array())
Convenience function to build an HTML submit button.
Revision $mRevision
Revision we are working on $mRevision.
getParserOptions()
Get parser options suitable for rendering the primary article wikitext.
Class for viewing MediaWiki article and history.
usually copyright or history_copyright This message must be in HTML not wikitext $subpages will be ignored and the rest of subPageSubtitle() will run. 'SkinTemplateBuildNavUrlsNav_urlsAfterPermalink' whether MediaWiki currently thinks this is a CSS JS page Hooks may change this value to override the return value of Title::isCssOrJsPage(). 'TitleIsAlwaysKnown' whether MediaWiki currently thinks this page is known isMovable() always returns false. $title whether MediaWiki currently thinks this page is movable Hooks may change this value to override the return value of Title::isMovable(). 'TitleIsWikitextPage' whether MediaWiki currently thinks this is a wikitext page Hooks may change this value to override the return value of Title::isWikitextPage() 'TitleMove' use UploadVerification and UploadVerifyFile instead where the first element is the message key and the remaining elements are used as parameters to the message based on mime etc Preferred in most cases over UploadVerification object with all info about the upload string as detected by MediaWiki Handlers will typically only apply for specific mime types object & $error
static label( $label, $id, $attribs=array())
Convenience function to build an HTML form label.
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.
Using a hook running we can avoid having all this option specific stuff in our mainline code Using the function array $article
getRevisionFetched()
Get the fetched Revision object depending on request parameters or null on failure.
viewRedirect( $target, $appendSubtitle=true, $forceKnown=false)
View redirect.
static factory( $action, Page $page, IContextSource $context=null)
Get an appropriate Action subclass for the given action.
string $mContent
Text of the revision we are working on $mContent.
__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 $mPage.
static showLogExtract(&$out, $types=array(), $page='', $user='', $param=array())
Show log extract.
static newFromTitle( $title, IContextSource $context)
Create an Article object of the appropriate class for the given page.
generateReason(&$hasHistory)