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

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().
 
static getRedirectHeaderHtml (Language $lang, $target, $forceKnown=false)
 Return the HTML for the top of a redirect page.
 
static newFromID ( $id)
 Constructor from a page id.
 
static newFromTitle ( $title, IContextSource $context)
 Create an Article object of the appropriate class for the given page.
 
static newFromWikiPage (WikiPage $page, IContextSource $context)
 Create an Article object of the appropriate class for the given page.
 
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.
 

Public Attributes

string $mContent
 Text of the revision we are working on.
 
bool $mContentLoaded = false
 Is the content ($mContent) already loaded?
 
Content $mContentObject
 Content of the revision we are working on.
 
int null $mOldId
 The oldid of the article that is to be shown, 0 for the current revision.
 
ParserOptions $mParserOptions
 ParserOptions object for $wgUser articles.
 
ParserOutput $mParserOutput
 
Title $mRedirectedFrom = null
 Title from which we were redirected here.
 
string bool $mRedirectUrl = false
 URL to redirect to or false if none.
 
int $mRevIdFetched = 0
 Revision ID of revision we are working on.
 
Revision $mRevision = null
 Revision we are working on.
 

Protected Member Functions

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

Protected Attributes

IContextSource $mContext
 The context this Article is executed in.
 
WikiPage $mPage
 The WikiPage object of this instance.
 

Private Attributes

bool $disableSectionEditForRender = false
 Whether render() was called.
 

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

See design.txt for an overview. Note: edit user interface and cache support functions have been moved to separate EditPage and HTMLFileCache classes.

Definition at line 35 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$oldIdRevision ID, null to fetch from request, zero for current

Definition at line 90 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 2048 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 2063 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 1523 of file Article.php.

References $out, getContext(), getTitle(), 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 691 of file Article.php.

References getContext().

Referenced by view().

◆ checkFlags()

Article::checkFlags ( $flags)

Call to WikiPage function for backwards compatibility.

See also
WikiPage::checkFlags

Definition at line 2079 of file Article.php.

◆ checkTouched()

Article::checkTouched ( )

Call to WikiPage function for backwards compatibility.

See also
WikiPage::checkTouched

Definition at line 2087 of file Article.php.

◆ clear()

Article::clear ( )

Clear the object.

Definition at line 198 of file Article.php.

◆ clearPreparedEdit()

Article::clearPreparedEdit ( )

Call to WikiPage function for backwards compatibility.

See also
WikiPage::clearPreparedEdit

Definition at line 2095 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 2659 of file Article.php.

References getContext().

◆ confirmDelete()

Article::confirmDelete ( $reason)

Output deletion confirmation dialog.

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

Definition at line 1693 of file Article.php.

References $link, $options, getContext(), getTitle(), Linker\linkKnown(), MIGRATION_OLD, LogEventsList\showLogExtract(), wfDebug(), and wfMessage().

Referenced by delete().

◆ delete()

◆ doDelete()

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

Perform a deletion and output success or failure messages.

Parameters
string$reason
bool$suppress

Definition at line 1862 of file Article.php.

References $context, getContext(), getTitle(), LogEventsList\showLogExtract(), wfEscapeWikiText(), and wfMessage().

Referenced by delete().

◆ doDeleteArticle()

Article::doDeleteArticle ( $reason,
$suppress = false,
$u1 = null,
$u2 = null,
& $error = '' )
Parameters
string$reason
bool$suppress
int$u1Unused
bool$u2Unused
string&$error
Returns
bool

Definition at line 2631 of file Article.php.

◆ doDeleteArticleReal()

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

Call to WikiPage function for backwards compatibility.

See also
WikiPage::doDeleteArticleReal

Definition at line 2103 of file Article.php.

◆ doDeleteUpdates()

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

Call to WikiPage function for backwards compatibility.

See also
WikiPage::doDeleteUpdates

Definition at line 2116 of file Article.php.

◆ doEditContent()

Article::doEditContent ( Content $content,
$summary,
$flags = 0,
$baseRevId = 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 2125 of file Article.php.

References wfDeprecated().

◆ doEditUpdates()

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

Call to WikiPage function for backwards compatibility.

See also
WikiPage::doEditUpdates

Definition at line 2138 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 2148 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 2646 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 2598 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 2156 of file Article.php.

◆ exists()

Article::exists ( )

Call to WikiPage function for backwards compatibility.

See also
WikiPage::exists

Definition at line 2164 of file Article.php.

◆ fetchContentObject()

Article::fetchContentObject ( )
protected

Get text content object Does NOT follow redirects.

Todo
When is this null?
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 320 of file Article.php.

References $mContentObject, getContext(), getOldID(), getTitle(), getUser(), and wfDebug().

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

◆ followRedirect()

Article::followRedirect ( )

Call to WikiPage function for backwards compatibility.

See also
WikiPage::followRedirect

Definition at line 2172 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 833 of file Article.php.

Referenced by getRobotPolicy(), and OutputPage\setRobotPolicy().

◆ generateReason()

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

Definition at line 2668 of file Article.php.

References $handler.

Referenced by delete().

◆ getActionOverrides()

Article::getActionOverrides ( )

Call to WikiPage function for backwards compatibility.

See also
ContentHandler::getActionOverrides

Definition at line 2180 of file Article.php.

◆ getAutoDeleteReason()

Article::getAutoDeleteReason ( & $hasHistory)

Call to WikiPage function for backwards compatibility.

See also
WikiPage::getAutoDeleteReason

Definition at line 2188 of file Article.php.

◆ getCategories()

Article::getCategories ( )

Call to WikiPage function for backwards compatibility.

See also
WikiPage::getCategories

Definition at line 2196 of file Article.php.

◆ getComment()

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

Call to WikiPage function for backwards compatibility.

See also
WikiPage::getComment

Definition at line 2204 of file Article.php.

◆ getContentHandler()

Article::getContentHandler ( )

Call to WikiPage function for backwards compatibility.

See also
WikiPage::getContentHandler

Definition at line 2212 of file Article.php.

◆ getContentModel()

Article::getContentModel ( )

Call to WikiPage function for backwards compatibility.

See also
WikiPage::getContentModel

Definition at line 2220 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.

Returns
Content Return the content of this revision
Since
1.21

Reimplemented in ImagePage.

Definition at line 223 of file Article.php.

References $mContentObject, fetchContentObject(), getContext(), and getTitle().

Referenced by showMissingArticle(), and view().

◆ getContext()

◆ getContributors()

Article::getContributors ( )

Call to WikiPage function for backwards compatibility.

See also
WikiPage::getContributors

Definition at line 2228 of file Article.php.

◆ getCreator()

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

Call to WikiPage function for backwards compatibility.

See also
WikiPage::getCreator

Definition at line 2236 of file Article.php.

◆ getDeletionUpdates()

Article::getDeletionUpdates ( Content $content = null)

Call to WikiPage function for backwards compatibility.

See also
WikiPage::getDeletionUpdates

Definition at line 2244 of file Article.php.

◆ getHiddenCategories()

Article::getHiddenCategories ( )

Call to WikiPage function for backwards compatibility.

See also
WikiPage::getHiddenCategories

Definition at line 2252 of file Article.php.

◆ getId()

Article::getId ( )

Call to WikiPage function for backwards compatibility.

See also
WikiPage::getId

Definition at line 2260 of file Article.php.

Referenced by ImagePage\openShowImage().

◆ getLatest()

Article::getLatest ( )

Call to WikiPage function for backwards compatibility.

See also
WikiPage::getLatest

Definition at line 2268 of file Article.php.

◆ getLinksTimestamp()

Article::getLinksTimestamp ( )

Call to WikiPage function for backwards compatibility.

See also
WikiPage::getLinksTimestamp

Definition at line 2276 of file Article.php.

◆ getMinorEdit()

Article::getMinorEdit ( )

Call to WikiPage function for backwards compatibility.

See also
WikiPage::getMinorEdit

Definition at line 2284 of file Article.php.

◆ getOldestRevision()

Article::getOldestRevision ( )

Call to WikiPage function for backwards compatibility.

See also
WikiPage::getOldestRevision

Definition at line 2292 of file Article.php.

◆ getOldID()

Article::getOldID ( )
Returns
int The oldid of the article that is to be shown, 0 for the current revision

Definition at line 249 of file Article.php.

References $mOldId, and getOldIDFromRequest().

Referenced by fetchContentObject(), isCurrent(), showDeletedRevisionHeader(), showDiffPage(), showMissingArticle(), view(), and ImagePage\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 262 of file Article.php.

References $request, getContext(), and getTitle().

Referenced by getOldID().

◆ getPage()

Article::getPage ( )

Get the WikiPage object of this instance.

Since
1.19
Returns
WikiPage

Definition at line 191 of file Article.php.

References $mPage.

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

◆ getParserOptions()

Article::getParserOptions ( )

Get parser options suitable for rendering the primary article wikitext.

Returns
ParserOptions

Definition at line 2007 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 WikiPage::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$userThe relevant user
Returns
ParserOutput|bool ParserOutput or false if the given revision ID is not found

Definition at line 1976 of file Article.php.

References getParserOptions().

Referenced by showMissingArticle().

◆ getRedirectedFrom()

Article::getRedirectedFrom ( )

Get the page this view was redirected from.

Returns
Title|null
Since
1.28

Definition at line 163 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 1488 of file Article.php.

References $html, $lang, 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 2300 of file Article.php.

◆ getRedirectURL()

Article::getRedirectURL ( $rt)

Call to WikiPage function for backwards compatibility.

See also
WikiPage::getRedirectURL

Definition at line 2308 of file Article.php.

◆ getRevIdFetched()

Article::getRevIdFetched ( )

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

Returns
int Revision ID of last article revision

Definition at line 423 of file Article.php.

References $mRevIdFetched.

Referenced by view().

◆ getRevision()

Article::getRevision ( )

Call to WikiPage function for backwards compatibility.

See also
WikiPage::getRevision

Definition at line 2316 of file Article.php.

◆ getRevisionFetched()

Article::getRevisionFetched ( )

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

Since
1.19
Returns
Revision|null

Definition at line 412 of file Article.php.

References $mRevision, and fetchContentObject().

Referenced by showDiffPage().

◆ getRobotPolicy()

Article::getRobotPolicy ( $action,
$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 753 of file Article.php.

References $wgArticleRobotPolicies, $wgDefaultRobotPolicy, $wgNamespaceRobotPolicies, formatRobotPolicy(), getContext(), getTitle(), Block\newFromTarget(), and NS_USER_TALK.

Referenced by showMissingArticle(), and view().

◆ getTimestamp()

Article::getTimestamp ( )

Call to WikiPage function for backwards compatibility.

See also
WikiPage::getTimestamp

Definition at line 2324 of file Article.php.

◆ getTitle()

◆ getTouched()

Article::getTouched ( )

Call to WikiPage function for backwards compatibility.

See also
WikiPage::getTouched

Definition at line 2332 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 2340 of file Article.php.

◆ getUser()

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

Call to WikiPage function for backwards compatibility.

See also
WikiPage::getUser

Definition at line 2348 of file Article.php.

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

◆ getUserText()

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

Call to WikiPage function for backwards compatibility.

See also
WikiPage::getUserText

Definition at line 2356 of file Article.php.

◆ hasViewableContent()

Article::hasViewableContent ( )

Call to WikiPage function for backwards compatibility.

See also
WikiPage::hasViewableContent

Definition at line 2364 of file Article.php.

◆ insertOn()

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

Call to WikiPage function for backwards compatibility.

See also
WikiPage::insertOn

Definition at line 2372 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 2380 of file Article.php.

◆ insertRedirect()

Article::insertRedirect ( )

Call to WikiPage function for backwards compatibility.

See also
WikiPage::insertRedirect

Definition at line 2392 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 2400 of file Article.php.

◆ isCountable()

Article::isCountable ( $editInfo = false)

Call to WikiPage function for backwards compatibility.

See also
WikiPage::isCountable

Definition at line 2408 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 396 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 1946 of file Article.php.

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

Referenced by tryFileCache().

◆ isRedirect()

Article::isRedirect ( )

Call to WikiPage function for backwards compatibility.

See also
WikiPage::isRedirect

Definition at line 2416 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 2424 of file Article.php.

◆ loadPageData()

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

Call to WikiPage function for backwards compatibility.

See also
WikiPage::loadPageData

Definition at line 2432 of file Article.php.

◆ lockAndGetLatest()

Article::lockAndGetLatest ( )

Call to WikiPage function for backwards compatibility.

See also
WikiPage::lockAndGetLatest

Definition at line 2440 of file Article.php.

◆ makeParserOptions()

Article::makeParserOptions ( $context)

Call to WikiPage function for backwards compatibility.

See also
WikiPage::makeParserOptions

Definition at line 2448 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 108 of file Article.php.

References $t.

◆ 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 120 of file Article.php.

References $context, NS_CATEGORY, NS_FILE, and NS_MEDIA.

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

◆ 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 152 of file Article.php.

References $article, $context, WikiPage\getTitle(), and newFromTitle().

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

◆ newPage()

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

Reimplemented in CategoryPage, and ImagePage.

Definition at line 99 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 2456 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 2464 of file Article.php.

References $dbr, and $options.

◆ 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 2472 of file Article.php.

◆ protect()

Article::protect ( )

action=protect handler

Definition at line 1550 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 2486 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 2494 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 1140 of file Article.php.

References $cache.

Referenced by LocalFile\recordUpload2().

◆ render()

Article::render ( )

Handle action=render.

Reimplemented in ImagePage.

Definition at line 1540 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 2502 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 2514 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 2021 of file Article.php.

References $context.

◆ 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 1326 of file Article.php.

References $context, $mRevision, $unhide, getContext(), Linker\getRevDeleteLink(), getTitle(), Linker\linkKnown(), Linker\revComment(), and Linker\revUserTools().

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 1994 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 172 of file Article.php.

◆ setTimestamp()

Article::setTimestamp ( $ts)

Call to WikiPage function for backwards compatibility.

See also
WikiPage::setTimestamp

Definition at line 2526 of file Article.php.

◆ shouldCheckParserCache()

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

Call to WikiPage function for backwards compatibility.

See also
WikiPage::shouldCheckParserCache

Definition at line 2534 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 1283 of file Article.php.

References $link, 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 703 of file Article.php.

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

Referenced by view().

◆ showMissingArticle()

Article::showMissingArticle ( )

Show the error text for a missing article.

For articles in the MediaWiki namespace, show the default message text. To be called from Article::view().

Definition at line 1149 of file Article.php.

References $cache, $dbr, $lang, $wgSend404Code, DB_REPLICA, getContentObject(), getContext(), getOldID(), getParserOutput(), getRobotPolicy(), getTitle(), User\isIP(), User\newFromName(), Block\newFromTarget(), NS_USER_TALK, LogEventsList\showLogExtract(), Block\TYPE_AUTO, wfEscapeWikiText(), wfGetDB(), and wfMessage().

Referenced by view().

◆ showNamespaceHeader()

Article::showNamespaceHeader ( )

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

For Article::view().

Definition at line 939 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 976 of file Article.php.

References $cache, $dbr, $link, $wgEnableAPI, $wgEnableWriteAPI, $wgUseFilePatrol, $wgUseNPPatrol, $wgUseRCPatrol, DB_REPLICA, getContext(), getTitle(), Linker\linkKnown(), NS_FILE, RC_LOG, 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 862 of file Article.php.

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

Referenced by view().

◆ showViewFooter()

Article::showViewFooter ( )

Show the footer section of an ordinary page view.

Definition at line 953 of file Article.php.

References getContext(), getTitle(), NS_USER_TALK, and showPatrolFooter().

Referenced by view().

◆ supportsSections()

Article::supportsSections ( )

Call to WikiPage function for backwards compatibility.

See also
WikiPage::supportsSections

Definition at line 2542 of file Article.php.

◆ triggerOpportunisticLinksUpdate()

Article::triggerOpportunisticLinksUpdate ( ParserOutput $parserOutput)

Call to WikiPage function for backwards compatibility.

See also
WikiPage::triggerOpportunisticLinksUpdate

Definition at line 2550 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 1915 of file Article.php.

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

Referenced by view().

◆ unprotect()

Article::unprotect ( )

action=unprotect handler (alias)

Definition at line 1558 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 2558 of file Article.php.

◆ updateIfNewerOn()

Article::updateIfNewerOn ( $dbw,
$revision )

Call to WikiPage function for backwards compatibility.

See also
WikiPage::updateIfNewerOn

Definition at line 2566 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 2574 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 2611 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 2582 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 1466 of file Article.php.

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

Member Data Documentation

◆ $disableSectionEditForRender

bool Article::$disableSectionEditForRender = false
private

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 83 of file Article.php.

◆ $mContent

string Article::$mContent

Text of the revision we are working on.

Todo
BC cruft

Definition at line 49 of file Article.php.

◆ $mContentLoaded

bool Article::$mContentLoaded = false

Is the content ($mContent) already loaded?

Definition at line 58 of file Article.php.

◆ $mContentObject

Content Article::$mContentObject

Content of the revision we are working on.

Since
1.21

Definition at line 55 of file Article.php.

Referenced by fetchContentObject(), and getContentObject().

◆ $mContext

IContextSource Article::$mContext
protected

The context this Article is executed in.

Definition at line 37 of file Article.php.

Referenced by getContext().

◆ $mOldId

int null Article::$mOldId

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

Definition at line 61 of file Article.php.

Referenced by getOldID().

◆ $mPage

WikiPage Article::$mPage
protected

The WikiPage object of this instance.

Definition at line 40 of file Article.php.

Referenced by getPage().

◆ $mParserOptions

ParserOptions Article::$mParserOptions

ParserOptions object for $wgUser articles.

Definition at line 43 of file Article.php.

Referenced by getParserOptions().

◆ $mParserOutput

ParserOutput Article::$mParserOutput

Definition at line 76 of file Article.php.

Referenced by view().

◆ $mRedirectedFrom

Title Article::$mRedirectedFrom = null

Title from which we were redirected here.

Definition at line 64 of file Article.php.

Referenced by getRedirectedFrom().

◆ $mRedirectUrl

string bool Article::$mRedirectUrl = false

URL to redirect to or false if none.

Definition at line 67 of file Article.php.

◆ $mRevIdFetched

int Article::$mRevIdFetched = 0

Revision ID of revision we are working on.

Definition at line 70 of file Article.php.

Referenced by getRevIdFetched().

◆ $mRevision

Revision Article::$mRevision = null

Revision we are working on.

Definition at line 73 of file Article.php.

Referenced by getRevisionFetched(), and setOldSubtitle().


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