MediaWiki  master
Article Class Reference

Class for viewing MediaWiki article and history. More...

Inheritance diagram for Article:
Collaboration diagram for Article:

Public Member Functions

 __construct (Title $title, $oldId=null)
 Constructor and clear the article. More...
 
 __get ( $fname)
 Use PHP's magic __get handler to handle accessing of raw WikiPage fields for backwards compatibility. More...
 
 __set ( $fname, $fvalue)
 Use PHP's magic __set handler to handle setting of raw WikiPage fields for backwards compatibility. More...
 
 addHelpLink ( $to, $overrideBaseUrl=false)
 Adds help link with an icon via page indicators. More...
 
 adjustDisplayTitle (ParserOutput $pOutput)
 Adjust title for pages with displaytitle, -{T|}- or language conversion. More...
 
 checkFlags ( $flags)
 Call to WikiPage function for backwards compatibility. More...
 
 checkTouched ()
 Call to WikiPage function for backwards compatibility. More...
 
 clear ()
 Clear the object. More...
 
 clearPreparedEdit ()
 Call to WikiPage function for backwards compatibility. More...
 
 commitRollback ( $fromP, $summary, $bot, &$resultDetails, User $guser=null)
 
 confirmDelete ( $reason)
 Output deletion confirmation dialog. More...
 
 delete ()
 UI entry point for page deletion. More...
 
 doDelete ( $reason, $suppress=false, $immediate=false)
 Perform a deletion and output success or failure messages. More...
 
 doDeleteArticle ( $reason, $suppress=false, $u1=null, $u2=null, &$error='', $immediate=false)
 
 doDeleteArticleReal ( $reason, $suppress=false, $u1=null, $u2=null, &$error='', User $user=null, $tags=[], $immediate=false)
 Call to WikiPage function for backwards compatibility. More...
 
 doDeleteUpdates ( $id, Content $content=null, $revision=null, User $user=null)
 Call to WikiPage function for backwards compatibility. More...
 
 doEditContent (Content $content, $summary, $flags=0, $originalRevId=false, User $user=null, $serialFormat=null)
 Call to WikiPage function for backwards compatibility. More...
 
 doEditUpdates (Revision $revision, User $user, array $options=[])
 Call to WikiPage function for backwards compatibility. More...
 
 doPurge ()
 Call to WikiPage function for backwards compatibility. More...
 
 doRollback ( $fromP, $summary, $token, $bot, &$resultDetails, User $user=null)
 
 doUpdateRestrictions (array $limit, array $expiry, &$cascade, $reason, User $user)
 
 doViewUpdates (User $user, $oldid=0)
 Call to WikiPage function for backwards compatibility. More...
 
 exists ()
 Call to WikiPage function for backwards compatibility. More...
 
 followRedirect ()
 Call to WikiPage function for backwards compatibility. More...
 
 generateReason (&$hasHistory)
 
 getActionOverrides ()
 Call to WikiPage function for backwards compatibility. More...
 
 getAutoDeleteReason (&$hasHistory)
 Call to WikiPage function for backwards compatibility. More...
 
 getCategories ()
 Call to WikiPage function for backwards compatibility. More...
 
 getComment ( $audience=RevisionRecord::FOR_PUBLIC, User $user=null)
 Call to WikiPage function for backwards compatibility. More...
 
 getContentHandler ()
 Call to WikiPage function for backwards compatibility. More...
 
 getContentModel ()
 Call to WikiPage function for backwards compatibility. More...
 
 getContext ()
 Gets the context this Article is executed in. More...
 
 getContributors ()
 Call to WikiPage function for backwards compatibility. More...
 
 getCreator ( $audience=RevisionRecord::FOR_PUBLIC, User $user=null)
 Call to WikiPage function for backwards compatibility. More...
 
 getDeletionUpdates (Content $content=null)
 Call to WikiPage function for backwards compatibility. More...
 
 getHiddenCategories ()
 Call to WikiPage function for backwards compatibility. More...
 
 getId ()
 Call to WikiPage function for backwards compatibility. More...
 
 getLatest ()
 Call to WikiPage function for backwards compatibility. More...
 
 getLinksTimestamp ()
 Call to WikiPage function for backwards compatibility. More...
 
 getMinorEdit ()
 Call to WikiPage function for backwards compatibility. More...
 
 getOldestRevision ()
 Call to WikiPage function for backwards compatibility. More...
 
 getOldID ()
 
 getOldIDFromRequest ()
 Sets $this->mRedirectUrl to a correct URL if the query parameters are incorrect. More...
 
 getPage ()
 Get the WikiPage object of this instance. More...
 
 getParserOptions ()
 Get parser options suitable for rendering the primary article wikitext. More...
 
 getParserOutput ( $oldid=null, User $user=null)
 #- More...
 
 getRedirectedFrom ()
 Get the page this view was redirected from. More...
 
 getRedirectTarget ()
 Call to WikiPage function for backwards compatibility. More...
 
 getRedirectURL ( $rt)
 Call to WikiPage function for backwards compatibility. More...
 
 getRevIdFetched ()
 Use this to fetch the rev ID used on page views. More...
 
 getRevision ()
 Call to WikiPage function for backwards compatibility. More...
 
 getRevisionFetched ()
 Get the fetched Revision object depending on request parameters or null on failure. More...
 
 getRobotPolicy ( $action, ParserOutput $pOutput=null)
 Get the robot policy to be used for the current view. More...
 
 getTimestamp ()
 Call to WikiPage function for backwards compatibility. More...
 
 getTitle ()
 Get the title object of the article. More...
 
 getTouched ()
 Call to WikiPage function for backwards compatibility. More...
 
 getUndoContent (Revision $undo, Revision $undoafter=null)
 Call to WikiPage function for backwards compatibility. More...
 
 getUser ( $audience=RevisionRecord::FOR_PUBLIC, User $user=null)
 Call to WikiPage function for backwards compatibility. More...
 
 getUserText ( $audience=RevisionRecord::FOR_PUBLIC, User $user=null)
 Call to WikiPage function for backwards compatibility. More...
 
 hasViewableContent ()
 Call to WikiPage function for backwards compatibility. More...
 
 insertOn ( $dbw, $pageId=null)
 Call to WikiPage function for backwards compatibility. More...
 
 insertProtectNullRevision ( $revCommentMsg, array $limit, array $expiry, $cascade, $reason, $user=null)
 Call to WikiPage function for backwards compatibility. More...
 
 insertRedirect ()
 Call to WikiPage function for backwards compatibility. More...
 
 insertRedirectEntry (Title $rt, $oldLatest=null)
 Call to WikiPage function for backwards compatibility. More...
 
 isCountable ( $editInfo=false)
 Call to WikiPage function for backwards compatibility. More...
 
 isCurrent ()
 Returns true if the currently-referenced revision is the current edit to this page (and it exists). More...
 
 isFileCacheable ( $mode=HTMLFileCache::MODE_NORMAL)
 Check if the page can be cached. More...
 
 isRedirect ()
 Call to WikiPage function for backwards compatibility. More...
 
 loadFromRow ( $data, $from)
 Call to WikiPage function for backwards compatibility. More...
 
 loadPageData ( $from='fromdb')
 Call to WikiPage function for backwards compatibility. More...
 
 lockAndGetLatest ()
 Call to WikiPage function for backwards compatibility. More...
 
 makeParserOptions ( $context)
 Call to WikiPage function for backwards compatibility. More...
 
 pageDataFromId ( $dbr, $id, $options=[])
 Call to WikiPage function for backwards compatibility. More...
 
 pageDataFromTitle ( $dbr, $title, $options=[])
 Call to WikiPage function for backwards compatibility. More...
 
 prepareContentForEdit (Content $content, $revision=null, User $user=null, $serialFormat=null, $useCache=true)
 Call to WikiPage function for backwards compatibility. More...
 
 protect ()
 action=protect handler More...
 
 protectDescription (array $limit, array $expiry)
 Call to WikiPage function for backwards compatibility. More...
 
 protectDescriptionLog (array $limit, array $expiry)
 Call to WikiPage function for backwards compatibility. More...
 
 render ()
 Handle action=render. More...
 
 replaceSectionAtRev ( $sectionId, Content $sectionContent, $sectionTitle='', $baseRevId=null)
 Call to WikiPage function for backwards compatibility. More...
 
 replaceSectionContent ( $sectionId, Content $sectionContent, $sectionTitle='', $edittime=null)
 Call to WikiPage function for backwards compatibility. More...
 
 setContext ( $context)
 Sets the context this Article is executed in. More...
 
 setOldSubtitle ( $oldid=0)
 Generate the navigation links when browsing through an article revisions It shows the information as: Revision as of \<date\>; view current revision \<- Previous version | Next Version -\> More...
 
 setParserOptions (ParserOptions $options)
 Override the ParserOptions used to render the primary article wikitext. More...
 
 setRedirectedFrom (Title $from)
 Tell the page view functions that this view was redirected from another page on the wiki. More...
 
 setTimestamp ( $ts)
 Call to WikiPage function for backwards compatibility. More...
 
 shouldCheckParserCache (ParserOptions $parserOptions, $oldId)
 Call to WikiPage function for backwards compatibility. More...
 
 showDeletedRevisionHeader ()
 If the revision requested for view is deleted, check permissions. More...
 
 showMissingArticle ()
 Show the error text for a missing article. More...
 
 showNamespaceHeader ()
 Show a header specific to the namespace currently being viewed, like [[MediaWiki:Talkpagetext]]. More...
 
 showPatrolFooter ()
 If patrol is possible, output a patrol UI box. More...
 
 showRedirectedFromHeader ()
 If this request is a redirect view, send "redirected from" subtitle to the output. More...
 
 showViewFooter ()
 Show the footer section of an ordinary page view. More...
 
 supportsSections ()
 Call to WikiPage function for backwards compatibility. More...
 
 triggerOpportunisticLinksUpdate (ParserOutput $parserOutput)
 Call to WikiPage function for backwards compatibility. More...
 
 unprotect ()
 action=unprotect handler (alias) More...
 
 updateCategoryCounts (array $added, array $deleted, $id=0)
 Call to WikiPage function for backwards compatibility. More...
 
 updateIfNewerOn ( $dbw, $revision)
 Call to WikiPage function for backwards compatibility. More...
 
 updateRedirectOn ( $dbw, $redirectTitle, $lastRevIsRedirect=null)
 Call to WikiPage function for backwards compatibility. More...
 
 updateRestrictions ( $limit=[], $reason='', &$cascade=0, $expiry=[])
 
 updateRevisionOn ( $dbw, $revision, $lastRevision=null, $lastRevIsRedirect=null)
 Call to WikiPage function for backwards compatibility. More...
 
 view ()
 This is the default action of the index.php entry point: just view the page of the given title. More...
 
 viewRedirect ( $target, $appendSubtitle=true, $forceKnown=false)
 Return the HTML for the top of a redirect page. More...
 

Static Public Member Functions

static formatRobotPolicy ( $policy)
 Converts a String robot policy into an associative array, to allow merging of several policies using array_merge(). More...
 
static getRedirectHeaderHtml (Language $lang, $target, $forceKnown=false)
 Return the HTML for the top of a redirect page. More...
 
static newFromID ( $id)
 Constructor from a page id. More...
 
static newFromTitle ( $title, IContextSource $context)
 Create an Article object of the appropriate class for the given page. More...
 
static newFromWikiPage (WikiPage $page, IContextSource $context)
 Create an Article object of the appropriate class for the given page. More...
 
static purgePatrolFooterCache ( $articleID)
 Purge the cache used to check if it is worth showing the patrol footer For example, it is done during re-uploads when file patrol is used. More...
 

Public Attributes

bool $mContentLoaded = false
 Is the target revision loaded? Set by fetchRevisionRecord(). More...
 
Content null $mContentObject
 Content of the main slot of $this->mRevision. More...
 
int null $mOldId
 The oldid of the article that was requested to be shown, 0 for the current revision. More...
 
ParserOptions null $mParserOptions
 ParserOptions object for $wgUser articles. More...
 
ParserOutput null false $mParserOutput = null
 The ParserOutput generated for viewing the page, initialized by view(). More...
 
Title null $mRedirectedFrom = null
 Title from which we were redirected here, if any. More...
 
string bool $mRedirectUrl = false
 URL to redirect to or false if none. More...
 
int $mRevIdFetched = 0
 Revision ID of revision that was loaded. More...
 
Revision null $mRevision = null
 Revision to be shown. More...
 

Protected Member Functions

 fetchContentObject ()
 Get text content object Does NOT follow redirects. More...
 
 fetchRevisionRecord ()
 Fetches the revision to work on. More...
 
 getContentObject ()
 Returns a Content object representing the pages effective display content, not necessarily the revision's content! More...
 
 getEmptyPageParserOutput (ParserOptions $options)
 Returns ParserOutput to use when a page does not exist. More...
 
 newPage (Title $title)
 
 showDiffPage ()
 Show a diff page according to current request variables. More...
 
 tryFileCache ()
 checkLastModified returns true if it has taken care of all output to the client that is necessary for this request. More...
 

Protected Attributes

IContextSource null $mContext
 The context this Article is executed in. More...
 
WikiPage null $mPage
 The WikiPage object of this instance. More...
 
bool $viewIsRenderAction = false
 Whether render() was called. More...
 

Private Member Functions

 applyContentOverride (Content $override)
 Applies a content override by constructing a fake Revision object and assigning it to mRevision. More...
 
 getRevisionRedirectTarget (RevisionRecord $revision)
 
 getSubstituteContent ()
 Returns Content object to use when the page does not exist. More...
 
 makeFetchErrorContent ()
 Returns a Content object representing any error in $this->fetchContent, or null if there is no such error. More...
 

Private Attributes

Status null $fetchResult = null
 represents the outcome of fetchRevisionRecord(). More...
 

Detailed Description

Class for viewing MediaWiki article and history.

This maintains WikiPage functions for backwards compatibility.

Todo:
Move and rewrite code to an Action class

Note: edit user interface and cache support functions have been moved to separate EditPage and HTMLFileCache classes.

Definition at line 38 of file Article.php.

Constructor & Destructor Documentation

◆ __construct()

Article::__construct ( Title  $title,
  $oldId = null 
)

Constructor and clear the article.

Parameters
Title$titleReference to a Title object.
int | null$oldIdRevision ID, null to fetch from request, zero for current

Definition at line 130 of file Article.php.

References newPage().

Member Function Documentation

◆ __get()

Article::__get (   $fname)

Use PHP's magic __get handler to handle accessing of raw WikiPage fields for backwards compatibility.

Parameters
string$fnameField name
Returns
mixed

Definition at line 2256 of file Article.php.

References $fname.

◆ __set()

Article::__set (   $fname,
  $fvalue 
)

Use PHP's magic __set handler to handle setting of raw WikiPage fields for backwards compatibility.

Parameters
string$fnameField name
mixed$fvalueNew value

Definition at line 2271 of file Article.php.

References $fname.

◆ addHelpLink()

Article::addHelpLink (   $to,
  $overrideBaseUrl = false 
)

Adds help link with an icon via page indicators.

Link target can be overridden by a local message containing a wikilink: the message key is: 'namespace-' + namespace number + '-helppage'.

Parameters
string$toTarget MediaWiki.org page title or encoded URL.
bool$overrideBaseUrlWhether $url is a full URL, to avoid MW.o.
Since
1.25

Definition at line 1725 of file Article.php.

References $out, getContext(), getTitle(), Skin\makeUrl(), and wfMessage().

Referenced by CategoryPage\closeShowCategory().

◆ adjustDisplayTitle()

Article::adjustDisplayTitle ( ParserOutput  $pOutput)

Adjust title for pages with displaytitle, -{T|}- or language conversion.

Parameters
ParserOutput$pOutput

Definition at line 885 of file Article.php.

References $out, getContext(), and ParserOutput\getTitleText().

Referenced by view().

◆ applyContentOverride()

Article::applyContentOverride ( Content  $override)
private

Applies a content override by constructing a fake Revision object and assigning it to mRevision.

The fake revision will not have a user, timestamp or summary set.

This mechanism exists mainly to accommodate extensions that use the ArticleAfterFetchContentObject. Once that hook has been removed, there should no longer be a need for a fake revision object. fetchRevisionRecord() presently also uses this mechanism to report errors, but that could be changed to use $this->fetchResult instead.

Parameters
Content$overrideContent to be used instead of the actual page content, coming from an extension or representing an error message.

Definition at line 527 of file Article.php.

References $rev, and getTitle().

Referenced by fetchRevisionRecord().

◆ checkFlags()

Article::checkFlags (   $flags)

Call to WikiPage function for backwards compatibility.

See also
WikiPage::checkFlags

Definition at line 2287 of file Article.php.

◆ checkTouched()

Article::checkTouched ( )

Call to WikiPage function for backwards compatibility.

See also
WikiPage::checkTouched

Definition at line 2295 of file Article.php.

◆ clear()

Article::clear ( )

Clear the object.

Definition at line 238 of file Article.php.

References null.

◆ clearPreparedEdit()

Article::clearPreparedEdit ( )

Call to WikiPage function for backwards compatibility.

See also
WikiPage::clearPreparedEdit

Definition at line 2303 of file Article.php.

◆ commitRollback()

Article::commitRollback (   $fromP,
  $summary,
  $bot,
$resultDetails,
User  $guser = null 
)
Parameters
string$fromP
string$summary
bool$bot
array&$resultDetails
User | null$guser
Returns
array

Definition at line 2879 of file Article.php.

References getContext().

◆ confirmDelete()

Article::confirmDelete (   $reason)

Output deletion confirmation dialog.

Todo:
Move to another file?
Parameters
string$reasonPrefilled reason

Definition at line 1896 of file Article.php.

References $link, $options, $title, $user, CommentStore\COMMENT_CHARACTER_LIMIT, Xml\element(), getContext(), getTitle(), Html\hidden(), Linker\linkKnown(), Xml\listDropDownOptions(), Xml\listDropDownOptionsOoui(), null, Message\numParam(), Hooks\run(), LogEventsList\showLogExtract(), wfDebug(), and wfMessage().

Referenced by delete().

◆ delete()

◆ doDelete()

Article::doDelete (   $reason,
  $suppress = false,
  $immediate = false 
)

Perform a deletion and output success or failure messages.

Parameters
string$reason
bool$suppress
bool$immediatefalse allows deleting over time via the job queue
Exceptions
FatalError
MWException

Definition at line 2066 of file Article.php.

References $context, $user, Xml\element(), getContext(), getTitle(), null, Hooks\run(), LogEventsList\showLogExtract(), wfEscapeWikiText(), and wfMessage().

Referenced by delete().

◆ doDeleteArticle()

Article::doDeleteArticle (   $reason,
  $suppress = false,
  $u1 = null,
  $u2 = null,
$error = '',
  $immediate = false 
)
Parameters
string$reason
bool$suppress
int | null$u1Unused
bool | null$u2Unused
string&$error
bool$immediatefalse allows deleting over time via the job queue
Returns
bool
Exceptions
FatalError
MWException

Definition at line 2847 of file Article.php.

References null.

◆ doDeleteArticleReal()

Article::doDeleteArticleReal (   $reason,
  $suppress = false,
  $u1 = null,
  $u2 = null,
$error = '',
User  $user = null,
  $tags = [],
  $immediate = false 
)

Call to WikiPage function for backwards compatibility.

See also
WikiPage::doDeleteArticleReal

Definition at line 2311 of file Article.php.

References $user.

◆ doDeleteUpdates()

Article::doDeleteUpdates (   $id,
Content  $content = null,
  $revision = null,
User  $user = null 
)

Call to WikiPage function for backwards compatibility.

See also
WikiPage::doDeleteUpdates

Definition at line 2324 of file Article.php.

References $content, and $user.

◆ doEditContent()

Article::doEditContent ( Content  $content,
  $summary,
  $flags = 0,
  $originalRevId = false,
User  $user = null,
  $serialFormat = null 
)

Call to WikiPage function for backwards compatibility.

Deprecated:
since 1.29. Use WikiPage::doEditContent() directly instead
See also
WikiPage::doEditContent

Definition at line 2338 of file Article.php.

References $user, and wfDeprecated().

◆ doEditUpdates()

Article::doEditUpdates ( Revision  $revision,
User  $user,
array  $options = [] 
)

Call to WikiPage function for backwards compatibility.

See also
WikiPage::doEditUpdates

Definition at line 2351 of file Article.php.

References $options.

◆ doPurge()

Article::doPurge ( )

Call to WikiPage function for backwards compatibility.

See also
WikiPage::doPurge
Note
In 1.28 (and only 1.28), this took a $flags parameter that controlled how much purging was done.

Definition at line 2361 of file Article.php.

◆ doRollback()

Article::doRollback (   $fromP,
  $summary,
  $token,
  $bot,
$resultDetails,
User  $user = null 
)
Parameters
string$fromP
string$summary
string$token
bool$bot
array&$resultDetails
User | null$user
Returns
array

Definition at line 2863 of file Article.php.

References $user, and getContext().

◆ doUpdateRestrictions()

Article::doUpdateRestrictions ( array  $limit,
array  $expiry,
$cascade,
  $reason,
User  $user 
)
Parameters
array$limit
array$expiry
bool&$cascade
string$reason
User$user
Returns
Status

Definition at line 2811 of file Article.php.

◆ doViewUpdates()

Article::doViewUpdates ( User  $user,
  $oldid = 0 
)

Call to WikiPage function for backwards compatibility.

See also
WikiPage::doViewUpdates

Definition at line 2369 of file Article.php.

◆ exists()

Article::exists ( )

Call to WikiPage function for backwards compatibility.

See also
WikiPage::exists

Definition at line 2377 of file Article.php.

◆ fetchContentObject()

Article::fetchContentObject ( )
protected

Get text content object Does NOT follow redirects.

Todo:
When is this null?
Deprecated:
since 1.32, use fetchRevisionRecord() instead.
Note
Code that wants to retrieve page content from the database should use WikiPage::getContent().
Returns
Content|null|bool
Since
1.21

Definition at line 400 of file Article.php.

References $mContentObject, and fetchRevisionRecord().

Referenced by getContentObject(), and view().

◆ fetchRevisionRecord()

Article::fetchRevisionRecord ( )
protected

Fetches the revision to work on.

The revision is typically loaded from the database, but may also be a fake representing an error message or content supplied by an extension. Refer to $this->fetchResult for the revision actually loaded from the database, and any errors encountered while doing that.

Returns
RevisionRecord|null

Definition at line 417 of file Article.php.

References applyContentOverride(), getContext(), getOldID(), getTitle(), getUser(), Hooks\isRegistered(), makeFetchErrorContent(), StatusValue\newFatal(), Revision\newFromId(), StatusValue\newGood(), null, Hooks\run(), and wfDebug().

Referenced by fetchContentObject(), getRevisionFetched(), and view().

◆ followRedirect()

Article::followRedirect ( )

Call to WikiPage function for backwards compatibility.

See also
WikiPage::followRedirect

Definition at line 2385 of file Article.php.

◆ formatRobotPolicy()

static Article::formatRobotPolicy (   $policy)
static

Converts a String robot policy into an associative array, to allow merging of several policies using array_merge().

Parameters
array | string$policyReturns empty array on null/false/'', transparent to already-converted arrays, converts string.
Returns
array 'index' => \<indexpolicy\>, 'follow' => \<followpolicy\>

Definition at line 1030 of file Article.php.

References as.

Referenced by OutputPage\setRobotPolicy().

◆ generateReason()

Article::generateReason ( $hasHistory)
Parameters
bool&$hasHistory
Returns
mixed

Definition at line 2891 of file Article.php.

References $handler, $title, and ContentHandler\getForTitle().

Referenced by delete().

◆ getActionOverrides()

Article::getActionOverrides ( )

Call to WikiPage function for backwards compatibility.

See also
ContentHandler::getActionOverrides

Definition at line 2393 of file Article.php.

◆ getAutoDeleteReason()

Article::getAutoDeleteReason ( $hasHistory)

Call to WikiPage function for backwards compatibility.

See also
WikiPage::getAutoDeleteReason

Definition at line 2401 of file Article.php.

◆ getCategories()

Article::getCategories ( )

Call to WikiPage function for backwards compatibility.

See also
WikiPage::getCategories

Definition at line 2409 of file Article.php.

◆ getComment()

Article::getComment (   $audience = RevisionRecord::FOR_PUBLIC,
User  $user = null 
)

Call to WikiPage function for backwards compatibility.

See also
WikiPage::getComment

Definition at line 2417 of file Article.php.

References $user.

◆ getContentHandler()

Article::getContentHandler ( )

Call to WikiPage function for backwards compatibility.

See also
WikiPage::getContentHandler

Definition at line 2425 of file Article.php.

◆ getContentModel()

Article::getContentModel ( )

Call to WikiPage function for backwards compatibility.

See also
WikiPage::getContentModel

Definition at line 2433 of file Article.php.

◆ getContentObject()

Article::getContentObject ( )
protected

Returns a Content object representing the pages effective display content, not necessarily the revision's content!

Note that getContent does not follow redirects anymore. If you need to fetch redirectable content easily, try the shortcut in WikiPage::getRedirectTarget()

This function has side effects! Do not use this function if you only want the real revision text if any.

Deprecated:
since 1.32, use getRevisionFetched() or fetchRevisionRecord() instead.
Returns
Content
Since
1.21

Definition at line 270 of file Article.php.

References $content, $mContentObject, fetchContentObject(), and getSubstituteContent().

◆ getContext()

Article::getContext ( )

Gets the context this Article is executed in.

Returns
IContextSource
Since
1.18

Definition at line 2239 of file Article.php.

References $mContext, RequestContext\getMain(), and wfDebug().

Referenced by ImageHistoryList\__construct(), ProtectionForm\__construct(), EditPage\__construct(), addHelpLink(), adjustDisplayTitle(), CategoryPage\closeShowCategory(), commitRollback(), confirmDelete(), ImagePage\createXmlOptionStringForLanguage(), delete(), doDelete(), ImagePage\doRenderLangOpt(), doRollback(), fetchRevisionRecord(), getOldIDFromRequest(), getParserOptions(), getRobotPolicy(), getSubstituteContent(), ImagePage\getThumbPrevText(), ImagePage\getThumbSizes(), ImagePage\imageDupes(), ImagePage\imageHistory(), ImagePage\imageLinks(), isFileCacheable(), ImagePage\makeMetadataTable(), ImagePage\makeSizeLink(), ImagePage\openShowImage(), ImagePage\printSharedImageText(), render(), setOldSubtitle(), showDeletedRevisionHeader(), showDiffPage(), ImagePage\showError(), showMissingArticle(), showNamespaceHeader(), showPatrolFooter(), showRedirectedFromHeader(), ImagePage\showTOC(), showViewFooter(), ArticleViewTest\testArticleAfterFetchContentObjectHook(), ArticleViewTest\testArticleContentViewCustomHook(), ArticleViewTest\testArticleRevisionViewCustomHook(), ArticleViewTest\testArticleViewHeaderHook(), ArticleViewTest\testShowMissingArticleHook(), ArticleViewTest\testView(), ArticleViewTest\testViewCached(), ArticleViewTest\testViewDeletedPage(), ArticleViewTest\testViewMessagePage(), ArticleViewTest\testViewMissingPage(), ArticleViewTest\testViewMissingUserPage(), ArticleViewTest\testViewOfCurrentRevision(), ArticleViewTest\testViewOfDeletedRevision(), ArticleViewTest\testViewOfMissingRevision(), ArticleViewTest\testViewOfOldRevision(), ArticleViewTest\testViewRedirect(), ArticleViewTest\testViewUserPageOfNonexistingUser(), tryFileCache(), updateRestrictions(), ImagePage\uploadLinksBox(), CategoryPage\view(), ImagePage\view(), view(), and viewRedirect().

◆ getContributors()

Article::getContributors ( )

Call to WikiPage function for backwards compatibility.

See also
WikiPage::getContributors

Definition at line 2441 of file Article.php.

◆ getCreator()

Article::getCreator (   $audience = RevisionRecord::FOR_PUBLIC,
User  $user = null 
)

Call to WikiPage function for backwards compatibility.

See also
WikiPage::getCreator

Definition at line 2449 of file Article.php.

References $user.

◆ getDeletionUpdates()

Article::getDeletionUpdates ( Content  $content = null)

Call to WikiPage function for backwards compatibility.

See also
WikiPage::getDeletionUpdates

Definition at line 2457 of file Article.php.

References $content.

◆ getEmptyPageParserOutput()

Article::getEmptyPageParserOutput ( ParserOptions  $options)
protected

Returns ParserOutput to use when a page does not exist.

In some cases, we still want to show "virtual" content, e.g. in the MediaWiki namespace, or in the File namespace for non-local files.

Parameters
ParserOptions$options
Returns
ParserOutput

Definition at line 313 of file Article.php.

References $content, getSubstituteContent(), and getTitle().

Referenced by showMissingArticle().

◆ getHiddenCategories()

Article::getHiddenCategories ( )

Call to WikiPage function for backwards compatibility.

See also
WikiPage::getHiddenCategories

Definition at line 2465 of file Article.php.

◆ getId()

Article::getId ( )

Call to WikiPage function for backwards compatibility.

See also
WikiPage::getId

Definition at line 2473 of file Article.php.

Referenced by ImagePage\getEmptyPageParserOutput(), and ImagePage\openShowImage().

◆ getLatest()

Article::getLatest ( )

Call to WikiPage function for backwards compatibility.

See also
WikiPage::getLatest

Definition at line 2481 of file Article.php.

◆ getLinksTimestamp()

Article::getLinksTimestamp ( )

Call to WikiPage function for backwards compatibility.

See also
WikiPage::getLinksTimestamp

Definition at line 2489 of file Article.php.

◆ getMinorEdit()

Article::getMinorEdit ( )

Call to WikiPage function for backwards compatibility.

See also
WikiPage::getMinorEdit

Definition at line 2497 of file Article.php.

◆ getOldestRevision()

Article::getOldestRevision ( )

Call to WikiPage function for backwards compatibility.

See also
WikiPage::getOldestRevision

Definition at line 2505 of file Article.php.

◆ getOldID()

Article::getOldID ( )
See also
getOldIDFromRequest()
getRevIdFetched()
Returns
int The oldid of the article that is was requested in the constructor or via the context's WebRequest.

Definition at line 326 of file Article.php.

References $mOldId, and getOldIDFromRequest().

Referenced by fetchRevisionRecord(), getRobotPolicy(), isCurrent(), showDeletedRevisionHeader(), showDiffPage(), showMissingArticle(), ImagePage\view(), and view().

◆ getOldIDFromRequest()

Article::getOldIDFromRequest ( )

Sets $this->mRedirectUrl to a correct URL if the query parameters are incorrect.

Returns
int The old id for the request

Definition at line 339 of file Article.php.

References $request, getContext(), getTitle(), Revision\newFromId(), and null.

Referenced by getOldID().

◆ getPage()

Article::getPage ( )

Get the WikiPage object of this instance.

Since
1.19
Returns
WikiPage

Definition at line 231 of file Article.php.

References $mPage.

Referenced by ImageHistoryList\__construct(), EditPage\__construct(), and view().

◆ getParserOptions()

Article::getParserOptions ( )

Get parser options suitable for rendering the primary article wikitext.

Returns
ParserOptions

Definition at line 2215 of file Article.php.

References $mParserOptions, and getContext().

Referenced by getParserOutput(), and view().

◆ getParserOutput()

Article::getParserOutput (   $oldid = null,
User  $user = null 
)

#-

Lightweight method to get the parser output for a page, checking the parser cache and so on. Doesn't consider most of the stuff that Article::view() is forced to consider, so it's not appropriate to use there.

Since
1.16 (r52326) for LiquidThreads
Parameters
int | null$oldidRevision ID or null
User | null$userThe relevant user
Returns
ParserOutput|bool ParserOutput or false if the given revision ID is not found

Definition at line 2184 of file Article.php.

References $user, getParserOptions(), and null.

◆ getRedirectedFrom()

Article::getRedirectedFrom ( )

Get the page this view was redirected from.

Returns
Title|null
Since
1.28

Definition at line 203 of file Article.php.

References $mRedirectedFrom.

◆ getRedirectHeaderHtml()

static Article::getRedirectHeaderHtml ( Language  $lang,
  $target,
  $forceKnown = false 
)
static

Return the HTML for the top of a redirect page.

Chances are you should just be using the ParserOutput from WikitextContent::getParserOutput instead of calling this for redirects.

Since
1.23
Parameters
Language$lang
Title | array$targetDestination(s) to redirect
bool$forceKnownShould the image be shown as a bluelink regardless of existence?
Returns
string Containing HTML with redirect link

Definition at line 1690 of file Article.php.

References $html, $title, as, Linker\link(), and wfMessage().

Referenced by WikitextContent\fillParserOutput().

◆ getRedirectTarget()

Article::getRedirectTarget ( )

Call to WikiPage function for backwards compatibility.

See also
WikiPage::getRedirectTarget

Definition at line 2513 of file Article.php.

◆ getRedirectURL()

Article::getRedirectURL (   $rt)

Call to WikiPage function for backwards compatibility.

See also
WikiPage::getRedirectURL

Definition at line 2521 of file Article.php.

◆ getRevIdFetched()

Article::getRevIdFetched ( )

Use this to fetch the rev ID used on page views.

Before fetchRevisionRecord was called, this returns the page's latest revision, regardless of what getOldID() returns.

Returns
int Revision ID of last article revision

Definition at line 577 of file Article.php.

Referenced by view().

◆ getRevision()

Article::getRevision ( )

Call to WikiPage function for backwards compatibility.

See also
WikiPage::getRevision

Definition at line 2529 of file Article.php.

◆ getRevisionFetched()

Article::getRevisionFetched ( )

Get the fetched Revision object depending on request parameters or null on failure.

The revision returned may be a fake representing an error message or wrapping content supplied by an extension. Refer to $this->fetchResult for the revision actually loaded from the database.

Since
1.19
Returns
Revision|null

Definition at line 561 of file Article.php.

References $mRevision, and fetchRevisionRecord().

Referenced by showDiffPage(), and ArticleViewTest\testGetOldId().

◆ getRevisionRedirectTarget()

Article::getRevisionRedirectTarget ( RevisionRecord  $revision)
private
Parameters
RevisionRecord$revision
Returns
null|Title

Definition at line 873 of file Article.php.

References $content, Revision\RevisionRecord\getContent(), and null.

Referenced by view().

◆ getRobotPolicy()

Article::getRobotPolicy (   $action,
ParserOutput  $pOutput = null 
)

Get the robot policy to be used for the current view.

Parameters
string$actionThe action= GET parameter
ParserOutput | null$pOutput
Returns
array The policy that should be set
Todo:
actions other than 'view'

Definition at line 950 of file Article.php.

References $wgArticleRobotPolicies, $wgDefaultRobotPolicy, $wgNamespaceRobotPolicies, getContext(), getOldID(), getTitle(), IP\isValid(), NS_USER, NS_USER_TALK, and null.

Referenced by showMissingArticle(), and view().

◆ getSubstituteContent()

Article::getSubstituteContent ( )
private

Returns Content object to use when the page does not exist.

Returns
Content

Definition at line 286 of file Article.php.

References $content, getContext(), getTitle(), ContentHandler\makeContent(), NS_MEDIAWIKI, and null.

Referenced by getContentObject(), and getEmptyPageParserOutput().

◆ getTimestamp()

Article::getTimestamp ( )

Call to WikiPage function for backwards compatibility.

See also
WikiPage::getTimestamp

Definition at line 2537 of file Article.php.

◆ getTitle()

◆ getTouched()

Article::getTouched ( )

Call to WikiPage function for backwards compatibility.

See also
WikiPage::getTouched

Definition at line 2545 of file Article.php.

◆ getUndoContent()

Article::getUndoContent ( Revision  $undo,
Revision  $undoafter = null 
)

Call to WikiPage function for backwards compatibility.

See also
WikiPage::getUndoContent

Definition at line 2553 of file Article.php.

◆ getUser()

Article::getUser (   $audience = RevisionRecord::FOR_PUBLIC,
User  $user = null 
)

Call to WikiPage function for backwards compatibility.

See also
WikiPage::getUser

Definition at line 2561 of file Article.php.

References $user.

Referenced by fetchRevisionRecord(), ImagePage\getThumbSizes(), updateRestrictions(), ImagePage\uploadLinksBox(), CategoryPage\view(), and ImagePage\view().

◆ getUserText()

Article::getUserText (   $audience = RevisionRecord::FOR_PUBLIC,
User  $user = null 
)

Call to WikiPage function for backwards compatibility.

See also
WikiPage::getUserText

Definition at line 2569 of file Article.php.

References $user.

◆ hasViewableContent()

Article::hasViewableContent ( )

Call to WikiPage function for backwards compatibility.

See also
WikiPage::hasViewableContent

Definition at line 2577 of file Article.php.

◆ insertOn()

Article::insertOn (   $dbw,
  $pageId = null 
)

Call to WikiPage function for backwards compatibility.

See also
WikiPage::insertOn

Definition at line 2585 of file Article.php.

◆ insertProtectNullRevision()

Article::insertProtectNullRevision (   $revCommentMsg,
array  $limit,
array  $expiry,
  $cascade,
  $reason,
  $user = null 
)

Call to WikiPage function for backwards compatibility.

See also
WikiPage::insertProtectNullRevision

Definition at line 2593 of file Article.php.

References $user.

◆ insertRedirect()

Article::insertRedirect ( )

Call to WikiPage function for backwards compatibility.

See also
WikiPage::insertRedirect

Definition at line 2605 of file Article.php.

◆ insertRedirectEntry()

Article::insertRedirectEntry ( Title  $rt,
  $oldLatest = null 
)

Call to WikiPage function for backwards compatibility.

See also
WikiPage::insertRedirectEntry

Definition at line 2613 of file Article.php.

◆ isCountable()

Article::isCountable (   $editInfo = false)

Call to WikiPage function for backwards compatibility.

See also
WikiPage::isCountable

Definition at line 2621 of file Article.php.

◆ isCurrent()

Article::isCurrent ( )

Returns true if the currently-referenced revision is the current edit to this page (and it exists).

Returns
bool

Definition at line 543 of file Article.php.

References getOldID().

Referenced by view().

◆ isFileCacheable()

Article::isFileCacheable (   $mode = HTMLFileCache::MODE_NORMAL)

Check if the page can be cached.

Parameters
int$modeOne of the HTMLFileCache::MODE_* constants (since 1.28)
Returns
bool

Definition at line 2154 of file Article.php.

References getContext(), getTitle(), Hooks\run(), and HTMLFileCache\useFileCache().

Referenced by tryFileCache().

◆ isRedirect()

Article::isRedirect ( )

Call to WikiPage function for backwards compatibility.

See also
WikiPage::isRedirect

Definition at line 2629 of file Article.php.

Referenced by showRedirectedFromHeader().

◆ loadFromRow()

Article::loadFromRow (   $data,
  $from 
)

Call to WikiPage function for backwards compatibility.

See also
WikiPage::loadFromRow

Definition at line 2637 of file Article.php.

◆ loadPageData()

Article::loadPageData (   $from = 'fromdb')

Call to WikiPage function for backwards compatibility.

See also
WikiPage::loadPageData

Definition at line 2645 of file Article.php.

◆ lockAndGetLatest()

Article::lockAndGetLatest ( )

Call to WikiPage function for backwards compatibility.

See also
WikiPage::lockAndGetLatest

Definition at line 2653 of file Article.php.

◆ makeFetchErrorContent()

Article::makeFetchErrorContent ( )
private

Returns a Content object representing any error in $this->fetchContent, or null if there is no such error.

Returns
Content|null

Definition at line 507 of file Article.php.

References null.

Referenced by fetchRevisionRecord().

◆ makeParserOptions()

Article::makeParserOptions (   $context)

Call to WikiPage function for backwards compatibility.

See also
WikiPage::makeParserOptions

Definition at line 2661 of file Article.php.

References $context.

◆ newFromID()

static Article::newFromID (   $id)
static

Constructor from a page id.

Parameters
int$idArticle ID to load
Returns
Article|null

Definition at line 148 of file Article.php.

References $t, Title\newFromID(), and null.

◆ newFromTitle()

static Article::newFromTitle (   $title,
IContextSource  $context 
)
static

Create an Article object of the appropriate class for the given page.

Parameters
Title$title
IContextSource$context
Returns
Article

Definition at line 160 of file Article.php.

References $title, Title\makeTitle(), NS_CATEGORY, NS_FILE, NS_MEDIA, null, and Hooks\run().

Referenced by ApiParse\execute(), and RebuildFileCache\execute().

◆ newFromWikiPage()

static Article::newFromWikiPage ( WikiPage  $page,
IContextSource  $context 
)
static

Create an Article object of the appropriate class for the given page.

Parameters
WikiPage$page
IContextSource$context
Returns
Article

Definition at line 192 of file Article.php.

References $context, and WikiPage\getTitle().

Referenced by ApiEditPage\execute(), MediaWiki\initializeArticle(), and ArticleViewTest\testViewNonText().

◆ newPage()

Article::newPage ( Title  $title)
protected
Parameters
Title$title
Returns
WikiPage

Definition at line 139 of file Article.php.

Referenced by __construct().

◆ pageDataFromId()

Article::pageDataFromId (   $dbr,
  $id,
  $options = [] 
)

Call to WikiPage function for backwards compatibility.

See also
WikiPage::pageDataFromId

Definition at line 2669 of file Article.php.

References $dbr, and $options.

◆ pageDataFromTitle()

Article::pageDataFromTitle (   $dbr,
  $title,
  $options = [] 
)

Call to WikiPage function for backwards compatibility.

See also
WikiPage::pageDataFromTitle

Definition at line 2677 of file Article.php.

References $dbr, $options, and $title.

◆ prepareContentForEdit()

Article::prepareContentForEdit ( Content  $content,
  $revision = null,
User  $user = null,
  $serialFormat = null,
  $useCache = true 
)

Call to WikiPage function for backwards compatibility.

See also
WikiPage::prepareContentForEdit

Definition at line 2685 of file Article.php.

References $user.

◆ protect()

Article::protect ( )

action=protect handler

Definition at line 1753 of file Article.php.

Referenced by unprotect().

◆ protectDescription()

Article::protectDescription ( array  $limit,
array  $expiry 
)

Call to WikiPage function for backwards compatibility.

See also
WikiPage::protectDescription

Definition at line 2699 of file Article.php.

◆ protectDescriptionLog()

Article::protectDescriptionLog ( array  $limit,
array  $expiry 
)

Call to WikiPage function for backwards compatibility.

See also
WikiPage::protectDescriptionLog

Definition at line 2707 of file Article.php.

◆ purgePatrolFooterCache()

static Article::purgePatrolFooterCache (   $articleID)
static

Purge the cache used to check if it is worth showing the patrol footer For example, it is done during re-uploads when file patrol is used.

Parameters
int$articleIDID of the article to purge
Since
1.27

Definition at line 1340 of file Article.php.

References $cache.

Referenced by LocalFile\recordUpload2().

◆ render()

Article::render ( )

Handle action=render.

Definition at line 1742 of file Article.php.

References getContext(), and view().

◆ replaceSectionAtRev()

Article::replaceSectionAtRev (   $sectionId,
Content  $sectionContent,
  $sectionTitle = '',
  $baseRevId = null 
)

Call to WikiPage function for backwards compatibility.

See also
WikiPage::replaceSectionAtRev

Definition at line 2715 of file Article.php.

◆ replaceSectionContent()

Article::replaceSectionContent (   $sectionId,
Content  $sectionContent,
  $sectionTitle = '',
  $edittime = null 
)

Call to WikiPage function for backwards compatibility.

See also
WikiPage::replaceSectionContent

Definition at line 2727 of file Article.php.

◆ setContext()

Article::setContext (   $context)

Sets the context this Article is executed in.

Parameters
IContextSource$context
Since
1.18

Definition at line 2229 of file Article.php.

References $context.

Referenced by ArticleViewTest\testGetOldId().

◆ setOldSubtitle()

Article::setOldSubtitle (   $oldid = 0)

Generate the navigation links when browsing through an article revisions It shows the information as: Revision as of \<date\>; view current revision \<- Previous version | Next Version -\>

Parameters
int$oldidRevision ID of this article revision

Definition at line 1528 of file Article.php.

References $context, $mRevision, $unhide, $user, getContext(), Linker\getRevDeleteLink(), getTitle(), Linker\linkKnown(), Revision\newFromId(), Linker\revComment(), Linker\revUserTools(), and Hooks\run().

Referenced by view().

◆ setParserOptions()

Article::setParserOptions ( ParserOptions  $options)

Override the ParserOptions used to render the primary article wikitext.

Parameters
ParserOptions$options
Exceptions
MWExceptionIf the parser options where already initialized.

Definition at line 2202 of file Article.php.

References $options.

◆ setRedirectedFrom()

Article::setRedirectedFrom ( Title  $from)

Tell the page view functions that this view was redirected from another page on the wiki.

Parameters
Title$from

Definition at line 212 of file Article.php.

◆ setTimestamp()

Article::setTimestamp (   $ts)

Call to WikiPage function for backwards compatibility.

See also
WikiPage::setTimestamp

Definition at line 2739 of file Article.php.

◆ shouldCheckParserCache()

Article::shouldCheckParserCache ( ParserOptions  $parserOptions,
  $oldId 
)

Call to WikiPage function for backwards compatibility.

See also
WikiPage::shouldCheckParserCache

Definition at line 2747 of file Article.php.

◆ showDeletedRevisionHeader()

Article::showDeletedRevisionHeader ( )

If the revision requested for view is deleted, check permissions.

Send either an error message or a warning header to the output.

Returns
bool True if the view is allowed, false if not.

Definition at line 1485 of file Article.php.

References $link, $user, getContext(), getOldID(), and getTitle().

Referenced by view().

◆ showDiffPage()

Article::showDiffPage ( )
protected

Show a diff page according to current request variables.

For use within Article::view() only, other callers should use the DifferenceEngine class.

Definition at line 900 of file Article.php.

References $request, $rev, $unhide, $user, getContext(), getOldID(), getRevisionFetched(), list, and wfMessage().

Referenced by view().

◆ showMissingArticle()

Article::showMissingArticle ( )

◆ showNamespaceHeader()

Article::showNamespaceHeader ( )

Show a header specific to the namespace currently being viewed, like [[MediaWiki:Talkpagetext]].

For Article::view().

Definition at line 1136 of file Article.php.

References getContext(), getTitle(), and wfMessage().

Referenced by view().

◆ showPatrolFooter()

Article::showPatrolFooter ( )

If patrol is possible, output a patrol UI box.

This is called from the footer section of ordinary page views. If patrol is not possible or not desired, does nothing. Side effect: When the patrol link is build, this method will call OutputPage::preventClickjacking() and load mediawiki.page.patrol.ajax.

Returns
bool

Definition at line 1171 of file Article.php.

References $cache, $dbr, $link, $title, $user, $wgUseFilePatrol, $wgUseNPPatrol, $wgUseRCPatrol, DB_REPLICA, getContext(), getTitle(), RecentChange\isInRCLifespan(), Linker\linkKnown(), RecentChange\newFromConds(), NS_FILE, RC_LOG, Hooks\run(), wfGetDB(), and wfMessage().

Referenced by showViewFooter().

◆ showRedirectedFromHeader()

Article::showRedirectedFromHeader ( )

If this request is a redirect view, send "redirected from" subtitle to the output.

Returns true if the header was needed, false if this is not a redirect view. Handles both local and remote redirects.

Returns
bool

Definition at line 1059 of file Article.php.

References $context, $query, $request, $wgRedirectSources, getContext(), getTitle(), isRedirect(), Linker\linkKnown(), Linker\makeExternalLink(), null, and Hooks\run().

Referenced by view().

◆ showViewFooter()

Article::showViewFooter ( )

Show the footer section of an ordinary page view.

Definition at line 1148 of file Article.php.

References getContext(), getTitle(), IP\isValid(), NS_USER_TALK, Hooks\run(), and showPatrolFooter().

Referenced by view().

◆ supportsSections()

Article::supportsSections ( )

Call to WikiPage function for backwards compatibility.

See also
WikiPage::supportsSections

Definition at line 2755 of file Article.php.

◆ triggerOpportunisticLinksUpdate()

Article::triggerOpportunisticLinksUpdate ( ParserOutput  $parserOutput)

Call to WikiPage function for backwards compatibility.

See also
WikiPage::triggerOpportunisticLinksUpdate

Definition at line 2763 of file Article.php.

◆ tryFileCache()

Article::tryFileCache ( )
protected

checkLastModified returns true if it has taken care of all output to the client that is necessary for this request.

(that is, it has sent a cached version of the page)

Returns
bool True if cached version send, false otherwise

Definition at line 2123 of file Article.php.

References $cache, getContext(), getTitle(), isFileCacheable(), and wfDebug().

Referenced by view().

◆ unprotect()

Article::unprotect ( )

action=unprotect handler (alias)

Definition at line 1761 of file Article.php.

References protect().

◆ updateCategoryCounts()

Article::updateCategoryCounts ( array  $added,
array  $deleted,
  $id = 0 
)

Call to WikiPage function for backwards compatibility.

See also
WikiPage::updateCategoryCounts

Definition at line 2771 of file Article.php.

◆ updateIfNewerOn()

Article::updateIfNewerOn (   $dbw,
  $revision 
)

Call to WikiPage function for backwards compatibility.

See also
WikiPage::updateIfNewerOn

Definition at line 2779 of file Article.php.

◆ updateRedirectOn()

Article::updateRedirectOn (   $dbw,
  $redirectTitle,
  $lastRevIsRedirect = null 
)

Call to WikiPage function for backwards compatibility.

See also
WikiPage::updateRedirectOn

Definition at line 2787 of file Article.php.

◆ updateRestrictions()

Article::updateRestrictions (   $limit = [],
  $reason = '',
$cascade = 0,
  $expiry = [] 
)
Parameters
array$limit
string$reason
int&$cascade
array$expiry
Returns
bool

Definition at line 2824 of file Article.php.

References getContext(), and getUser().

◆ updateRevisionOn()

Article::updateRevisionOn (   $dbw,
  $revision,
  $lastRevision = null,
  $lastRevIsRedirect = null 
)

Call to WikiPage function for backwards compatibility.

See also
WikiPage::updateRevisionOn

Definition at line 2795 of file Article.php.

◆ view()

◆ viewRedirect()

Article::viewRedirect (   $target,
  $appendSubtitle = true,
  $forceKnown = false 
)

Return the HTML for the top of a redirect page.

Chances are you should just be using the ParserOutput from WikitextContent::getParserOutput instead of calling this for redirects.

Parameters
Title | array$targetDestination(s) to redirect
bool$appendSubtitle[optional]
bool$forceKnownShould the image be shown as a bluelink regardless of existence?
Returns
string Containing HTML with redirect link
Deprecated:
since 1.30

Definition at line 1668 of file Article.php.

References $lang, $out, getContext(), getTitle(), and wfMessage().

Member Data Documentation

◆ $fetchResult

Status null Article::$fetchResult = null
private

represents the outcome of fetchRevisionRecord().

$fetchResult->value is the RevisionRecord object, if the operation was successful.

The information in $fetchResult is duplicated by the following deprecated public fields: $mRevIdFetched, $mContentLoaded. $mRevision (and $mContentObject) also typically duplicate information of the loaded revision, but may be overwritten by extensions or due to errors.

Definition at line 100 of file Article.php.

◆ $mContentLoaded

bool Article::$mContentLoaded = false

Is the target revision loaded? Set by fetchRevisionRecord().

Deprecated:
since 1.32. Whether content has been loaded should not be relevant to code outside this class.

Definition at line 70 of file Article.php.

◆ $mContentObject

Content null Article::$mContentObject

Content of the main slot of $this->mRevision.

Note
This variable is read only, setting it has no effect. Extensions that wish to override the output of Article::view should use a hook.
Todo:
MCR: Remove in 1.33
Deprecated:
since 1.32
Since
1.21

Definition at line 62 of file Article.php.

Referenced by fetchContentObject(), and getContentObject().

◆ $mContext

IContextSource null Article::$mContext
protected

The context this Article is executed in.

If null, RequestContext::getMain() is used.

Definition at line 43 of file Article.php.

Referenced by getContext().

◆ $mOldId

int null Article::$mOldId

The oldid of the article that was requested to be shown, 0 for the current revision.

See also
$mRevIdFetched

Definition at line 77 of file Article.php.

Referenced by getOldID().

◆ $mPage

WikiPage null Article::$mPage
protected

The WikiPage object of this instance.

Definition at line 46 of file Article.php.

Referenced by getPage().

◆ $mParserOptions

ParserOptions null Article::$mParserOptions

ParserOptions object for $wgUser articles.

Initialized by getParserOptions by calling $this->mPage->makeParserOptions().

Definition at line 52 of file Article.php.

Referenced by getParserOptions().

◆ $mParserOutput

ParserOutput null false Article::$mParserOutput = null

The ParserOutput generated for viewing the page, initialized by view().

If no ParserOutput could be generated, this is set to false.

Deprecated:
since 1.32

Definition at line 116 of file Article.php.

◆ $mRedirectedFrom

Title null Article::$mRedirectedFrom = null

Title from which we were redirected here, if any.

Definition at line 80 of file Article.php.

Referenced by getRedirectedFrom().

◆ $mRedirectUrl

string bool Article::$mRedirectUrl = false

URL to redirect to or false if none.

Definition at line 83 of file Article.php.

◆ $mRevIdFetched

int Article::$mRevIdFetched = 0

Revision ID of revision that was loaded.

See also
$mOldId
Deprecated:
since 1.32, use getRevIdFetched() instead.

Definition at line 90 of file Article.php.

◆ $mRevision

Revision null Article::$mRevision = null

Revision to be shown.

Initialized by getOldIDFromRequest() or fetchContentObject(). Normally loaded from the database, but may be replaced by an extension, or be a fake representing an error message or some such. While the output of Article::view is typically based on this revision, it may be overwritten by error messages or replaced by extensions.

Definition at line 109 of file Article.php.

Referenced by getRevisionFetched(), and setOldSubtitle().

◆ $viewIsRenderAction

bool Article::$viewIsRenderAction = false
protected

Whether render() was called.

With the way subclasses work here, there doesn't seem to be any other way to stop calling OutputPage::enableSectionEditLinks() and still have it work as it did before.

Definition at line 123 of file Article.php.


The documentation for this class was generated from the following file: